Skip to content

Commit ade3413

Browse files
committed
ci: set bundler through environment variable
1 parent 88022a8 commit ade3413

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.github/workflows/check.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,13 @@ jobs:
5555
- name: Test
5656
run: yarn test
5757

58-
- name: Docs build
58+
- name: Build docs with webpack
5959
run: yarn docs:build
60+
env:
61+
DOCS_BUNDLER: '@vuepress/webpack'
62+
63+
# TODO: vite will statically replace global defined constants even in markdown files
64+
# - name: Build docs with vite
65+
# run: yarn docs:build
66+
# env:
67+
# DOCS_BUNDLER: '@vuepress/vite'

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
env:
14-
GA_ID: G-CTB8FQ7VMW
14+
DOCS_GA_ID: G-CTB8FQ7VMW
1515
NODE_VERSION: '14'
1616

1717
steps:

docs/.vuepress/config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ export default defineUserConfig<DefaultThemeOptions>({
6565
},
6666
},
6767

68-
// use vite in dev, use webpack in prod
69-
bundler: isProd ? '@vuepress/webpack' : '@vuepress/vite',
68+
bundler:
69+
// specify bundler via environment variable
70+
process.env.DOCS_BUNDLER ??
71+
// use vite in dev, use webpack in prod
72+
(isProd ? '@vuepress/webpack' : '@vuepress/vite'),
7073

7174
themeConfig: {
7275
logo: '/images/hero.png',
@@ -157,7 +160,8 @@ export default defineUserConfig<DefaultThemeOptions>({
157160
[
158161
'@vuepress/plugin-google-analytics',
159162
{
160-
id: process.env.GA_ID,
163+
// we have multiple deployments, which would use different id
164+
id: process.env.DOCS_GA_ID,
161165
},
162166
],
163167
['@vuepress/plugin-pwa'],

0 commit comments

Comments
 (0)