From b11c7157d3ba3158edc3f76efc8844e6c6051d99 Mon Sep 17 00:00:00 2001 From: Felipe Lalanne <1822826+pipex@users.noreply.github.com> Date: Tue, 3 Jan 2023 13:02:35 -0300 Subject: [PATCH] Update to node 14 --- .github/actions/publish/action.yml | 3 +-- .github/actions/test/action.yml | 3 +-- INSTALL-ADVANCED.md | 10 +++++----- lib/utils/ssh.ts | 11 ++++++----- npm-shrinkwrap.json | 14 +++++++++++--- package.json | 4 ++-- tests/commands/ssh.spec.ts | 2 +- tests/nock/proxy-server.ts | 4 ++-- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml index 16cc0a4e..74275530 100644 --- a/.github/actions/publish/action.yml +++ b/.github/actions/publish/action.yml @@ -15,8 +15,7 @@ inputs: default: "accounts+apple@balena.io" NODE_VERSION: type: string - # FIXME: (please) https://github.com/balena-io/balena-cli/issues/2165 - default: "12.x" + default: "14.x" VERBOSE: type: string default: "true" diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 54ac3524..222e2eae 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -12,8 +12,7 @@ inputs: # --- custom environment NODE_VERSION: type: string - # FIXME: (please) https://github.com/balena-io/balena-cli/issues/2165 - default: "12.x" + default: "14.x" VERBOSE: type: string default: "true" diff --git a/INSTALL-ADVANCED.md b/INSTALL-ADVANCED.md index 28c2ef98..966f6759 100644 --- a/INSTALL-ADVANCED.md +++ b/INSTALL-ADVANCED.md @@ -78,8 +78,8 @@ If you are a Node.js developer, you may wish to install the balena CLI via [npm] The npm installation involves building native (platform-specific) binary modules, which require some development tools to be installed first, as follows. -> **The balena CLI currently requires Node.js version 12 (min 12.8.0).** -> **Versions 13 and later are not yet fully supported.** +> **The balena CLI currently requires Node.js version 14.** +> **Versions 15 and later are not yet fully supported.** ### Install development tools @@ -89,7 +89,7 @@ some development tools to be installed first, as follows. $ sudo apt-get update && sudo apt-get -y install curl python3 git make g++ $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash $ . ~/.bashrc -$ nvm install 12 +$ nvm install 14 ``` The `curl` command line above uses @@ -106,14 +106,14 @@ recommended. ```sh $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash $ . ~/.bashrc -$ nvm install 12 +$ nvm install 14 ``` #### **Windows** (not WSL) Install: -* Node.js v12 from the [Nodejs.org releases page](https://nodejs.org/en/download/releases/). +* Node.js v14 from the [Nodejs.org releases page](https://nodejs.org/en/download/releases/). * If you'd like the ability to switch between Node.js versions, install [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) instead. diff --git a/lib/utils/ssh.ts b/lib/utils/ssh.ts index 837086c1..47c89cc4 100644 --- a/lib/utils/ssh.ts +++ b/lib/utils/ssh.ts @@ -151,11 +151,12 @@ export async function runRemoteCommand({ let exitCode: number | undefined; let exitSignal: NodeJS.Signals | undefined; try { - [exitCode, exitSignal] = await new Promise<[number, NodeJS.Signals]>( - (resolve, reject) => { - const ps = spawn(program, args, { stdio }) - .on('error', reject) - .on('close', (code, signal) => resolve([code, signal])); + [exitCode, exitSignal] = await new Promise((resolve, reject) => { + const ps = spawn(program, args, { stdio }) + .on('error', reject) + .on('close', (code, signal) => + resolve([code ?? undefined, signal ?? undefined]), + ); if (ps.stdin && stdin && typeof stdin !== 'string') { stdin.pipe(ps.stdin); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 4c013452..9ae96485 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1421,6 +1421,14 @@ "tslint-no-unused-expression-chai": "^0.1.4", "typescript": "^4.2.4", "yargs": "^16.2.0" + }, + "dependencies": { + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + } } }, "@balena/node-beaglebone-usbboot": { @@ -2888,9 +2896,9 @@ } }, "@types/node": { - "version": "12.20.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.42.tgz", - "integrity": "sha512-aI3/oo5DzyiI5R/xAhxxRzfZlWlsbbqdgxfTPkqu/Zt+23GXiJvMCyPJT4+xKSXOnLqoL8jJYMLTwvK2M3a5hw==" + "version": "14.18.36", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz", + "integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==" }, "@types/node-cleanup": { "version": "2.1.2", diff --git a/package.json b/package.json index 2ff9fc8e..66ea4508 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "author": "Balena Inc. (https://balena.io/)", "license": "Apache-2.0", "engines": { - "node": ">=12 <16" + "node": ">=14 <16" }, "husky": { "hooks": { @@ -145,7 +145,7 @@ "@types/ndjson": "^2.0.1", "@types/net-keepalive": "^0.4.1", "@types/nock": "^11.1.0", - "@types/node": "^12.20.42", + "@types/node": "^14.18.36", "@types/node-cleanup": "^2.1.2", "@types/parse-link-header": "^1.0.1", "@types/prettyjson": "^0.0.30", diff --git a/tests/commands/ssh.spec.ts b/tests/commands/ssh.spec.ts index 56b66326..d591ab2c 100644 --- a/tests/commands/ssh.spec.ts +++ b/tests/commands/ssh.spec.ts @@ -178,7 +178,7 @@ async function startMockSshServer(): Promise<[Server, number]> { }); return await new Promise<[Server, number]>((resolve, reject) => { - // TODO: remove 'as any' below. According to @types/node v12.20.42, the + // TODO: remove 'as any' below. According to @types/node v14.18.36, the // callback type is `() => void`, but our code assumes `(err: Error) => void` const listener = (server.listen as any)(0, '127.0.0.1', (err: Error) => { // this callback is called for the 'listening' event diff --git a/tests/nock/proxy-server.ts b/tests/nock/proxy-server.ts index e713eb31..09b2f085 100644 --- a/tests/nock/proxy-server.ts +++ b/tests/nock/proxy-server.ts @@ -113,7 +113,7 @@ async function createProxyServer(): Promise<[number, number]> { let proxyPort = 0; // TCP port number, 0 means automatic allocation await new Promise((resolve, reject) => { - // TODO: remove 'as any' below. According to @types/node v12.20.42, the + // TODO: remove 'as any' below. According to @types/node v14.18.36, the // callback type is `() => void`, but our code assumes `(err: Error) => void` const listener = (server.listen as any)(0, '127.0.0.1', (err: Error) => { if (err) { @@ -197,7 +197,7 @@ async function createInterceptorServer(): Promise { let interceptorPort = 0; await new Promise((resolve, reject) => { - // TODO: remove 'as any' below. According to @types/node v12.20.42, the + // TODO: remove 'as any' below. According to @types/node v14.18.36, the // callback type is `() => void`, but our code assumes `(err: Error) => void` const listener = (server.listen as any)(0, '127.0.0.1', (err: Error) => { if (err) {