Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function processMdxAsync(algoliaIndex: any, file: File, indexName: string): Promise {
const content = await read(file.path);
await remark()
.use(slug) // slugify heading text as ids
.use(mdx)
.use(() => async (tree: Node[]) => {
await processContentTreeAsync(tree, file, algoliaIndex, indexName);
})
.process(content);
}
async function processMdxAsync(indexName: string, file: File): Promise {
const content = await read(file.path);
await remark()
.use(slug) // slugify heading text as ids
.use(mdx)
.use(() => (tree: Node[]) => processContentTree(tree, file, indexName))
.process(content);
}
const readFile = filename =>
vfile.read(filename).catch(() => reject('SUMMARY.md not found', __filename))
export const readVFile = filename =>
vfile.read(filename).catch(() => reject(`Error reading ${filename}`))
const convertDoczToKitchenSink = async () => {
const path = './src/components/KitchenSink/KitchenSink.tsx';
const mdxFilePaths = await getMdxFiles();
let content = '';
const imports = [];
for (const mdxFilePath of mdxFilePaths) {
const file = await read(mdxFilePath);
const result = await remark()
.use(collectImports(imports))
.use(mdx)
.use(removeUnused)
.use(transformHeadings)
.process(file);
content += result.contents + '\n';
}
const data = combine(content, imports);
fs.writeFileSync(path, data, { encoding: 'utf-8' });
};
allowPrerelease,
mergePrerelease,
ghrelease,
git,
verbose,
stdout
}) {
const { report, success, info, warn, error } = createLogger({ scope: 'release', verbose, stdout });
const version = semver.valid(userVersion);
try {
if (!version) {
throw new Error('Version release is not valid.');
}
const file = await toVFile.read(resolve(path, 'CHANGELOG.md'));
let gitParsed = null;
if (git) {
gitParsed = await gitUrlParse({ url: gitUrl }).catch(() => null);
}
if (git && !gitTemplate) {
if (gitParsed) {
gitTemplate = gitParsed.template;
gitBranch = gitBranch || gitParsed.branch;
} else {
file.message(`Missing url to compare releases.`);
}
}