Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure config #1175

Merged
merged 13 commits into from
Sep 25, 2023
320 changes: 11 additions & 309 deletions contentPlugins.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const { generatePluginConfig } = require('./src/utils/pluginConfigGenerators');
const {
buildPluginsConfig,
maintainPluginsConfig,
} = require('./versionedConfig');

const path = require('path');

module.exports = async () => {
Expand All @@ -12,226 +18,7 @@ module.exports = async () => {
),
routeBasePath: 'build',
},
{
id: 'iota-sdk-1-0',
path: path.resolve(__dirname, 'docs/build/iota-sdk/1.0/docs'),
routeBasePath: 'iota-sdk',
sidebarPath: require.resolve('./docs/build/iota-sdk/1.0/sidebars.js'),
//overriding default exclude array to include the python api's classes with _ at the beginning
//but still exclude any _admonitions
exclude: [
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
'**/_admonitions/_**',
],
},
{
id: 'wasp-cli-0-7',
path: path.resolve(__dirname, 'docs/build/wasp-cli/0.7/docs'),
routeBasePath: 'wasp-cli',
sidebarPath: path.resolve(
__dirname,
'docs/build/wasp-cli/0.7/sidebars.js',
),
},
{
id: 'wasp-evm-0-7',
path: path.resolve(__dirname, 'docs/build/wasp-evm/0.7/docs'),
routeBasePath: 'wasp-evm',
sidebarPath: path.resolve(
__dirname,
'docs/build/wasp-evm/0.7/sidebars.js',
),
},
{
id: 'wasp-wasm-0-7',
path: path.resolve(__dirname, 'docs/build/wasp-wasm/0.7/docs'),
routeBasePath: 'wasp-wasm',
sidebarPath: path.resolve(
__dirname,
'docs/build/wasp-wasm/0.7/sidebars.js',
),
},
{
id: 'identity-rs-0-5',
path: path.resolve(__dirname, 'docs/build/identity.rs/0.5/docs'),
routeBasePath: 'identity.rs',
bannerPath: path.resolve(__dirname, 'banners/identity-deprecated.mdx'),
sidebarPath: path.resolve(
__dirname,
'docs/build/identity.rs/0.5/sidebars.js',
),
versions: {
current: {
label: '0.5',
path: '0.5',
badge: true,
},
},
},
{
id: 'identity-rs-0-6',
path: path.resolve(__dirname, 'docs/build/identity.rs/0.6/docs'),
routeBasePath: 'identity.rs',
bannerPath: path.resolve(
__dirname,
'banners/identity-stronghold-migration.mdx',
),
sidebarPath: path.resolve(
__dirname,
'docs/build/identity.rs/0.6/sidebars.js',
),
versions: {
current: {
label: '0.6',
badge: true,
},
},
},
{
id: 'identity-rs-0-7-alpha',
path: path.resolve(__dirname, 'docs/build/identity.rs/0.7-alpha/docs'),
routeBasePath: 'identity.rs',
sidebarPath: path.resolve(
__dirname,
'docs/build/identity.rs/0.7-alpha/sidebars.js',
),
versions: {
current: {
label: '0.7',
path: '0.7',
badge: true,
},
},
},
{
id: 'identity-rs-next',
path: path.resolve(__dirname, 'docs/build/identity.rs/next/docs'),
routeBasePath: 'identity.rs',
sidebarPath: path.resolve(
__dirname,
'docs/build/identity.rs/next/sidebars.js',
),
versions: {
current: {
label: 'next',
path: 'next',
badge: true,
},
},
},
{
id: 'iota-rs-1-4',
path: path.resolve(__dirname, 'docs/build/iota.rs/1.4/docs'),
routeBasePath: 'iota.rs',
sidebarPath: path.resolve(
__dirname,
'docs/build/iota.rs/1.4/sidebars.js',
),
versions: {
current: {
label: '1.4',
badge: true,
},
},
},
{
id: 'iota-rs-2-0-rc-7',
path: path.resolve(__dirname, 'docs/build/iota.rs/2.0-rc.7/docs'),
routeBasePath: 'iota.rs',
bannerPath: path.resolve(
__dirname,
'banners/pre-sdk-libs-deprecated.mdx',
),
sidebarPath: path.resolve(
__dirname,
'docs/build/iota.rs/2.0-rc.7/sidebars.js',
),
versions: {
current: {
label: '2.0-rc.7',
path: '2.0-rc.7',
badge: true,
},
},
},
{
id: 'iotajs',
path: path.resolve(__dirname, 'docs/build/iota.js/2.0-rc.1/docs'),
routeBasePath: 'iota.js',
bannerPath: path.resolve(
__dirname,
'banners/pre-sdk-libs-deprecated.mdx',
),
sidebarPath: path.resolve(
__dirname,
'docs/build/iota.js/2.0-rc.1/sidebars.js',
),
},
{
id: 'wallet-rs-0-1',
path: path.resolve(__dirname, 'docs/build/wallet.rs/0.1/docs'),
routeBasePath: 'wallet.rs',
sidebarPath: path.resolve(
__dirname,
'docs/build/wallet.rs/0.1/sidebars.js',
),
versions: {
current: {
label: '0.1',
badge: true,
},
},
},
{
id: 'wallet-rs-1-0-rc-6',
path: path.resolve(__dirname, 'docs/build/wallet.rs/1.0-rc.6/docs'),
routeBasePath: 'wallet.rs',
bannerPath: path.resolve(
__dirname,
'banners/pre-sdk-libs-deprecated.mdx',
),
sidebarPath: path.resolve(
__dirname,
'docs/build/wallet.rs/1.0-rc.6/sidebars.js',
),
versions: {
current: {
label: '1.0-rc.6',
path: '1.0-rc.6',
badge: true,
},
},
},
{
id: 'stronghold-rs',
path: path.resolve(__dirname, 'docs/build/stronghold.rs/1.1/docs'),
routeBasePath: 'stronghold.rs',
sidebarPath: path.resolve(
__dirname,
'docs/build/stronghold.rs/1.1/sidebars.js',
),
},
{
id: 'apis',
path: path.resolve(__dirname, 'docs/build/apis/docs'),
routeBasePath: 'apis',
sidebarPath: path.resolve(__dirname, 'docs/build/apis/sidebars.js'),
docItemComponent: '@theme/ApiItem',
},
{
id: 'iota-streams',
path: path.resolve(__dirname, 'docs/build/streams/0.2/docs'),
routeBasePath: 'streams',
bannerPath: path.resolve(
__dirname,
'banners/iota-streams-deprecated.mdx',
),
sidebarPath: path.resolve(
__dirname,
'docs/build/streams/0.2/sidebars.js',
),
},
...generatePluginConfig(buildPluginsConfig, __dirname + '/docs/build/'),
{
id: 'introduction-docs-chrysalis',
path: path.resolve(
Expand Down Expand Up @@ -269,15 +56,6 @@ module.exports = async () => {
},
},
},
{
id: 'cli-wallet',
path: path.resolve(__dirname, 'docs/build/cli-wallet/1.0/docs'),
routeBasePath: 'cli-wallet',
sidebarPath: path.resolve(
__dirname,
'docs/build/cli-wallet/1.0/sidebars.js',
),
},
{
id: 'iota-zebra-tutorials',
path: path.resolve(__dirname, 'docs/build/zebra-iota-edge-sdk/tutorials'),
Expand All @@ -290,6 +68,10 @@ module.exports = async () => {
];

const maintainPlugins = [
...generatePluginConfig(
maintainPluginsConfig,
__dirname + '/docs/maintain/',
),
{
id: 'maintain',
globalSidebars: ['maintain'],
Expand All @@ -300,86 +82,6 @@ module.exports = async () => {
),
routeBasePath: 'maintain',
},
{
id: 'hornet-1-2',
path: path.resolve(__dirname, 'docs/maintain/hornet/1.2/docs'),
routeBasePath: 'hornet',
sidebarPath: path.resolve(
__dirname,
'docs/maintain/hornet/1.2/sidebars.js',
),
versions: {
current: {
label: '1.2',
badge: true,
},
},
},
{
id: 'hornet-2-0-rc-6',
path: path.resolve(__dirname, 'docs/maintain/hornet/2.0-rc.6/docs'),
routeBasePath: 'hornet',
sidebarPath: path.resolve(
__dirname,
'docs/maintain/hornet/2.0-rc.6/sidebars.js',
),
versions: {
current: {
label: '2.0-rc.6',
path: '2.0-rc.6',
badge: true,
},
},
},
{
id: 'wasp-0-7',
path: path.resolve(__dirname, 'docs/maintain/wasp/0.7/docs'),
routeBasePath: 'wasp',
sidebarPath: path.resolve(
__dirname,
'docs/maintain/wasp/0.7/sidebars.js',
),
},
{
id: 'chronicle-rs',
path: path.resolve(__dirname, 'docs/maintain/chronicle/0.3/docs'),
routeBasePath: 'chronicle',
sidebarPath: path.resolve(
__dirname,
'docs/maintain/chronicle/0.3/sidebars.js',
),
versions: {
current: {
label: '0.3',
badge: true,
},
},
},
{
id: 'inx-chronicle',
path: path.resolve(__dirname, 'docs/maintain/chronicle/1.0-rc.1/docs'),
routeBasePath: 'chronicle',
sidebarPath: path.resolve(
__dirname,
'docs/maintain/chronicle/1.0-rc.1/sidebars.js',
),
versions: {
current: {
label: '1.0-rc.1',
path: '1.0-rc.1',
badge: true,
},
},
},
{
id: 'goshimmer',
path: path.resolve(__dirname, 'docs/maintain/goshimmer/0.9/docs'),
routeBasePath: 'goshimmer',
sidebarPath: path.resolve(
__dirname,
'docs/maintain/goshimmer/0.9/sidebars.js',
),
},
];

return [
Expand Down
10 changes: 4 additions & 6 deletions src/common/components/Switcher/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,23 @@ export type Item = {
icon?: string;
};

export type Version = Item;
export type Version = Omit<Item, 'id'> & {
id?: string;
};
export type Doc = Item & {
subsection: string;
versions: Version[];
defaultVersion?: string;
};

export type Subsection = Item & {
defaultDoc?: string;
};

export type Sidebar = {
docId: string;
sidebarId: string;
};

export type Section = {
before?: Sidebar;
subsections: Subsection[];
subsections: Item[];
after?: Sidebar;
};

Expand Down
Loading