Skip to content

Commit

Permalink
Merge pull request #88 from Vsion/master2
Browse files Browse the repository at this point in the history
@feature: remove config.dev, use env DEPLOY_PLATFORM
  • Loading branch information
bjwswang authored Nov 6, 2023
2 parents aeb48fd + dc962d7 commit fa89765
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 191 deletions.
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
30 changes: 29 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']

0 comments on commit fa89765

Please sign in to comment.