Skip to content

Commit

Permalink
fix(NODE-4302): remove downlevel ts and typesVersions (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Jun 14, 2022
1 parent b32ab40 commit 651b60e
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 163 deletions.
46 changes: 46 additions & 0 deletions .evergreen/config.yml
Expand Up @@ -80,6 +80,19 @@ functions:
${PREPARE_SHELL}
echo "NODE_VERSION=${NODE_VERSION} TEST_TARGET=${TEST_TARGET}"
bash ${PROJECT_DIRECTORY}/.evergreen/run-checks.sh
run typescript:
- command: subprocess.exec
type: test
params:
working_dir: src
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
TS_VERSION: "${TS_VERSION}"
TRY_COMPILING_LIBRARY: "${TRY_COMPILING_LIBRARY}"
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh

tasks:
- name: node-tests-v6
Expand Down Expand Up @@ -161,6 +174,36 @@ tasks:
NODE_MAJOR_VERSION: 16
- func: install dependencies
- func: run checks
- name: check-typescript-oldest
commands:
- func: fetch source
vars:
NODE_MAJOR_VERSION: 16
- func: install dependencies
- func: "run typescript"
vars:
TS_VERSION: "4.0.2"
TRY_COMPILING_LIBRARY: "true"
- name: check-typescript-current
commands:
- func: fetch source
vars:
NODE_MAJOR_VERSION: 16
- func: install dependencies
- func: "run typescript"
vars:
TS_VERSION: ""
TRY_COMPILING_LIBRARY: "true"
- name: check-typescript-next
commands:
- func: fetch source
vars:
NODE_MAJOR_VERSION: 16
- func: install dependencies
- func: "run typescript"
vars:
TS_VERSION: "next"
TRY_COMPILING_LIBRARY: "false"

buildvariants:
- name: linux
Expand All @@ -180,3 +223,6 @@ buildvariants:
run_on: rhel70
tasks:
- run-checks
- check-typescript-oldest
- check-typescript-current
- check-typescript-next
21 changes: 21 additions & 0 deletions .evergreen/init-nvm.sh
@@ -0,0 +1,21 @@
#! /usr/bin/env bash

export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"

if [[ "$OS" == "Windows_NT" ]]; then
NVM_HOME=$(cygpath -w "$NVM_DIR")
export NVM_HOME
NVM_SYMLINK=$(cygpath -w "$NODE_ARTIFACTS_PATH/bin")
export NVM_SYMLINK
NVM_ARTIFACTS_PATH=$(cygpath -w "$NODE_ARTIFACTS_PATH/bin")
export NVM_ARTIFACTS_PATH
PATH=$(cygpath $NVM_SYMLINK):$(cygpath $NVM_HOME):$PATH
export PATH
echo "updated path on windows PATH=$PATH"
else
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
fi

export NODE_OPTIONS="--trace-deprecation --trace-warnings"
1 change: 0 additions & 1 deletion .evergreen/install-dependencies.sh
Expand Up @@ -4,7 +4,6 @@ if [ -z "$NODE_VERSION" ]; then
exit 1
fi

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

NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
Expand Down
30 changes: 30 additions & 0 deletions .evergreen/run-typescript.sh
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -o errexit # Exit the script with error if any of the commands fail

# source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"

set -o xtrace

function get_current_ts_version {
node -e "console.log(require('./package-lock.json').dependencies.typescript.version)"
}

CURRENT_TS_VERSION=$(get_current_ts_version)

export TSC="./node_modules/typescript/bin/tsc"
export TS_VERSION=${TS_VERSION:=$CURRENT_TS_VERSION}

npm install --no-save --force typescript@"$TS_VERSION"

echo "Typescript $($TSC -v)"

# check resolution uses the default latest types
echo "import * as BSON from '.'" > file.ts && node $TSC --noEmit --traceResolution file.ts | grep 'bson.d.ts' && rm file.ts

# check compilation
rm -rf node_modules/@types/eslint # not a dependency we use, but breaks the build :(
node $TSC bson.d.ts

if [[ $TRY_COMPILING_LIBRARY != "false" ]]; then
npm run build:ts
fi
169 changes: 17 additions & 152 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 651b60e

Please sign in to comment.