Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cwd: folderPath,
}),
),
);
const files = _.flatten(allFiles)
// Filter out files where the directory name and filename doesn't match
// Example: Modal/ModalManager.d.ts
.filter(filePath => {
const folderName = path.basename(path.dirname(filePath));
const fileName = path.basename(filePath, '.d.ts');
return fileName === folderName;
});
const program = ttp.createProgram(files, tsconfig);
const promises = files.map>(async tsFile => {
const jsFile = tsFile.replace('.d.ts', '.js');
if (!ignoreCache && (await fse.stat(jsFile)).mtimeMs > (await fse.stat(tsFile)).mtimeMs) {
// Javascript version is newer, skip file
return GenerateResult.Skipped;
}
return generateProptypes(tsFile, jsFile, program);
});
const results = await Promise.all(promises);
if (verbose) {
files.forEach((file, index) => {
(async () => {
const tsxFiles = await getFiles(path.join(workspaceRoot, 'docs/src/pages'));
const program = typescriptToProptypes.createProgram(tsxFiles, tsConfig);
let successful = 0;
let failed = 0;
let skipped = 0;
(await Promise.all(tsxFiles.map(file => transpileFile(file, program)))).forEach(result => {
switch (result) {
case TranspileResult.Success: {
successful += 1;
break;
}
case TranspileResult.Failed: {
failed += 1;
break;
}
case TranspileResult.Skipped: {
skipped += 1;