Skip to content

Commit

Permalink
Restructure sidebar gen
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Electron committed Mar 25, 2024
1 parent a1d955b commit 2a9d460
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 79 deletions.
10 changes: 1 addition & 9 deletions docs/build/iota-sdk/1.0/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
Create as many sidebars as you want.
*/

const fs = require('fs');

function directoryExists(path) {
try {
return fs.statSync(path).isDirectory();
} catch (err) {
return false;
}
}
const { directoryExists } = require('../../../../src/utils/config');

var python_references = {};
if (directoryExists(__dirname + '/docs/references/python')) {
Expand Down
60 changes: 0 additions & 60 deletions docs/build/isc/v1.0.0-rc.6/docs/reference/magic-contract.md

This file was deleted.

27 changes: 17 additions & 10 deletions docs/build/isc/v1.0.0-rc.6/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
Create as many sidebars as you want.
*/

const { directoryExists } = require('../../../../src/utils/config');

var iscutils_references = {};
if (directoryExists(__dirname + '/docs/reference/iscutils')) {
iscutils_references = {
type: 'category',
label: 'ISC Utilities',
items: [
{
type: 'autogenerated',
dirName: 'reference/iscutils',
},
],
};
}

module.exports = {
// By default, Docusaurus generates a sidebar from the docs folder structure
//tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
Expand Down Expand Up @@ -276,16 +292,7 @@ module.exports = {
},
],
},
{
type: 'category',
label: 'ISC Utilities',
items: [
{
type: 'autogenerated',
dirName: 'reference/iscutils',
},
],
},
iscutils_references,
{
type: 'doc',
label: 'WasmLib Data Types',
Expand Down
10 changes: 10 additions & 0 deletions src/utils/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const defaultSettings = require('../common/defaultContentPlugin');
const fs = require('fs');

/**
* Merges multiple configuration objects into one object.
Expand Down Expand Up @@ -137,9 +138,18 @@ async function create_doc_plugin({ ...options }) {
];
}

function directoryExists(path) {
try {
return fs.statSync(path).isDirectory();
} catch (err) {
return false;
}
}

module.exports = {
glob,
merge,
create_doc_plugin,
globStatic,
directoryExists,
};

0 comments on commit 2a9d460

Please sign in to comment.