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

Set Node to v20 #6055

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 50 additions & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,37 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './web/.node-version'
- name: Cache Cypress binary
id: cache-cypress
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('./web/pnpm-lock.yaml') }}
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
with:
path: web/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('./web/pnpm-lock.yaml') }}
- name: Install web dependencies
if: steps.cache-web.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
working-directory: ./web
- name: Install Cypress binary
if: steps.cache-cypress.outputs.cache-hit != 'true'
run: pnpm exec cypress install
working-directory: ./web
- name: Cypress run component tests
uses: cypress-io/github-action@v6
env:
TZ: Europe/Copenhagen
with:
working-directory: ./web
install: true
install: false
# to run component tests we need to use "component: true"
component: true
- name: Upload screenshots
Expand All @@ -38,12 +62,37 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './web/.node-version'
- name: Cache Cypress binary
id: cache-cypress
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('./web/pnpm-lock.yaml') }}
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
with:
path: web/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('./web/pnpm-lock.yaml') }}
- name: Install web dependencies
if: steps.cache-web.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
working-directory: ./web
- name: Install Cypress binary
if: steps.cache-cypress.outputs.cache-hit != 'true'
run: pnpm exec cypress install
working-directory: ./web
- name: Cypress run e2e tests
uses: cypress-io/github-action@v6
env:
TZ: Europe/Copenhagen
with:
working-directory: ./web
install: false
build: pnpm run build --mode testing
start: pnpm run preview
config: baseUrl=http://127.0.0.1:4173/
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-preview-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jsonlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node LTS
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Install jsonlint-mod
run: |
npm install -g jsonlint-mod
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate_generate_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules for web
id: cache-web
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate_generated_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node v18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: './web/.node-version'
- name: Restore node_modules
id: cache
uses: actions/cache@v3
Expand Down
1 change: 1 addition & 0 deletions mockserver/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
1 change: 1 addition & 0 deletions web/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
6 changes: 3 additions & 3 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"build": "pnpm update-version && vite build",
"update-version": "echo '{\"version\": \"'$npm_package_version'\"}' > public/client-version.json",
"create-generated-files": "pnpm run generate-world && pnpm run generate-zones-config",
"generate-world": "ts-node --esm ./geo/generateWorld.ts",
"generate-zones-config": "ts-node --esm ./scripts/generateZonesConfig.ts",
"generate-world": "node --import=./scripts/register-tsNodeESM.js ./geo/generateWorld.ts",
"generate-zones-config": "node --import=./scripts/register-tsNodeESM.js ./scripts/generateZonesConfig.ts",
"predev": "pnpm run create-generated-files",
"dev": "vite --open",
"cy:component": "cypress open --component -b electron",
Expand Down Expand Up @@ -195,7 +195,7 @@
"workbox-window": "7.0.0"
},
"engines": {
"node": ">=18",
"node": "^20",
"pnpm": "^8"
}
}
8 changes: 8 additions & 0 deletions web/scripts/register-tsNodeESM.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This script is meant to be used with 'node --import=register-tsNodeESM.js', and allows
* node v20 to use ts-node to execute Typescript files that contain ESM modules, without
* outputting JS files.
*/
import { register } from 'node:module';
import { pathToFileURL } from 'node:url';
register('ts-node/esm', pathToFileURL('./'));