Skip to content

Commit

Permalink
attempt at migrating to node 20 (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan authored Dec 16, 2023
1 parent e63fe9e commit 0cc2614
Show file tree
Hide file tree
Showing 16 changed files with 349 additions and 325 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# see https://github.com/microsoft/vscode-dev-containers/tree/main/containers
ARG VARIANT="16"
ARG VARIANT="20"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

ENV PATH="/opt/emsdk/upstream/emscripten:${PATH}"
Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"name": "Node.js + C++",
"build": {
"dockerfile": "Dockerfile",
// Node v16
"args": { "VARIANT": "16" }
"args": { "VARIANT": "20" }
},
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
key: ${{env.EM_VERSION}}-${{ runner.os }}
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "20"
cache: yarn
registry-url: 'https://registry.npmjs.org'
- uses: mymindstorm/setup-emsdk@v12
Expand All @@ -41,7 +41,7 @@ jobs:
# setup node again, in case emsdk messed it up
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "20"
cache: yarn
registry-url: 'https://registry.npmjs.org'
- run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "20"
cache: yarn
- run: yarn install --frozen-lockfile
- name: Build tools
Expand Down
20 changes: 10 additions & 10 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@
"directory": "cli"
},
"engines": {
"node": ">=16"
"node": ">=20"
},
"license": "MIT",
"devDependencies": {
"@devicescript/dap": "*",
"@devicescript/compiler": "*",
"@devicescript/interop": "*",
"@devicescript/vm": "*",
"@types/debounce-promise": "^3.1.6",
"@types/fs-extra": "^11.0.1",
"@types/node": "^16",
"@types/update-notifier": "^6.0.2",
"commander": "^10.0.0",
"@types/debounce-promise": "^3.1.9",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20",
"@types/update-notifier": "^6.0.8",
"commander": "^11.1.0",
"debounce-promise": "^3.1.2",
"jacdac-ts": "*",
"fast-glob": "^3.2.12",
"fast-glob": "^3.3.2",
"faye-websocket": "^0.11.4",
"fs-extra": "^11.1.0"
"fs-extra": "^11.2.0"
},
"dependencies": {
"update-notifier": "^6.0.2"
"update-notifier": "^7.0.0"
},
"optionalDependencies": {
"serialport": "^10.5.0"
"serialport": "^12.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion cli/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ to the VS Code extension

const optionalFiles: FileSet = {
".devcontainer/devcontainer.json": {
image: "mcr.microsoft.com/devcontainers/javascript-node:18",
image: "mcr.microsoft.com/devcontainers/javascript-node:20",
features: {
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
Expand Down
2 changes: 1 addition & 1 deletion cli/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig-base.json",
"compilerOptions": {
"module": "node16",
"module": "NodeNext",
"declarationDir": "../built/types",
"outDir": "../built",
"types": ["node"]
Expand Down
8 changes: 4 additions & 4 deletions compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"./built/**"
],
"engines": {
"node": ">=16"
"node": ">=20"
},
"license": "MIT",
"devDependencies": {
"@devicescript/interop": "*",
"@types/fs-extra": "^11.0.1",
"@types/node": "^16",
"esbuild": "^0.17.11",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20",
"esbuild": "^0.19.9",
"jacdac-ts": "*",
"typescript": "^4.9.5"
},
Expand Down
4 changes: 2 additions & 2 deletions dap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
},
"license": "MIT",
"devDependencies": {
"@types/node": "^16",
"@types/node": "^20",
"async-mutex": "^0.4.0",
"@devicescript/compiler": "*",
"@devicescript/vm": "*",
"@vscode/debugadapter": "^1.58.0",
"@vscode/debugadapter": "^1.64.0",
"jacdac-ts": "*"
},
"dependencies": {},
Expand Down
4 changes: 2 additions & 2 deletions interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
],
"license": "MIT",
"devDependencies": {
"esbuild": "^0.14.11",
"typescript": "^4.5.4"
"esbuild": "^0.19.9",
"typescript": "^4.9.5"
},
"dependencies": {
"json5": "^2.2.3"
Expand Down
2 changes: 1 addition & 1 deletion interop/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const MIN_NODE_VERSION = 16
export const MIN_NODE_VERSION = 20
export const MARKETPLACE_EXTENSION_ID = "devicescript.devicescript-vscode"
2 changes: 1 addition & 1 deletion interop/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const errors: Record<string, string> = {
"can't connect, no HF2 nor JDUSB": "no-hf2",
"esptool cannot connect": "esptool-cannot-connect",
"I2C device not found or malfunctioning": "i2c-device-not-found-or-malfunctioning",
"Unable to locate Node.JS v16+.": "terminal-nodemissing",
"Unable to locate Node.JS.": "terminal-nodemissing",
"Install @devicescript/cli package": "terminal-notinstalled",
"missing \"devicescript\" section": "missing-devicescript-section",
"No DeviceScript device found.": "no-devicescript-device-found",
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@
],
"devDependencies": {
"auto-changelog": "^2.4.0",
"esbuild": "^0.17.11",
"semver": "^7.3.8",
"zx": "^7.2.1"
},
"dependencies": {
"prettier": "^3.0.3"
"esbuild": "^0.19.9",
"semver": "^7.5.4",
"zx": "^7.2.3",
"prettier": "^3.1.1"
}
}
4 changes: 2 additions & 2 deletions vscode/src/devtoolsserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,11 @@ export class DeveloperToolsManager extends JDEventSource {
if (!v) {
showErrorWithHelp(
"terminal.nodemissing",
"Unable to locate Node.JS v16+."
"Unable to locate Node.JS."
)
return undefined
}
if (!(v.major >= 16)) {
if (!(v.major >= MIN_NODE_VERSION)) {
showErrorMessage(
"terminal.nodeversion",
`Node.JS version outdated, found ${v.major}.${v.minor} but needed v16+.`
Expand Down
2 changes: 1 addition & 1 deletion website/docs/developer/errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ are due to invalid configurations, aside from hardware issues with the sensor.
- The I2C address is incorrect. Check the datasheet for the correct address.
- The I2C address is correct, but the sensor is not responding. Check the wiring and the sensor datasheet.

## Unable to locate Node.JS v16+. {#terminal-nodemissing}
## Unable to locate Node.JS. {#terminal-nodemissing}

The Visual Studio Code extension was unable to determine the version of Node.JS.
This may mean that Node.JS is not installed or not in the path,
Expand Down
Loading

0 comments on commit 0cc2614

Please sign in to comment.