Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 6 additions & 10 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,7 @@ tasks:
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: check resource management feature integration
- name: check-types-typescript-next-node-types-22.15.3
- name: check-types-typescript-next
tags:
- check-types-typescript-next
- typescript-compilation
Expand All @@ -1914,10 +1914,9 @@ tasks:
updates:
- {key: NODE_LTS_VERSION, value: 20.19.0}
- {key: TS_VERSION, value: next}
- {key: TYPES_VERSION, value: 22.15.3}
- func: install dependencies
- func: check types
- name: check-types-typescript-current-node-types-22.15.3
- name: check-types-typescript-current
tags:
- check-types-typescript-current
- typescript-compilation
Expand All @@ -1928,24 +1927,22 @@ tasks:
updates:
- {key: NODE_LTS_VERSION, value: 20.19.0}
- {key: TS_VERSION, value: current}
- {key: TYPES_VERSION, value: 22.15.3}
- func: install dependencies
- func: check types
- name: check-types-typescript-4.4-node-types-18.11.9
- name: check-types-typescript-5.6
tags:
- check-types-typescript-4.4
- check-types-typescript-5.6
- typescript-compilation
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NODE_LTS_VERSION, value: 20.19.0}
- {key: TS_VERSION, value: '4.4'}
- {key: TYPES_VERSION, value: 18.11.9}
- {key: TS_VERSION, value: '5.6'}
- func: install dependencies
- func: check types
- name: compile-driver-typescript-current-node-types-22.15.3
- name: compile-driver-typescript-current
tags:
- compile-driver-typescript-current
- typescript-compilation
Expand All @@ -1956,7 +1953,6 @@ tasks:
updates:
- {key: NODE_LTS_VERSION, value: 20.19.0}
- {key: TS_VERSION, value: current}
- {key: TYPES_VERSION, value: 22.15.3}
- func: install dependencies
- func: compile driver
- name: download-and-merge-coverage
Expand Down
19 changes: 7 additions & 12 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,43 +542,38 @@ SINGLETON_TASKS.push(
function* makeTypescriptTasks() {
function makeCompileTask(TS_VERSION, TYPES_VERSION) {
return {
name: `compile-driver-typescript-${TS_VERSION}-node-types-${TYPES_VERSION}`,
name: `compile-driver-typescript-${TS_VERSION}`,
tags: [`compile-driver-typescript-${TS_VERSION}`, 'typescript-compilation'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LOWEST_LTS,
TS_VERSION,
TYPES_VERSION
}),
{ func: 'install dependencies' },
{ func: 'compile driver' }
]
};
}
function makeCheckTypesTask(TS_VERSION, TYPES_VERSION) {
function makeCheckTypesTask(TS_VERSION) {
return {
name: `check-types-typescript-${TS_VERSION}-node-types-${TYPES_VERSION}`,
name: `check-types-typescript-${TS_VERSION}`,
tags: [`check-types-typescript-${TS_VERSION}`, 'typescript-compilation'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LOWEST_LTS,
TS_VERSION,
TYPES_VERSION
}),
{ func: 'install dependencies' },
{ func: 'check types' }
]
};
}

const typesVersion = require('../package.json').devDependencies['@types/node'].slice(1);
yield makeCheckTypesTask('next', typesVersion);
yield makeCheckTypesTask('current', typesVersion);
yield makeCheckTypesTask('next');
yield makeCheckTypesTask('current');
yield makeCheckTypesTask('5.6');

// typescript 4.4 only compiles our types with this particular version
yield makeCheckTypesTask('4.4', '18.11.9');

yield makeCompileTask('current', typesVersion);
yield makeCompileTask('current');
}

BUILD_VARIANTS.push({
Expand Down
10 changes: 2 additions & 8 deletions .evergreen/run-typescript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ case $TS_CHECK in
esac

if [ -z "$TS_VERSION" ]; then echo "TS_VERSION must be set"; exit 1; fi
if [ -z "$TYPES_VERSION" ]; then echo "TYPES_VERSION must be set"; exit 1; fi

if [ ! -f "mongodb.d.ts" ]; then
echo "mongodb.d.ts should always exist because of the installation in prior steps but in case it doesn't, build it"
Expand All @@ -30,7 +29,7 @@ function get_ts_version() {
export TSC="./node_modules/typescript/bin/tsc"
export TS_VERSION=$(get_ts_version)

npm install --no-save --force "typescript@$TS_VERSION" "@types/node@$TYPES_VERSION"
npm install --no-save --force "typescript@$TS_VERSION"

echo "Typescript $($TSC -v)"
echo "Types: $(cat node_modules/@types/node/package.json | jq -r .version)"
Expand All @@ -44,12 +43,7 @@ if [ "$TS_CHECK" == "COMPILE_DRIVER" ]; then
npm run build:ts
elif [ "$TS_CHECK" == "CHECK_TYPES" ]; then
echo "checking driver types"
if [ "$TS_VERSION" == "4.4" ]; then
# check compilation
node $TSC mongodb.d.ts --module commonjs --target es2021
else
node $TSC mongodb.d.ts --module node16 --target es2021
fi
node $TSC mongodb.d.ts --module node16 --target es2023
else
"Invalid value $TS_CHECK for TS_CHECK environment variable."
exit 1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The following table describes add-on component version compatibility for the Nod

#### Typescript Version

We recommend using the latest version of typescript, however we currently ensure the driver's public types compile against `typescript@4.4.0`.
We recommend using the latest version of typescript, however we currently ensure the driver's public types compile against `typescript@5.6.0`.
This is the lowest typescript version guaranteed to work with our driver: older versions may or may not work - use at your own risk.
Since typescript [does not restrict breaking changes to major versions](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes), we consider this support best effort.
If you run into any unexpected compiler failures against our supported TypeScript versions, please let us know by filing an issue on our [JIRA](https://jira.mongodb.org/browse/NODE).
Expand All @@ -104,7 +104,7 @@ Additionally, our Typescript types are compatible with the ECMAScript standard f

## Installation

The recommended way to get started using the Node.js 5.x driver is by using the `npm` (Node Package Manager) to install the dependency in your project.
The recommended way to get started using the Node.js 6.x driver is by using the `npm` (Node Package Manager) to install the dependency in your project.

After you've created your own project using `npm init`, you can run:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ describe('Connection', function () {

// Ensure that we used the drain event for this write
expect(addedListeners).to.deep.equal(['drain', 'error']);

// https://github.com/nodejs/node/issues/59977: Node 20.11.0
// does not emit a `removeListeners` event for `drain`.
expect(removedListeners).to.deep.equal(['error']);
expect(socket.listenerCount('drain')).to.equal(0);
});
Expand Down