Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 175 additions & 28 deletions .evergreen.yml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion .evergreen/.install_node
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set -e
export NODE_JS_VERSION='12.18.4'
export NVM_DIR="$HOME/.nvm"

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Expand Down
1 change: 0 additions & 1 deletion .evergreen/.setup_env
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set -e
export NODE_JS_VERSION='12.18.4'
export NVM_DIR="$HOME/.nvm"
echo "Setting NVM environment home: $NVM_DIR"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/InstallNode.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$version = "12.18.4"
$version = "$Env:NODE_JS_VERSION"
$url = "https://nodejs.org/download/release/v$version/node-v$version-win-x64.zip"
$filename = "node.zip"
$node_zip = "$PSScriptRoot\$filename"
Expand Down
3 changes: 1 addition & 2 deletions .evergreen/SetupEnv.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$version = "12.18.4"
$version = "$Env:NODE_JS_VERSION"
$Env:PATH = "$PSScriptRoot\node-v$version-win-x64;C:\Python39\Scripts;C:\Python39;C:\Program Files\Git\mingw32\libexec\git-core;$Env:PATH"
$Env:NODE_JS_VERSION = "$version"

echo "Using node version:"
node --version
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ MongoDB welcomes community contributions! If you’re interested in making a con
You can report new bugs by
[creating a new issue](https://jira.mongodb.org/browse/MONGOSH/).
Please include as much information as possible about your environment.

## Node.js versions

We support Node.js 12.x+ for the individual packages, and Node.js 14.x only for
the CLI repl specifically. These versions are mentioned:

- In the individual packages’ package.json files
- In the evergreen config
- In the homebrew generation script
- In the Docker files we use for building the binary/testing vscode
2 changes: 1 addition & 1 deletion packages/cli-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"access": "public"
},
"engines": {
"node": ">=12.4.0"
"node": ">=14.15.0"
},
"dependencies": {
"@mongosh/autocomplete": "^0.5.2",
Expand Down
4 changes: 4 additions & 0 deletions packages/cli-repl/src/cli-repl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ describe('CliRepl', () => {
});

it('verifies the Node.js version', async() => {
const origVersionCheckEnvVar = process.env.MONGOSH_SKIP_NODE_VERSION_CHECK;
delete process.env.MONGOSH_SKIP_NODE_VERSION_CHECK;
delete (process as any).version;
process.version = 'v8.0.0';

try {
cliRepl = new CliRepl(cliReplOptions);
const onerror = once(cliRepl.bus, 'mongosh:error');
Expand All @@ -119,6 +122,7 @@ describe('CliRepl', () => {
await onerror;
} finally {
process.version = process.versions.node;
process.env.MONGOSH_SKIP_NODE_VERSION_CHECK = origVersionCheckEnvVar || '';
}
});
});
Expand Down
3 changes: 3 additions & 0 deletions packages/cli-repl/src/cli-repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class CliRepl {
}

verifyNodeVersion(): void {
if (process.env.MONGOSH_SKIP_NODE_VERSION_CHECK) {
return;
}
const { engines } = require('../package.json');
// Strip -rc.0, -pre, etc. from the Node.js version because semver rejects those otherwise.
const baseNodeVersion = process.version.replace(/-.*$/, '');
Expand Down
2 changes: 1 addition & 1 deletion packages/mongosh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"access": "public"
},
"engines": {
"node": ">=12.4.0"
"node": ">=14.15.0"
}
}
4 changes: 2 additions & 2 deletions scripts/docker/ubuntu16.04-build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ RUN apt-get -y -qq install build-essential python2.7 curl apt-transport-https ca

# Add Node.js
RUN curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
RUN echo "deb https://deb.nodesource.com/node_12.x xenial main" | tee /etc/apt/sources.list.d/nodesource.list
RUN echo "deb-src https://deb.nodesource.com/node_12.x xenial main" | tee -a /etc/apt/sources.list.d/nodesource.list
RUN echo "deb https://deb.nodesource.com/node_14.x xenial main" | tee /etc/apt/sources.list.d/nodesource.list
RUN echo "deb-src https://deb.nodesource.com/node_14.x xenial main" | tee -a /etc/apt/sources.list.d/nodesource.list

# Add sufficiently recent compiler toolchain
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
Expand Down
8 changes: 4 additions & 4 deletions scripts/generate-homebrew-formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class Mongosh < Formula
# curl -s https://registry.npmjs.org/@mongosh/cli-repl/-/cli-repl-${context.version}.tgz | shasum -a 256
sha256 "${context.sha}"

depends_on "node@12"
depends_on "node@14"

def install
system "#{Formula["node@12"].bin}/npm", "install", *Language::Node.std_npm_install_args(libexec)
(bin/"mongosh").write_env_script libexec/"bin/mongosh", :PATH => "#{Formula["node@12"].opt_bin}:$PATH"
system "#{Formula["node@14"].bin}/npm", "install", *Language::Node.std_npm_install_args(libexec)
(bin/"mongosh").write_env_script libexec/"bin/mongosh", :PATH => "#{Formula["node@14"].opt_bin}:$PATH"
end

test do
Expand Down Expand Up @@ -96,4 +96,4 @@ if (require.main === module) {
);
} else {
module.exports = generateHomebrewFormula;
}
}