Skip to content

Commit 20903fc

Browse files
committed
Don't touch /docs for now
1 parent 5c7b06d commit 20903fc

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

site/scripts/migrate-branches-to-versions.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,13 @@ async function migrate() {
585585
const mainDocsOutput = path.join(tempMainDir, 'converted-docs');
586586
convertGitBookToDocusaurus(mainDocsInput, mainDocsOutput, mainDocsInput, mainDocsOutput);
587587

588-
// Replace root /docs with converted version
589-
console.log('Replacing root /docs with converted Docusaurus format...');
590-
fs.rmSync(DOCS_DIR, { recursive: true, force: true });
591-
copyDirectory(mainDocsOutput, DOCS_DIR);
588+
// Write converted docs to /docs-tmp instead of replacing /docs
589+
// TODO: For final migration, change this to replace /docs directly
590+
const DOCS_TMP_DIR = path.join(REPO_ROOT, 'docs-tmp');
591+
console.log('Writing converted Docusaurus format to /docs-tmp...');
592+
console.log('(For final migration, this will replace /docs directly)');
593+
fs.rmSync(DOCS_TMP_DIR, { recursive: true, force: true });
594+
copyDirectory(mainDocsOutput, DOCS_TMP_DIR);
592595

593596
// Restore IMAGES_PATH
594597
if (originalImagesPath) {
@@ -597,7 +600,7 @@ async function migrate() {
597600
delete process.env.IMAGES_PATH;
598601
}
599602

600-
console.log('✓ Main branch /docs converted to Docusaurus format (in-place)');
603+
console.log('✓ Main branch /docs converted to Docusaurus format and written to /docs-tmp');
601604
}
602605

603606
// Clean up temp directory
@@ -610,10 +613,12 @@ async function migrate() {
610613
console.log(` - ${VERSIONED_DOCS_DIR}`);
611614
console.log(` - ${VERSIONED_SIDEBARS_DIR}`);
612615
console.log(` - ${VERSIONS_FILE}`);
613-
console.log('2. Docs replacement will happen after branch switch');
614-
console.log('3. Test the site with: npm run start');
615-
console.log('4. Adjust sidebar configurations as needed');
616-
console.log('5. Update image references if necessary');
616+
console.log(' - /docs-tmp (converted main branch docs)');
617+
console.log('2. Test the site with: npm run start');
618+
console.log('3. Adjust sidebar configurations as needed');
619+
console.log('4. Update image references if necessary');
620+
console.log('\nNote: Main branch docs written to /docs-tmp to avoid Git conflicts');
621+
console.log(' For final migration, these will replace /docs directly');
617622

618623
} catch (error) {
619624
console.error('\n❌ Migration failed:', error.message);

0 commit comments

Comments
 (0)