Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
story.unshift(createHeader(packageName, componentName, imports));
return fs.writeFile(storyPath, story.join(''), 'utf8').then(() => fs.remove(filePath));
});
}
const cwd = process.argv[2];
if (!cwd) {
console.error(chalk.red('Please provide a folder path to convert.'));
process.exit(1);
}
glob
.async('**/components/*/README.md', {
absolute: true,
cwd: path.join(process.cwd(), cwd),
ignore: ['node_modules'],
})
.then(filePaths => Promise.all(filePaths.map(filePath => convertToStory(String(filePath)))));
export const schemaReadDir = async (schemaPath: string) => {
const files = await fg.async(resolve(schemaPath, '**/*.{yml,yaml,json}'));
if (files.length === 0) {
throw new Error(
`Schema directory '${schemaPath}' does not contain any schema file`,
);
}
return Promise.all(files.map(async file => schemaReadFile(file.toString())));
};
module.exports = async ({ include = '', exclude: ignore = [] } = {}) => {
const files = await fastGlob(include, { ignore });
return parseTs(files);
};
TemplateWriter.prototype._getAllPaths = async function() {
debug("Searching for: %o", this.templateGlobsWithIgnores);
if (!this.cachedPaths) {
this.cachedPaths = TemplatePath.addLeadingDotSlashArray(
await fastglob.async(this.templateGlobsWithIgnores)
);
}
return this.cachedPaths;
};