File tree Expand file tree Collapse file tree 5 files changed +32
-25
lines changed Expand file tree Collapse file tree 5 files changed +32
-25
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # #
3
+ # # This script add the location of `npm` and `node` to the path.
4
+ # # This is necessary because evergreen uses separate bash scripts for
5
+ # # different functions in a given CI run but doesn't persist the environment
6
+ # # across them. So we manually invoke this script everywhere we need
7
+ # # access to `npm`, `node`, or need to install something globally from
8
+ # # npm.
9
+
10
+ NODE_ARTIFACTS_PATH=" ${PROJECT_DIRECTORY} /node-artifacts"
11
+ if [[ " $OS " == " Windows_NT" ]]; then
12
+ NODE_ARTIFACTS_PATH=$( cygpath --unix " $NODE_ARTIFACTS_PATH " )
13
+ fi
14
+
15
+ export NODE_ARTIFACTS_PATH
16
+ # npm uses this environment variable to determine where to install global packages
17
+ export npm_global_prefix=$NODE_ARTIFACTS_PATH /npm_global
18
+ export PATH=" $npm_global_prefix /bin:$NODE_ARTIFACTS_PATH /nodejs/bin:$PATH "
19
+ hash -r
20
+
21
+ export NODE_OPTIONS=" --trace-deprecation --trace-warnings"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
set -o errexit # Exit the script with error if any of the commands fail
3
3
4
4
NODE_LTS_VERSION=${NODE_LTS_VERSION:- 14}
5
- NODE_ARTIFACTS_PATH=" ${PROJECT_DIRECTORY:- $(pwd)} /node-artifacts"
6
- if [[ " $OS " = " Windows_NT" ]]; then NODE_ARTIFACTS_PATH=$( cygpath --unix " $NODE_ARTIFACTS_PATH " ) ; fi
5
+
6
+ source " ${PROJECT_DIRECTORY} /.evergreen/init-node-and-npm-env.sh"
7
+
8
+ if [[ -z " ${npm_global_prefix} " ]]; then echo " npm_global_prefix is unset" && exit 1; fi
9
+ if [[ -z " ${NODE_ARTIFACTS_PATH} " ]]; then echo " NODE_ARTIFACTS_PATH is unset" && exit 1; fi
7
10
8
11
CURL_FLAGS=(
9
12
--fail # Exit code 1 if request fails
90
93
mv " ${NODE_ARTIFACTS_PATH} /${node_directory} " " ${NODE_ARTIFACTS_PATH} /nodejs"
91
94
fi
92
95
93
- export PATH=" $NODE_ARTIFACTS_PATH /npm_global/bin:$NODE_ARTIFACTS_PATH /nodejs/bin:$PATH "
94
- hash -r
95
-
96
- # Set npm -g prefix to our local artifacts directory
97
- cat << EOT > .npmrc
98
- prefix=$NODE_ARTIFACTS_PATH /npm_global
99
- EOT
100
-
101
96
if [[ $operating_system != " win" ]]; then
102
97
# Update npm to latest when we can
103
98
npm install --global npm@latest
104
99
hash -r
105
100
fi
106
101
102
+ echo " npm location: $( which npm) "
107
103
echo " npm version: $( npm -v) "
108
104
109
105
npm install " ${NPM_OPTIONS} "
Original file line number Diff line number Diff line change 3
3
set -o errexit # Exit the script with error if any of the commands fail
4
4
set -o xtrace
5
5
6
- source " ${PROJECT_DIRECTORY} /.evergreen/init-nvm.sh"
6
+ source " ${PROJECT_DIRECTORY} /.evergreen/init-node-and-npm-env.sh"
7
+
8
+ # mongodbtoolchain is necessary for building on Windows
9
+ export PATH=" /opt/mongodbtoolchain/v2/bin:$PATH "
7
10
8
11
echo " Node Version $( node -v) "
9
12
Original file line number Diff line number Diff line change 3
3
set -o errexit # Exit the script with error if any of the commands fail
4
4
set -o xtrace
5
5
6
- source " ${PROJECT_DIRECTORY} /.evergreen/init-nvm .sh"
6
+ source " ${PROJECT_DIRECTORY} /.evergreen/init-node-and-npm-env .sh"
7
7
8
8
npm run check:lint
9
9
npm test
You can’t perform that action at this time.
0 commit comments