Skip to content

Commit

Permalink
docs: refactor baseUrl logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TitanKuzmich committed Nov 29, 2024
1 parent c69987e commit 8ee6ebf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
15 changes: 8 additions & 7 deletions website/plasma-b2c-docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ const pckgJson = require('./package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const versionsArchived = require('./versionsArchived.json');

const { PR_NAME, VERSION_NAME } = process.env;
const prefix = VERSION_NAME || !PR_NAME ? '' : `/pr/${PR_NAME}`;
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : `${prefix}/b2c/`;
const { VERSION_NAME, PREFIX, PR_NAME } = process.env;
const prPrefix = VERSION_NAME || !PR_NAME ? '' : `/pr/${PR_NAME}`;
const defaultUrl = PREFIX ? `/${PREFIX}/b2c/` : '/b2c/';
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : defaultUrl;

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
Expand All @@ -39,12 +40,12 @@ module.exports = {
},
items: [
{
href: `https://plasma.sberdevices.ru${prefix}/ui/`,
href: `https://plasma.sberdevices.ru${prPrefix}/ui/`,
position: 'left',
label: 'UI',
},
{
href: `https://plasma.sberdevices.ru${prefix}/web/`,
href: `https://plasma.sberdevices.ru${prPrefix}/web/`,
position: 'left',
label: 'WEB',
},
Expand Down Expand Up @@ -80,11 +81,11 @@ module.exports = {
items: [
{
label: 'Plasma UI',
to: `https://plasma.sberdevices.ru${prefix}/ui/`,
to: `https://plasma.sberdevices.ru${prPrefix}/ui/`,
},
{
label: 'Plasma WEB',
to: `https://plasma.sberdevices.ru${prefix}/web/`,
to: `https://plasma.sberdevices.ru${prPrefix}/web/`,
},
{
label: 'Plasma B2C',
Expand Down
11 changes: 6 additions & 5 deletions website/plasma-web-docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ const pckgJson = require('./package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const versionsArchived = require('./versionsArchived.json');

const { PR_NAME, VERSION_NAME } = process.env;
const prefix = VERSION_NAME || !PR_NAME ? '' : `/pr/${PR_NAME}`;
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : `${prefix}/web/`;
const { VERSION_NAME, PREFIX, PR_NAME } = process.env;
const prPrefix = VERSION_NAME || !PR_NAME ? '' : `/pr/${PR_NAME}`;
const defaultUrl = PREFIX ? `/${PREFIX}/web/` : '/web/';
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : defaultUrl;

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
Expand All @@ -39,7 +40,7 @@ module.exports = {
},
items: [
{
href: `https://plasma.sberdevices.ru${prefix}/ui/`,
href: `https://plasma.sberdevices.ru${prPrefix}/ui/`,
position: 'left',
label: 'UI',
},
Expand Down Expand Up @@ -75,7 +76,7 @@ module.exports = {
items: [
{
label: 'Plasma UI',
to: `https://plasma.sberdevices.ru${prefix}/ui/`,
to: `https://plasma.sberdevices.ru${prPrefix}/ui/`,
},
{
label: 'Plasma Web',
Expand Down
6 changes: 3 additions & 3 deletions website/sdds-cs-docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const pckgJson = require('./package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const versionsArchived = require('./versionsArchived.json');

const { PR_NAME, VERSION_NAME } = process.env;
const prefix = VERSION_NAME || !PR_NAME ? '' : `/pr/${PR_NAME}`;
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : `${prefix}/sdds-cs/`;
const { VERSION_NAME, PREFIX } = process.env;
const defaultUrl = PREFIX ? `/${PREFIX}/sdds-cs/` : '/sdds-cs/';
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : defaultUrl;

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions website/sdds-insol-docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const pckgJson = require('./package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const versionsArchived = require('./versionsArchived.json');

const { PR_NAME, VERSION_NAME } = process.env;
const prefix = VERSION_NAME || !PR_NAME ? '' : `/pr/${PR_NAME}`;
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : `${prefix}/sdds-insol/`;
const { VERSION_NAME, PREFIX } = process.env;
const defaultUrl = PREFIX ? `/${PREFIX}/sdds-insol/` : '/sdds-insol/';
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : defaultUrl;

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions website/sdds-serv-docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const pckgJson = require('./package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const versionsArchived = require('./versionsArchived.json');

const { PR_NAME, VERSION_NAME } = process.env;
const prefix = VERSION_NAME || !PR_NAME ? '' : `/pr/${PR_NAME}`;
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : `${prefix}/sdds-serv/`;
const { VERSION_NAME, PREFIX } = process.env;
const defaultUrl = PREFIX ? `/${PREFIX}/sdds-serv/` : '/sdds-serv/';
const baseUrl = VERSION_NAME ? `/versions/${VERSION_NAME}/` : defaultUrl;

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
Expand Down

0 comments on commit 8ee6ebf

Please sign in to comment.