From f95583c20416c3c3ec6aef3e1aebe1f6c2c87381 Mon Sep 17 00:00:00 2001 From: Jonathan Romano Date: Mon, 22 Jul 2024 18:14:53 -0400 Subject: [PATCH] Build type variable --- .github/workflows/ci.yml | 11 +++++------ src/store/index.ts | 2 +- webpack.config.common.js | 3 +++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53454c7..7710c9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ permissions: {} env: API_DOMAIN: eternagame.org NODE_VERSION: 18.x + BUILD_TYPE: prod jobs: build-eternajs: @@ -41,7 +42,7 @@ jobs: run: npm ci working-directory: ./eternajs - name: Build - run: npm run build + run: npm run build:${{ env.BUILD_TYPE }} working-directory: ./eternajs env: APP_SERVER_URL: https://${{ env.API_DOMAIN }} @@ -52,7 +53,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: eternajs - path: ./eternajs/dist/prod + path: ./eternajs/dist/${{ env.BUILD_TYPE }} build-wrapper: runs-on: ubuntu-latest @@ -74,9 +75,8 @@ jobs: - name: Install dependencies run: npm ci --ignore-scripts - name: build - run: npm run build:prod + run: npm run build:${{ env.BUILD_TYPE }} env: - NODE_ENV: prod PARALLEL_BUILD: true APP_SERVER_URL: https://${{ env.API_DOMAIN }} INJECT_COOKIE_DOMAIN: .${{ env.API_DOMAIN }} @@ -122,7 +122,6 @@ jobs: - name: Install dependencies run: npm ci --ignore-scripts - name: Build - run: npx cordova build ${{ matrix.target }} --release --device + run: npx cordova build ${{ matrix.target }} --${{ env.BUILD_TYPE == 'prod' && 'release' || 'debug' }} --device env: - NODE_ENV: prod PARALLEL_BUILD: true diff --git a/src/store/index.ts b/src/store/index.ts index b1c0227..89331d9 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -220,7 +220,7 @@ const MAX_LEVEL = 8; export default function createStore(http: AxiosInstance) { return new Vuex.Store({ - strict: process.env.NODE_ENV !== 'production', + strict: process.env.NODE_ENV !== 'prod', state: { isLoadingCount: 0, loggedIn: false, diff --git a/webpack.config.common.js b/webpack.config.common.js index 240cb81..e5166f0 100644 --- a/webpack.config.common.js +++ b/webpack.config.common.js @@ -65,6 +65,9 @@ module.exports = function(mode, eternajs_copy) { ...(process.env.PARALLEL_BUILD ? [] : [{ context: eternajs_copy, from: '**/*', to: 'eternajs/'}]), { from: 'src/assets/favicon.ico', to: 'favicon.ico'}, ]}), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(mode) + }) ], }; };