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 #84

Closed
wants to merge 2 commits 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.

8 changes: 5 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

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';

/** @type {import('@docusaurus/types').Config} */
Expand All @@ -12,10 +13,10 @@ const config = {
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 +166,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"
}
}
}
9 changes: 7 additions & 2 deletions 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 All @@ -18,7 +19,7 @@ const data = [
desc: '提供 API 的完整生命周期管理,以及丰富的插件能力',
icon: <Api />,
tag: 'official',
types: [ 'msa' ],
types: [ 'apigateway' ],
to: href_pre + '/docs/TAMP/产品介绍',
new: true,
bottoms: [
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 Expand Up @@ -130,6 +131,10 @@ const func_types = [
name: '服务治理',
value: 'msa',
},
{
name: 'API 网关',
value: 'apigateway',
},
{
name: '数据库',
value: 'database',
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