Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await Promise.all(highlightFiles.map(async (relativeSource) => {
const source = path_1.default.join(highlightDir, relativeSource);
const aliasedSource = utils_1.aliasedSitePath(source, siteDir);
const fileString = await fs_extra_1.default.readFile(source, 'utf-8');
const readingStats = reading_time_1.default(fileString);
const { frontMatter, content, excerpt } = utils_1.parse(fileString);
const fileName = path_1.default.basename(relativeSource);
const fileNameMatch = fileName.match(FILENAME_PATTERN);
if (frontMatter.draft && process.env.NODE_ENV === 'production') {
return;
}
let date = fileNameMatch ? new Date(fileNameMatch[1]) : new Date(Date.now());
let description = frontMatter.description || excerpt;
let id = frontMatter.id || frontMatter.title;
let linkName = relativeSource.replace(/\.mdx?$/, '');
let tags = frontMatter.tags || [];
let title = frontMatter.title || linkName;
highlights.push({
id: id,
metadata: {
date: date,
description: description,
highlightFiles.map(async (relativeSource: string) => {
const source = path.join(highlightDir, relativeSource);
const aliasedSource = aliasedSitePath(source, siteDir);
const fileString = await fs.readFile(source, 'utf-8');
const readingStats = readingTime(fileString);
const {frontMatter, content, excerpt} = parse(fileString);
const fileName = path.basename(relativeSource);
const fileNameMatch = fileName.match(FILENAME_PATTERN);
if (frontMatter.draft && process.env.NODE_ENV === 'production') {
return;
}
let date = fileNameMatch ? new Date(fileNameMatch[1]) : new Date(Date.now());
let description = frontMatter.description || excerpt;
let id = frontMatter.id || frontMatter.title;
let linkName = relativeSource.replace(/\.mdx?$/, '');
let tags = frontMatter.tags || [];
let title = frontMatter.title || linkName;
highlights.push({
id: id,