Skip to content

Commit 97e830e

Browse files
authored
Speed local setup (#263)
Changes: 1. Only download chromium in CI and use it if necessary. 2. Add few commands to the main package.json: - `bootstrap-with-chromium`: always download chromium - `bootstrap-without-compass`: do not link and install compass-shell - `bootstrap-ci`: used in evergreen, run lerna and npm commands in 'ci' mode: without altering package-lock.json 3. `bootstrap` will not run the `prepublish` script anymore. This means that `compile-ts` and webpack are not run automatically on every install. 4. Fix node.js version in evergreen 5. Always use npm ci and bootstrap-ci in evergreen
1 parent a569c77 commit 97e830e

File tree

12 files changed

+225
-423
lines changed

12 files changed

+225
-423
lines changed

.evergreen.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ variables:
3232
shell: powershell
3333
script: |
3434
.\.evergreen\SetupEnv
35+
node --version
36+
npm --version
3537
$Env:PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = "true"
3638
$Env:EVERGREEN_EXPANSIONS_PATH = $(Join-Path -Path '..' -ChildPath 'tmp/expansions.yaml' -Resolve)
3739
npm run release

.evergreen/.install_node

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
11
export NODE_JS_VERSION='12.4.0'
22

3-
if [[ $OSTYPE == "cygwin" ]]; then
4-
echo "Installing nodejs v$NODE_JS_VERSION for windows..."
5-
mkdir .deps
6-
curl -fs \
7-
-o ".deps/node-v$NODE_JS_VERSION-win-x64.zip" \
8-
--url "https://nodejs.org/download/release/v$NODE_JS_VERSION/node-v$NODE_JS_VERSION-win-x64.zip"
9-
cd .deps
10-
unzip -q node-v$NODE_JS_VERSION-win-x64.zip
11-
mv node-v$NODE_JS_VERSION-win-x64/* .
12-
rm -rf node-v$NODE_JS_VERSION-win-x64
3+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
4+
export NVM_DIR="$HOME/.nvm"
135

14-
echo "Installing npm@latest..."
15-
rm -rf npm npx npm.cmd npx.cmd
16-
mv node_modules/npm node_modules/npm2
17-
chmod +x ./node.exe
18-
19-
./node.exe node_modules/npm2/bin/npm-cli.js i -g npm@latest
20-
rm -rf node_modules/npm2/
21-
chmod +x npm.cmd npm
22-
cd ..
23-
npm run bootstrap
24-
else
25-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
26-
export NVM_DIR="$HOME/.nvm"
27-
echo "Setting NVM environment home: $NVM_DIR"
28-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
29-
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
30-
nvm install $NODE_JS_VERSION
31-
nvm alias default $NODE_JS_VERSION
32-
npm install -g npm@latest
33-
npm run bootstrap
34-
fi
6+
echo "Setting NVM environment home: $NVM_DIR"
7+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
8+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
9+
10+
nvm install $NODE_JS_VERSION
11+
nvm alias default $NODE_JS_VERSION
12+
npm install -g npm@latest
13+
14+
echo "Using node version:"
15+
node --version
16+
17+
echo "Using npm version:"
18+
npm --version
19+
20+
npm run bootstrap-ci

.evergreen/.setup_env

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
if [[ $OSTYPE == "cygwin" ]]; then
2-
echo "Setting up Windows environment"
3-
else
4-
export NVM_DIR="$HOME/.nvm"
5-
echo "Setting NVM environment home: $NVM_DIR"
6-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
7-
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
8-
fi
1+
export NVM_DIR="$HOME/.nvm"
2+
echo "Setting NVM environment home: $NVM_DIR"
3+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
4+
5+
echo "Using node version:"
6+
node --version
7+
8+
echo "Using npm version:"
9+
npm --version

.evergreen/InstallNode.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ Remove-Item .\npm
2020
Remove-Item .\npm.cmd
2121
Remove-Item .\npx
2222
Remove-Item .\npx.cmd
23-
Move-Item .\node_modules\npm -Destination .\node_modules\npm2
23+
Move-Item .\node_modules\npm -Destination .\node_modules\npm2
2424
.\node.exe .\node_modules\npm2\bin\npm-cli.js i -g npm@latest
2525

2626
Set-Location -Path $PSScriptRoot\..\
27-
npm run bootstrap
27+
28+
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
29+
$SetupEnv = "$scriptPath\SetupEnv.ps1"
30+
31+
& $SetupEnv
32+
npm run bootstrap-ci

.evergreen/SetupEnv.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
$version = "12.4.0"
2-
$node_path = "$PSScriptRoot\node-v$version-win-x64\node.exe"
3-
$npm_path = "$PSScriptRoot\node-v$version-win-x64\npm.cmd"
4-
$Env:PATH += ";$node_path;$npm_path"
2+
$Env:PATH = "$PSScriptRoot\node-v$version-win-x64;C:\Program Files\Git\mingw32\libexec\git-core;$Env:PATH"
3+
4+
echo "Using node version:"
5+
node --version
6+
7+
echo "Using npm version:"
8+
npm --version
9+

config/karma.conf.base.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

package-lock.json

Lines changed: 5 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
"main": "index.js",
55
"bin": "packages/cli-repl/bin/mongosh.js",
66
"scripts": {
7+
"prebootstrap-with-chromium": "npm install",
8+
"bootstrap-with-chromium": "lerna bootstrap --concurrency=1",
79
"prebootstrap": "npm install",
8-
"bootstrap": "lerna bootstrap --concurrency=1",
10+
"bootstrap": "cross-env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 lerna bootstrap --ignore-prepublish --concurrency=1",
11+
"prebootstrap-without-compass": "npm install",
12+
"bootstrap-without-compass": "cross-env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 lerna bootstrap --ignore @mongodb-js/compass-shell --ignore-prepublish --concurrency=1",
13+
"prebootstrap-ci": "npm ci",
14+
"bootstrap-ci": "lerna bootstrap --ci --concurrency=1",
915
"clean": "lerna clean -y && rm -Rf node_modules",
1016
"check": "lerna run check --since HEAD --exclude-dependents",
1117
"check-ci": "lerna run check",
@@ -87,7 +93,6 @@
8793
"node-codesign": "durran/node-codesign",
8894
"parcel-bundler": "^1.12.4",
8995
"pkg": "^4.4.3",
90-
"puppeteer": "^2.0.0",
9196
"rimraf": "^3.0.2",
9297
"semver": "^7.3.2",
9398
"sinon": "^7.5.0",

packages/browser-repl/config/karma.conf.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
process.env.CHROME_BIN = require('puppeteer').executablePath();
1+
const setupTestBrowser = require('./setup-test-browser');
2+
const browser = setupTestBrowser();
23

34
const webpackConfigTest = require('./webpack.config.test');
45

@@ -36,7 +37,13 @@ module.exports = (config) => {
3637
reporters: [
3738
'mocha'
3839
],
39-
browsers: [ 'ChromeHeadless' ],
40+
customLaunchers: {
41+
HeadlessChrome: {
42+
base: 'ChromeHeadless',
43+
flags: ['--no-sandbox']
44+
}
45+
},
46+
browsers: [ browser ],
4047
singleRun: true,
4148
client: {
4249
mocha: {

0 commit comments

Comments
 (0)