Skip to content

Commit

Permalink
Update Gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
ImmaZoni committed Aug 16, 2023
1 parent 2af3a8b commit 436243f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Production
/build

/i18n
# Generated files
.docusaurus
.cache-loader
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"crowdin": "crowdin",
"copy-all-versions": "node copy-all-versions.js",
"version-update": "node .github/scripts/version-update",
"write-translations": "docusaurus write-translations",
"write-all-translations": "node write-all-translations.js",
Expand Down
38 changes: 38 additions & 0 deletions reorganize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const fs = require('fs');
const path = require('path');
const { locales } = require('./docusaurus.config').i18n;

const moveContents = (source, destination) => {
const items = fs.readdirSync(source);

items.forEach((item) => {
const sourceItem = path.join(source, item);
const destinationItem = path.join(destination, item);

// If destination item exists, remove it
if (fs.existsSync(destinationItem)) {
if (fs.lstatSync(destinationItem).isDirectory()) {
fs.rmdirSync(destinationItem, { recursive: true });
} else {
fs.unlinkSync(destinationItem);
}
}

// Move the source item to the destination
if (fs.lstatSync(sourceItem).isDirectory()) {
fs.renameSync(sourceItem, destinationItem);
} else {
fs.copyFileSync(sourceItem, destinationItem);
}
});

// Remove the now-empty source directory
fs.rmdirSync(source, { recursive: true });
};

locales.forEach((locale) => {
const basePath = `i18n/${locale}/docusaurus-plugin-content-docs`;

moveContents(`${basePath}/current/docs`, `${basePath}/current`);
moveContents(`${basePath}/versioned_docs`, basePath);
});

0 comments on commit 436243f

Please sign in to comment.