diff --git a/.github/workflows/deploy-win.yml b/.github/workflows/deploy-win.yml index 9ba10117c..b2b8532ad 100644 --- a/.github/workflows/deploy-win.yml +++ b/.github/workflows/deploy-win.yml @@ -21,10 +21,10 @@ jobs: with: fetch-depth: 0 ref: ${{ github.event.inputs.buildnumber }} - - name: Use Node.js 18.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x check-latest: true cache: npm - name: Build distribution @@ -44,10 +44,10 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Use Node.js 18.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x check-latest: true cache: npm - name: Download the built distribution diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 983a1d406..58ae092c2 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -11,10 +11,10 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Use Node.js 18.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x check-latest: true cache: npm - name: Install prerequisites @@ -40,10 +40,10 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Use Node.js 18.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x check-latest: true cache: npm - name: Build distribution @@ -64,10 +64,10 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Use Node.js 18.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x check-latest: true cache: npm - name: Download the built distribution diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index 31eba8cf1..7270975b8 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -15,10 +15,10 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Use Node.js 18.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x check-latest: true cache: npm - name: Install prerequisites diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b706c4bc..4e3744e24 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,8 +20,8 @@ in the right direction. ## Node version -**Compiler Explorer** currently targets [Node.js](https://nodejs.org/) LTS version 18 so it's better if you do so as -well when testing your changes locally. +**Compiler Explorer** currently targets [Node.js](https://nodejs.org/) version 20, so it's better if you do so as well +when testing your changes locally. ## In brief diff --git a/Makefile b/Makefile index bd59f38db..4c95f20dd 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ help: # with thanks to Ben Rady NODE:=node-not-found NPM:=npm-not-found NODE_MODULES:=./node_modules/.npm-updated +NODE_ARGS?= +TS_NODE_ARGS:=--no-warnings=ExperimentalWarning --loader ts-node/esm # These 'find' scripts cache their results in a dotfile. # Doing it this way instead of NODE:=$(shell etc/script/find-node) means @@ -86,15 +88,15 @@ run: ## Runs the site like it runs in production .PHONY: dev dev: prereqs ## Runs the site as a developer; including live reload support and installation of git hooks - NODE_OPTIONS=$(NODE_ARGS) ./node_modules/.bin/supervisor -w app.ts,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(shell pwd)/node_modules/.bin/ts-node-esm -- ./app.ts $(EXTRA_ARGS) + NODE_OPTIONS="$(TS_NODE_ARGS) $(NODE_ARGS)" ./node_modules/.bin/supervisor -w app.ts,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(NODE) -- ./app.ts $(EXTRA_ARGS) .PHONY: gpu-dev gpu-dev: prereqs ## Runs the site as a developer; including live reload support and installation of git hooks - NODE_OPTIONS=$(NODE_ARGS) ./node_modules/.bin/supervisor -w app.ts,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(shell pwd)/node_modules/.bin/ts-node-esm -- ./app.ts --env gpu $(EXTRA_ARGS) + NODE_OPTIONS="$(TS_NODE_ARGS) $(NODE_ARGS)" ./node_modules/.bin/supervisor -w app.ts,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(NODE) -- ./app.ts --env gpu $(EXTRA_ARGS) .PHONY: debug debug: prereqs ## Runs the site as a developer with full debugging; including live reload support and installation of git hooks - NODE_OPTIONS="$(NODE_ARGS) --inspect 9229" ./node_modules/.bin/supervisor -w app.ts,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(shell pwd)/node_modules/.bin/ts-node-esm -- ./app.ts --debug $(EXTRA_ARGS) + NODE_OPTIONS="$(TS_NODE_ARGS) $(NODE_ARGS) --inspect 9229" ./node_modules/.bin/supervisor -w app.ts,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(NODE) -- ./app.ts --debug $(EXTRA_ARGS) .PHONY: asm-docs: diff --git a/README.md b/README.md index 4a1d01444..ddd6769f6 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,8 @@ Assuming you have a compatible version of `node` installed, on Linux simply runn running with an Explorer running on port 10240 on your local machine: [http://localhost:10240/](http://localhost:10240/). If this doesn't work for you, please contact us, as we consider it important you can quickly and easily get running. Currently, **Compiler Explorer** requires -[`node` 18 _(LTS version)_](CONTRIBUTING.md#node-version) installed, either on the path or at `NODE_DIR` (an environment -variable or `make` parameter). +[`node` 20](CONTRIBUTING.md#node-version) installed, either on the path or at `NODE_DIR` (an environment variable or +`make` parameter). Running with `make EXTRA_ARGS='--language LANG'` will allow you to load `LANG` exclusively, where `LANG` is one for the language ids/aliases defined in `lib/languages.ts`. For example, to only run **Compiler Explorer** with C++ support, diff --git a/compiler-args-app.ts b/compiler-args-app.ts index 2b2066ef0..3f5044c38 100644 --- a/compiler-args-app.ts +++ b/compiler-args-app.ts @@ -149,7 +149,7 @@ class CompilerArgsApp { if (!opts.parser || !opts.exe) { console.error( 'Usage: ' + - 'ts-node-esm compiler-args-app.ts ' + + 'node --no-warnings=ExperimentalWarning --loader ts-node/esm compiler-args-app.ts ' + '--parser= --exe= [--padding=]\n' + 'for example: --parser=clang --exe=/opt/compiler-explorer/clang-15.0.0/bin/clang++ --padding=50', ); diff --git a/docs/AddingASiteTemplate.md b/docs/AddingASiteTemplate.md index cf5b0fd5b..64592a807 100644 --- a/docs/AddingASiteTemplate.md +++ b/docs/AddingASiteTemplate.md @@ -21,7 +21,7 @@ Site template screenshots are generated with a hacky script located at To run the script, `cd` to the `etc/scripts/` directory and run ```bash -npm i puppeteer --no-save && npx ts-node-esm generate_site_template_screenshots.ts +npm i puppeteer --no-save && npx node --no-warnings=ExperimentalWarning --loader ts-node/esm generate_site_template_screenshots.ts ``` The script uses puppeteer and chrome to generate screenshots. The script will take a little while to run as it generates diff --git a/etc/scripts/build-dist-win.ps1 b/etc/scripts/build-dist-win.ps1 index a84adab11..6d5b0b514 100644 --- a/etc/scripts/build-dist-win.ps1 +++ b/etc/scripts/build-dist-win.ps1 @@ -54,7 +54,7 @@ Add-Content -Path $env:GITHUB_OUTPUT -Value "branch=$BRANCH" Add-Content -Path $env:GITHUB_OUTPUT -Value "release_name=$RELEASE_NAME" # Run to make sure we haven't just made something that won't work -../../node_modules/.bin/ts-node-esm ./app.js --version --dist +node --no-warnings=ExperimentalWarning --loader ts-node/esm ./app.js --version --dist Remove-Item -Path "$ROOT/out/dist-bin" -Force -Recurse -ErrorAction Ignore New-Item -Path $ROOT -Name "out/dist-bin" -Force -ItemType "directory" diff --git a/etc/scripts/build-dist.sh b/etc/scripts/build-dist.sh index 3330df1f9..ac3c5b4a4 100755 --- a/etc/scripts/build-dist.sh +++ b/etc/scripts/build-dist.sh @@ -45,7 +45,7 @@ echo "branch=${GITHUB_REF#refs/heads/}" >> "${GITHUB_OUTPUT}" echo "release_name=${RELEASE_NAME}" >> "${GITHUB_OUTPUT}" # Run to make sure we haven't just made something that won't work -../../node_modules/.bin/ts-node-esm ./app.js --version --dist +node --no-warnings=ExperimentalWarning --loader ts-node/esm ./app.js --version --dist rm -rf "${ROOT}/out/dist-bin" mkdir -p "${ROOT}/out/dist-bin" diff --git a/etc/scripts/docenizers/docenizer-java.sh b/etc/scripts/docenizers/docenizer-java.sh index 2a0cc7c9b..0cb16fc93 100755 --- a/etc/scripts/docenizers/docenizer-java.sh +++ b/etc/scripts/docenizers/docenizer-java.sh @@ -4,4 +4,4 @@ JVMS_PATH=$(pwd)/vendor/jvms.html [ -f "$JVMS_PATH" ] || curl https://docs.oracle.com/javase/specs/jvms/se18/html/jvms-6.html -o "$JVMS_PATH" -npx ts-node-esm docenizer-java.ts > ../../../lib/asm-docs/generated/asm-docs-java.ts +npx node --no-warnings=ExperimentalWarning --loader ts-node/esm docenizer-java.ts > ../../../lib/asm-docs/generated/asm-docs-java.ts diff --git a/etc/scripts/docenizers/docenizer-llvm.sh b/etc/scripts/docenizers/docenizer-llvm.sh index 92dcc341d..aec89c6e8 100755 --- a/etc/scripts/docenizers/docenizer-llvm.sh +++ b/etc/scripts/docenizers/docenizer-llvm.sh @@ -4,4 +4,4 @@ LANGREF_PATH=$(pwd)/vendor/LangRef.html [ -f "$LANGREF_PATH" ] || curl https://llvm.org/docs/LangRef.html -o "$LANGREF_PATH" -npx ts-node-esm docenizer-llvm.ts > ../../../lib/asm-docs/generated/asm-docs-llvm.ts +npx node --no-warnings=ExperimentalWarning --loader ts-node/esm docenizer-llvm.ts > ../../../lib/asm-docs/generated/asm-docs-llvm.ts diff --git a/etc/scripts/find-node b/etc/scripts/find-node index 59d8bf169..190ad222c 100755 --- a/etc/scripts/find-node +++ b/etc/scripts/find-node @@ -24,8 +24,8 @@ find_node() { NODE="$(find_node)" -NODE_MIN_VERSION=16 -NODE_VERSION_USED=18 +NODE_MIN_VERSION=18 +NODE_VERSION_USED=20 NODE_VERSION=$(${NODE} --version) NODE_MAJOR_VERSION=$(echo "${NODE_VERSION}" | cut -f1 -d. | sed 's/^v//g') diff --git a/package.json b/package.json index 243cfb668..7633fcabc 100644 --- a/package.json +++ b/package.json @@ -175,14 +175,14 @@ "lint": "eslint --max-warnings=0 . --fix", "lint-check": "eslint --max-warnings=0 .", "lint-files": "eslint --max-warnings=0", - "test": "ts-node-esm ./node_modules/mocha/bin/mocha.js -b 'test/**/*.ts' 'test/**/*.js'", - "test-min": "ts-node-esm ./node_modules/mocha/bin/mocha.js -b --config .mocharc-min.yml", + "test": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./node_modules/mocha/bin/mocha.js -b 'test/**/*.ts' 'test/**/*.js'", + "test-min": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./node_modules/mocha/bin/mocha.js -b --config .mocharc-min.yml", "fix": "npm run lint && npm run format && npm run ts-check", "check": "npm run ts-check && npm run lint-check && npm run test-min -- --reporter min", - "dev": "cross-env NODE_ENV=DEV ts-node-esm app.ts", + "dev": "cross-env NODE_ENV=DEV node --no-warnings=ExperimentalWarning --loader ts-node/esm app.ts", "debugger": "cross-env NODE_ENV=DEV node --loader ts-node/esm --inspect-brk app.ts", - "debug": "cross-env NODE_ENV=DEV ts-node-esm app.ts --debug", - "start": "npm run webpack && cross-env NODE_ENV=LOCAL ts-node-esm app.ts", + "debug": "cross-env NODE_ENV=DEV node --no-warnings=ExperimentalWarning --loader ts-node/esm app.ts --debug", + "start": "npm run webpack && cross-env NODE_ENV=LOCAL node --no-warnings=ExperimentalWarning --loader ts-node/esm app.ts", "codecov": "codecov --disable=gcov", "sentry": "npx -p @sentry/cli sentry-cli", "update-browserslist": "npx browserslist@latest -- --update-db", @@ -191,7 +191,7 @@ "format-files": "prettier --write --ignore-unknown", "ts-compile": "tsc", "ts-check": "tsc -p ./tsconfig.backend.json --noEmit && tsc -p ./tsconfig.frontend.json --noEmit", - "webpack": "ts-node-esm ./node_modules/webpack-cli/bin/cli.js --node-env=production --config webpack.config.esm.ts" + "webpack": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./node_modules/webpack-cli/bin/cli.js --node-env=production --config webpack.config.esm.ts" }, "license": "BSD-2-Clause" }