Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(NODE-4302): remove downlevel ts and typesVersions #501

Merged
merged 2 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Loading