Skip to content
Open
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
21 changes: 11 additions & 10 deletions packages/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,11 +910,6 @@ export default toolchain;
console.log(` Created ./versions (${Object.keys(versions).length} tools)`);
}

/**
* Copy the docs source tree into docs/, preserving relative paths.
* Generated VitePress output and installed dependencies are excluded so the package
* only ships authoring sources and referenced assets.
*/
async function copyBundledDocs() {
console.log('\nCopying bundled docs...');

Expand All @@ -926,17 +921,23 @@ async function copyBundledDocs() {
return;
}

const skipPrefixes = ['node_modules', '.vitepress/cache', '.vitepress/dist'];
await rm(docsTargetDir, { recursive: true, force: true });
// Preserve the website layout while publishing only authored Markdown.
const bundledDocsEntries = new Set(['config', 'guide', 'index.md', 'team.md']);
await cp(docsSourceDir, docsTargetDir, {
recursive: true,
filter: (src) => {
const rel = relative(docsSourceDir, src).replaceAll('\\', '/');
return !skipPrefixes.some((prefix) => rel === prefix || rel.startsWith(`${prefix}/`));
filter: (source) => {
const relativePath = relative(docsSourceDir, source).replaceAll('\\', '/');
const [entry] = relativePath.split('/');
return (
relativePath === '' ||
(bundledDocsEntries.has(entry) &&
(statSync(source).isDirectory() || source.endsWith('.md')))
);
},
});

console.log(' Copied docs to docs/ (with paths preserved)');
console.log(' Copied Markdown docs to docs/');
}

async function syncReadmeFromRoot() {
Expand Down
Loading