Skip to content

Commit 0abc0fb

Browse files
authored
feat(cli-repl): upgrade Node.js to v14.x MONGOSH-438 (#452)
1 parent 439685f commit 0abc0fb

File tree

12 files changed

+202
-41
lines changed

12 files changed

+202
-41
lines changed

.evergreen.yml

Lines changed: 175 additions & 28 deletions
Large diffs are not rendered by default.

.evergreen/.install_node

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
set -e
2-
export NODE_JS_VERSION='12.18.4'
32
export NVM_DIR="$HOME/.nvm"
43

54
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

.evergreen/.setup_env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
set -e
2-
export NODE_JS_VERSION='12.18.4'
32
export NVM_DIR="$HOME/.nvm"
43
echo "Setting NVM environment home: $NVM_DIR"
54
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

.evergreen/InstallNode.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$version = "12.18.4"
1+
$version = "$Env:NODE_JS_VERSION"
22
$url = "https://nodejs.org/download/release/v$version/node-v$version-win-x64.zip"
33
$filename = "node.zip"
44
$node_zip = "$PSScriptRoot\$filename"

.evergreen/SetupEnv.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
$version = "12.18.4"
1+
$version = "$Env:NODE_JS_VERSION"
22
$Env:PATH = "$PSScriptRoot\node-v$version-win-x64;C:\Python39\Scripts;C:\Python39;C:\Program Files\Git\mingw32\libexec\git-core;$Env:PATH"
3-
$Env:NODE_JS_VERSION = "$version"
43

54
echo "Using node version:"
65
node --version

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@ MongoDB welcomes community contributions! If you’re interested in making a con
1818
You can report new bugs by
1919
[creating a new issue](https://jira.mongodb.org/browse/MONGOSH/).
2020
Please include as much information as possible about your environment.
21+
22+
## Node.js versions
23+
24+
We support Node.js 12.x+ for the individual packages, and Node.js 14.x only for
25+
the CLI repl specifically. These versions are mentioned:
26+
27+
- In the individual packages’ package.json files
28+
- In the evergreen config
29+
- In the homebrew generation script
30+
- In the Docker files we use for building the binary/testing vscode

packages/cli-repl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"access": "public"
3333
},
3434
"engines": {
35-
"node": ">=12.4.0"
35+
"node": ">=14.15.0"
3636
},
3737
"dependencies": {
3838
"@mongosh/autocomplete": "^0.5.2",

packages/cli-repl/src/cli-repl.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ describe('CliRepl', () => {
108108
});
109109

110110
it('verifies the Node.js version', async() => {
111+
const origVersionCheckEnvVar = process.env.MONGOSH_SKIP_NODE_VERSION_CHECK;
112+
delete process.env.MONGOSH_SKIP_NODE_VERSION_CHECK;
111113
delete (process as any).version;
112114
process.version = 'v8.0.0';
115+
113116
try {
114117
cliRepl = new CliRepl(cliReplOptions);
115118
const onerror = once(cliRepl.bus, 'mongosh:error');
@@ -119,6 +122,7 @@ describe('CliRepl', () => {
119122
await onerror;
120123
} finally {
121124
process.version = process.versions.node;
125+
process.env.MONGOSH_SKIP_NODE_VERSION_CHECK = origVersionCheckEnvVar || '';
122126
}
123127
});
124128
});

packages/cli-repl/src/cli-repl.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ class CliRepl {
142142
}
143143

144144
verifyNodeVersion(): void {
145+
if (process.env.MONGOSH_SKIP_NODE_VERSION_CHECK) {
146+
return;
147+
}
145148
const { engines } = require('../package.json');
146149
// Strip -rc.0, -pre, etc. from the Node.js version because semver rejects those otherwise.
147150
const baseNodeVersion = process.version.replace(/-.*$/, '');

packages/mongosh/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@
3434
"access": "public"
3535
},
3636
"engines": {
37-
"node": ">=12.4.0"
37+
"node": ">=14.15.0"
3838
}
3939
}

0 commit comments

Comments
 (0)