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

@feature: remove config.dev, use env DEPLOY_PLATFORM #83

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 0 additions & 182 deletions docusaurus.config.dev.js

This file was deleted.

10 changes: 7 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const { curr_url_map } = require('./static/contants.js');
const href_pre = 'https://docs.tenxcloud.com';

console.log('curr_url_map', curr_url_map)

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Framework as a Building Block for Kubernetes',
tagline: '在 Kubernetes 上以搭积木的方式构建自己的服务门户',
favicon: 'img/favicon.png',

// Set the production url of your site here
url: 'http://kubebb.k8s.com.cn',
url: curr_url_map?.url || 'http://kubebb.k8s.com.cn',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
baseUrl: curr_url_map?.baseUrl || '/',

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
Expand Down Expand Up @@ -165,7 +168,8 @@ const config = {
title: '加入我们',
items: [
{
html: `<img width="120px" src="/img/home/qrcode.webp" />`
html: `<img width="120px" src="${!curr_url_map?.baseUrl || curr_url_map?.baseUrl === '/' ?
'' : curr_url_map?.baseUrl}/img/home/qrcode.webp" />`
}
]
},
Expand Down
31 changes: 30 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"build-dev": "docusaurus build --config docusaurus.config.dev.js",
"build-dev": "cross-env DEPLOY_PLATFORM=github docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
Expand All @@ -24,7 +24,8 @@
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.0"
"@docusaurus/module-type-aliases": "2.4.0",
"cross-env": "^7.0.3"
},
"browserslist": {
"production": [
Expand All @@ -41,4 +42,4 @@
"engines": {
"node": ">=16.14"
}
}
}
3 changes: 2 additions & 1 deletion src/pages/market/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Tdsf from '../../../static/img/market/tdsf.svg';
import Layout from '@theme/Layout';
import styles from './index.module.css';
import { useHistory } from '@docusaurus/router';
import { curr_url_map } from '../../../static/contants';

const href_pre = 'https://docs.tenxcloud.com';
const data = [
Expand Down Expand Up @@ -95,7 +96,7 @@ const data = [
icon: <Yunti />,
tag: 'official',
types: [ 'dev-tool' ],
to: '/docs/lowcode-development/intro',
to: (curr_url_map?.baseUrl === '/' || !curr_url_map.baseUrl ? '' : curr_url_map.baseUrl) + '/docs/lowcode-development/intro',
new: true,
bottoms: [
{
Expand Down
18 changes: 18 additions & 0 deletions static/contants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const urlMaps = {
github: {
url: 'https://kubebb.github.io',
baseUrl: '/website',
},
cn: {
url: 'http://kubebb.k8s.com.cn',
baseUrl: '/',
},
test: {
url: 'http://kubebb.k8s.com.cn',
baseUrl: '/test',
},
};

exports.urlMaps = urlMaps;

exports.curr_url_map = urlMaps[process.env.DEPLOY_PLATFORM || 'cn']
Loading