Skip to content

Commit bdc358b

Browse files
authored
Merge pull request #5 from samizdata-co/fix/allow-empty-blog-locale
Make dist checks handle absent Romanian blog source
2 parents 93404e3 + 8b27428 commit bdc358b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎scripts/check-dist.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ for (const surface of ['surface', 'surface-low', 'surface-container', 'surface-h
298298
// Every content file defines a locale route and appears on that locale's blog index.
299299
for (const locale of ['en', 'ro']) {
300300
const sourceDir = join(root, 'src/content/blog', locale);
301-
const posts = (await walk(sourceDir)).filter((path) => /\.(?:md|mdx)$/.test(path));
301+
const posts = existsSync(sourceDir) ? (await walk(sourceDir)).filter((path) => /\.(?:md|mdx)$/.test(path)) : [];
302302
const blogIndex = await read(locale === 'en' ? 'dist/blog/index.html' : 'dist/ro/blog/index.html');
303303
for (const post of posts) {
304304
const slug = relative(sourceDir, post).split(sep).join('/').replace(/\.(?:md|mdx)$/, '');
@@ -340,7 +340,7 @@ if (!homeHtml.includes('<details class="mobile-nav"')) fail('mobile navigation m
340340
if (homeHtml.includes('data-sheet-backdrop')) fail('closed mobile navigation must not leave an off-screen focusable sheet');
341341
for (const locale of ['en', 'ro']) {
342342
const sourceDir = join(root, 'src/content/blog', locale);
343-
const posts = (await walk(sourceDir)).filter((path) => /\.(?:md|mdx)$/.test(path));
343+
const posts = existsSync(sourceDir) ? (await walk(sourceDir)).filter((path) => /\.(?:md|mdx)$/.test(path)) : [];
344344
const pathname = locale === 'en' ? 'dist/index.html' : 'dist/ro/index.html';
345345
const html = await read(pathname);
346346
const blogHref = locale === 'en' ? '/blog/' : '/ro/blog/';

0 commit comments

Comments
 (0)