Skip to content

Commit 651b60e

Browse files
authored
fix(NODE-4302): remove downlevel ts and typesVersions (#501)
1 parent b32ab40 commit 651b60e

File tree

6 files changed

+116
-163
lines changed

6 files changed

+116
-163
lines changed

.evergreen/config.yml

+46
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ functions:
8080
${PREPARE_SHELL}
8181
echo "NODE_VERSION=${NODE_VERSION} TEST_TARGET=${TEST_TARGET}"
8282
bash ${PROJECT_DIRECTORY}/.evergreen/run-checks.sh
83+
run typescript:
84+
- command: subprocess.exec
85+
type: test
86+
params:
87+
working_dir: src
88+
timeout_secs: 60
89+
env:
90+
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
91+
TS_VERSION: "${TS_VERSION}"
92+
TRY_COMPILING_LIBRARY: "${TRY_COMPILING_LIBRARY}"
93+
binary: bash
94+
args:
95+
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh
8396

8497
tasks:
8598
- name: node-tests-v6
@@ -161,6 +174,36 @@ tasks:
161174
NODE_MAJOR_VERSION: 16
162175
- func: install dependencies
163176
- func: run checks
177+
- name: check-typescript-oldest
178+
commands:
179+
- func: fetch source
180+
vars:
181+
NODE_MAJOR_VERSION: 16
182+
- func: install dependencies
183+
- func: "run typescript"
184+
vars:
185+
TS_VERSION: "4.0.2"
186+
TRY_COMPILING_LIBRARY: "true"
187+
- name: check-typescript-current
188+
commands:
189+
- func: fetch source
190+
vars:
191+
NODE_MAJOR_VERSION: 16
192+
- func: install dependencies
193+
- func: "run typescript"
194+
vars:
195+
TS_VERSION: ""
196+
TRY_COMPILING_LIBRARY: "true"
197+
- name: check-typescript-next
198+
commands:
199+
- func: fetch source
200+
vars:
201+
NODE_MAJOR_VERSION: 16
202+
- func: install dependencies
203+
- func: "run typescript"
204+
vars:
205+
TS_VERSION: "next"
206+
TRY_COMPILING_LIBRARY: "false"
164207

165208
buildvariants:
166209
- name: linux
@@ -180,3 +223,6 @@ buildvariants:
180223
run_on: rhel70
181224
tasks:
182225
- run-checks
226+
- check-typescript-oldest
227+
- check-typescript-current
228+
- check-typescript-next

.evergreen/init-nvm.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#! /usr/bin/env bash
2+
3+
export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"
4+
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
5+
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
6+
7+
if [[ "$OS" == "Windows_NT" ]]; then
8+
NVM_HOME=$(cygpath -w "$NVM_DIR")
9+
export NVM_HOME
10+
NVM_SYMLINK=$(cygpath -w "$NODE_ARTIFACTS_PATH/bin")
11+
export NVM_SYMLINK
12+
NVM_ARTIFACTS_PATH=$(cygpath -w "$NODE_ARTIFACTS_PATH/bin")
13+
export NVM_ARTIFACTS_PATH
14+
PATH=$(cygpath $NVM_SYMLINK):$(cygpath $NVM_HOME):$PATH
15+
export PATH
16+
echo "updated path on windows PATH=$PATH"
17+
else
18+
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
19+
fi
20+
21+
export NODE_OPTIONS="--trace-deprecation --trace-warnings"

.evergreen/install-dependencies.sh

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ if [ -z "$NODE_VERSION" ]; then
44
exit 1
55
fi
66

7-
set -o xtrace # Write all commands first to stderr
87
set -o errexit # Exit the script with error if any of the commands fail
98

109
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"

.evergreen/run-typescript.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
set -o errexit # Exit the script with error if any of the commands fail
3+
4+
# source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"
5+
6+
set -o xtrace
7+
8+
function get_current_ts_version {
9+
node -e "console.log(require('./package-lock.json').dependencies.typescript.version)"
10+
}
11+
12+
CURRENT_TS_VERSION=$(get_current_ts_version)
13+
14+
export TSC="./node_modules/typescript/bin/tsc"
15+
export TS_VERSION=${TS_VERSION:=$CURRENT_TS_VERSION}
16+
17+
npm install --no-save --force typescript@"$TS_VERSION"
18+
19+
echo "Typescript $($TSC -v)"
20+
21+
# check resolution uses the default latest types
22+
echo "import * as BSON from '.'" > file.ts && node $TSC --noEmit --traceResolution file.ts | grep 'bson.d.ts' && rm file.ts
23+
24+
# check compilation
25+
rm -rf node_modules/@types/eslint # not a dependency we use, but breaks the build :(
26+
node $TSC bson.d.ts
27+
28+
if [[ $TRY_COMPILING_LIBRARY != "false" ]]; then
29+
npm run build:ts
30+
fi

package-lock.json

+17-152
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)