diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index afd596c27..b54d47803 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -10,10 +10,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Use Node.js 12.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 14.x - name: Get npm cache directory id: npm-cache run: | @@ -42,10 +42,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Use Node.js 12.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 14.x - name: TEST run: | which npx diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index dc4480ca3..b408d4915 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -10,10 +10,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Use Node.js 12.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 14.x - name: Get npm cache directory id: npm-cache run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ac920b3d..d7cc286d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,10 +20,10 @@ If there is something you would like to do yourself, it might help to make an is ## Node version -**Compiler Explorer** currently targets [Node.js](https://nodejs.org/) LTS version 12.18, +**Compiler Explorer** currently targets [Node.js](https://nodejs.org/) LTS version 14.18.0, so it's better if you do so as well when testing your changes locally. -Nonetheless, it _should_ run in everything post-Node.js 12.18. [Contact us] if +Nonetheless, it _should_ run in everything post-Node.js 14.18. [Contact us] if this is not the case for you. ## In brief diff --git a/README.md b/README.md index 65c4c9b40..407d2c2e1 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Assuming you have a compatible version of `node` installed, on Linux simply runn 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 [at least `node` 12 _(LTS version)_](CONTRIBUTING.md#node-version) installed, either on the path or at `NODE_DIR` + requires [at least `node` 14 _(LTS version)_](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 diff --git a/etc/scripts/find-node b/etc/scripts/find-node index d987be570..91d04cc16 100755 --- a/etc/scripts/find-node +++ b/etc/scripts/find-node @@ -4,43 +4,43 @@ set -e OUT="$1" find_node() { - local NODE="${NODE_DIR}/bin/node" - local CE_NODE="/opt/compiler-explorer/node/bin/node" - local SYS_NODE="$(which node 2>/dev/null)" - local SYS_NODEJS="$(which nodejs 2>/dev/null)" + NODE="${NODE_DIR}/bin/node" + CE_NODE="/opt/compiler-explorer/node/bin/node" + SYS_NODE="$(which node 2>/dev/null || true)" + SYS_NODEJS="$(which nodejs 2>/dev/null || true)" - if test -x "${NODE}" -a -n "${NODE_DIR}"; then - echo "${NODE}" - elif test -x "${CE_NODE}"; then - echo "${CE_NODE}" - elif test -x "${SYS_NODE}"; then - echo "${SYS_NODE}" - elif test -x "${SYS_NODEJS}"; then - echo "${SYS_NODEJS}" - else - >&2 echo "Unable to find a node" - fi + if test -x "${NODE}" -a -n "${NODE_DIR}"; then + echo "${NODE}" + elif test -x "${CE_NODE}"; then + echo "${CE_NODE}" + elif test -x "${SYS_NODE}"; then + echo "${SYS_NODE}" + elif test -x "${SYS_NODEJS}"; then + echo "${SYS_NODEJS}" + else + echo >&2 "Unable to find a node" + fi } -NODE=$(find_node) +NODE="$(find_node)" -NODE_MIN_VERSION=12 -NODE_VERSION_USED=12 +NODE_MIN_VERSION=14 +NODE_VERSION_USED=14 NODE_VERSION=$(${NODE} --version) -NODE_MAJOR_VERSION=$(echo ${NODE_VERSION} | cut -f1 -d. | sed 's/^v//g') +NODE_MAJOR_VERSION=$(echo "${NODE_VERSION}" | cut -f1 -d. | sed 's/^v//g') -if test ${NODE_MAJOR_VERSION} -lt ${NODE_MIN_VERSION}; then - >&2 echo Compiler Explorer is known not to run with versions prior to v${NODE_MIN_VERSION} - >&2 echo Visit https://nodejs.org/ for installation instructions for newer versions - >&2 echo To configure where we look for node, set NODE_DIR to its installation base - exit 1 +if test "${NODE_MAJOR_VERSION}" -lt ${NODE_MIN_VERSION}; then + echo >&2 "Compiler Explorer is known not to run with versions prior to v${NODE_MIN_VERSION}" + echo >&2 "Visit https://nodejs.org/ for installation instructions for newer versions" + echo >&2 "To configure where we look for node, set NODE_DIR to its installation base" + exit 1 fi -if test ${NODE_VERSION_USED} -ne ${NODE_MAJOR_VERSION}; then - >&2 echo Warning: Compiler Explorer is only tested against v${NODE_VERSION_USED}.x, but v${NODE_MAJOR_VERSION} was found. - >&2 echo Note that you might find issues if you decide to keep this version - >&2 echo Visit https://nodejs.org/ for installation instructions for the required version - >&2 echo To configure where we look for node, set NODE_DIR to its installation base +if test ${NODE_VERSION_USED} -ne "${NODE_MAJOR_VERSION}"; then + echo >&2 "Warning: Compiler Explorer is only tested against v${NODE_VERSION_USED}.x, but v${NODE_MAJOR_VERSION} was found." + echo >&2 "Note that you might find issues if you decide to keep this version" + echo >&2 "Visit https://nodejs.org/ for installation instructions for the required version" + echo >&2 "To configure where we look for node, set NODE_DIR to its installation base" fi -echo ${NODE} > ${OUT} +echo "${NODE}" >"${OUT}" diff --git a/package-lock.json b/package-lock.json index 15acbb23a..cf021f75f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3685,8 +3685,7 @@ }, "color-string": { "version": "1.5.3", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", - "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "resolved": "", "requires": { "color-name": "^1.0.0", "simple-swizzle": "^0.2.2" diff --git a/package.json b/package.json index 5e8ce45a8..4782e1f4c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "version": "0.0.3", "engines": { - "node": ">=12.18" + "node": ">=14.18" }, "main": "./app.js", "esm": true,