From 435aa6c861d661194de9342f8d46d147dedca48c Mon Sep 17 00:00:00 2001 From: ochafik Date: Sun, 22 Dec 2024 22:17:28 +0000 Subject: [PATCH] ci: simplify env vars --- .github/workflows/test.yml | 4 ++-- jest-puppeteer.config.js | 6 ++---- package.json | 6 +++--- tests/e2e.test.js | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4185bfc..bd5ae1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,5 +33,5 @@ jobs: name: dist-node-${{ matrix.node.name }} path: dist retention-days: 30 - - run: START_MODE=dev npm run test:e2e - - run: START_MODE=prod npm run test:e2e + - run: NODE_ENV=development npm run test:e2e + - run: NODE_ENV=production npm run test:e2e diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index ae5963d..2b52db1 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -1,12 +1,10 @@ -const isProd = process.env.START_MODE === 'prod'; - module.exports = { launch: { headless: process.env.CI === "true", }, server: { - command: `npm run start:${isProd ? 'prod' : 'dev'}`, - port: isProd ? 3000 : 4000, + command: `npm run start:${process.env.NODE_ENV}`, + port: process.env.NODE_ENV === 'production' ? 3000 : 4000, launchTimeout: 180000, }, }; diff --git a/package.json b/package.json index a8a150c..3833376 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,9 @@ }, "scripts": { "test:e2e": "jest", - "start:dev": "concurrently 'npx webpack serve --mode=development' 'NODE_ENV=development npx rollup --config openscad-worker.rollup.config.js --watch'", - "start:prod": "PUBLIC_URL=http://localhost:3000/dist/ npm run build && npx serve", - "start": "npm run start:dev", + "start:development": "concurrently 'npx webpack serve --mode=development' 'NODE_ENV=development npx rollup --config openscad-worker.rollup.config.js --watch'", + "start:production": "NODE_ENV=production PUBLIC_URL=http://localhost:3000/dist/ npm run build && npx serve", + "start": "npm run start:development", "build": "NODE_ENV=production npx rollup --config openscad-worker.rollup.config.js && webpack --mode=production" }, "eslintConfig": { diff --git a/tests/e2e.test.js b/tests/e2e.test.js index 5963610..f51f092 100644 --- a/tests/e2e.test.js +++ b/tests/e2e.test.js @@ -1,6 +1,6 @@ const longTimeout = 60000; -const isProd = process.env.START_MODE === 'prod'; +const isProd = process.env.NODE_ENV === 'production'; const url = isProd ? 'http://localhost:3000/dist/' : 'http://localhost:4000'; describe('e2e', () => {