Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as _ from 'lodash';
import { fixBabelGeneratorIssues, fixLineEndings } from '../docs/scripts/helpers';
const glob = promisify(globCallback);
const ignoreCache = process.argv.includes('--disable-cache');
const verbose = process.argv.includes('--verbose');
enum GenerateResult {
Success,
Skipped,
NoComponent,
Failed,
}
const tsconfig = ttp.loadConfig(path.resolve(__dirname, '../tsconfig.json'));
const prettierConfig = prettier.resolveConfig.sync(process.cwd(), {
config: path.join(__dirname, '../prettier.config.js'),
});
async function generateProptypes(
tsFile: string,
jsFile: string,
program: ttp.ts.Program,
): Promise {
const proptypes = ttp.parseFromProgram(tsFile, program, {
shouldResolveObject: ({ name }) => {
if (name.toLowerCase().endsWith('classes') || name === 'theme' || name.endsWith('Props')) {
return false;
}
return undefined;
*/
/**
* List of demos to ignore when transpiling
* Example: "app-bar/BottomAppBar.tsx"
*/
const ignoreList = [];
const fse = require('fs-extra');
const path = require('path');
const babel = require('@babel/core');
const prettier = require('prettier');
const typescriptToProptypes = require('typescript-to-proptypes');
const { fixBabelGeneratorIssues, fixLineEndings } = require('./helpers');
const tsConfig = typescriptToProptypes.loadConfig(path.resolve(__dirname, '../tsconfig.json'));
const babelConfig = {
presets: ['@babel/preset-typescript'],
plugins: ['unwrap-createstyles'],
generatorOpts: { retainLines: true },
babelrc: false,
configFile: false,
};
const watchMode = process.argv.some(arg => arg === '--watch');
const cacheDisabled = process.argv.some(arg => arg === '--disable-cache');
const workspaceRoot = path.join(__dirname, '../../');
const prettierConfig = prettier.resolveConfig.sync(process.cwd(), {
config: path.join(workspaceRoot, 'prettier.config.js'),