mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 07:49:43 +02:00
Fix usage of sidebars.json for versioning
This commit is contained in:
parent
a56812cda3
commit
8c70286ad0
2 changed files with 3 additions and 3 deletions
|
@ -92,7 +92,7 @@ files.forEach(file => {
|
||||||
// copy sidebar if necessary
|
// copy sidebar if necessary
|
||||||
if (versionFallback.diffLatestSidebar()) {
|
if (versionFallback.diffLatestSidebar()) {
|
||||||
mkdirp(CWD + "/versioned_sidebars");
|
mkdirp(CWD + "/versioned_sidebars");
|
||||||
const sidebar = JSON.parse(fs.readFileSync(CWD + "/sidebar.json", "utf8"));
|
const sidebar = JSON.parse(fs.readFileSync(CWD + "/sidebars.json", "utf8"));
|
||||||
const versioned = {};
|
const versioned = {};
|
||||||
|
|
||||||
Object.keys(sidebar).forEach(sb => {
|
Object.keys(sidebar).forEach(sb => {
|
||||||
|
@ -111,7 +111,7 @@ if (versionFallback.diffLatestSidebar()) {
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
CWD + "/versioned_sidebars/version-" + version + "-sidebar.json",
|
CWD + "/versioned_sidebars/version-" + version + "-sidebars.json",
|
||||||
JSON.stringify(versioned, null, 2),
|
JSON.stringify(versioned, null, 2),
|
||||||
"utf8"
|
"utf8"
|
||||||
);
|
);
|
||||||
|
|
|
@ -76,7 +76,7 @@ function execute() {
|
||||||
|
|
||||||
files = glob.sync(CWD + "/versioned_sidebars/*");
|
files = glob.sync(CWD + "/versioned_sidebars/*");
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
if (!file.endsWith("-sidebar.json")) {
|
if (!file.endsWith("-sidebars.json")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sidebarContent = JSON.parse(fs.readFileSync(file, "utf8"));
|
sidebarContent = JSON.parse(fs.readFileSync(file, "utf8"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue