|
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:-16}
|
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}/libmongocrypt/bindings/node/.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 | # other repos that use this script run npm install after installing Node.
|
110 |
| -# we can't in mongodb-client-encryption, because when releasing |
| 106 | +# we can't in mongodb-client-encryption, because when releasing |
111 | 107 | # npm install will attempt to build from source, which fails
|
112 | 108 | # because we haven't built libmongocrypt yet.
|
113 | 109 | # npm install "${NPM_OPTIONS}"
|
0 commit comments