Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions docs/scripts/scaffold.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,9 @@ for (const [relPath, title, description] of PAGES) {
// etc.) it gets renamed `.md` -> `.mdx`. We shouldn't recreate
// a plain-Markdown stub alongside it on the next scaffold run.
const mdxVariant = full.replace(/\.md$/, '.mdx');
if (fs.existsSync(full) || fs.existsSync(mdxVariant)) {
// Skip when a hand-authored .mdx variant exists. This is a different path
// than the write target, so it is a plain logic skip, not a race.
if (fs.existsSync(mdxVariant)) {
skipped++;
continue;
}
Expand All @@ -853,8 +855,18 @@ description: ${JSON.stringify(description)}
---

${stubBody(title, description)}`;
fs.writeFileSync(full, content, 'utf-8');
created++;
// 'wx' fails atomically with EEXIST if `full` already exists, so there is no
// check-then-write TOCTOU window (CodeQL js/file-system-race).
try {
fs.writeFileSync(full, content, { encoding: 'utf-8', flag: 'wx' });
created++;
} catch (err) {
if (err.code === 'EEXIST') {
skipped++;
continue;
}
throw err;
}
}

console.log(`scaffold: ${created} stubs created, ${skipped} existing pages skipped (${PAGES.length} total in IA)`);
87 changes: 46 additions & 41 deletions examples/chat/frontend-next/bun.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/chat/frontend-next/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions examples/chat/frontend-svelte/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions examples/chat/frontend-svelte/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion examples/chat/frontend-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/kit": "^2.69.3",
"@sveltejs/kit": "^2.70.3",
"@sveltejs/vite-plugin-svelte": "^7.2.0",
"svelte": "^5.56.5",
"svelte-check": "^4.7.3",
Expand All @@ -20,5 +20,8 @@
},
"dependencies": {
"ts-pattern": "^5.9.0"
},
"overrides": {
"cookie": "^0.7.0"
}
}
Loading