Skip to content

Commit

Permalink
feat(NODE-4787)!: bump minimum Node.js version to v16.20.1 (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Jul 10, 2023
1 parent 4c1db9a commit 1dcca92
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 23 deletions.
10 changes: 0 additions & 10 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,6 @@ functions:
- .evergreen/run-bundling-test.sh

tasks:
- name: node-tests-v14
tags: ["node"]
commands:
- func: fetch source
vars:
NODE_LTS_VERSION: 14
- func: install dependencies
- func: run tests
vars:
TEST_TARGET: node
- name: node-tests-v16
tags: ["node"]
commands:
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -o errexit # Exit the script with error if any of the commands fail

NODE_LTS_VERSION=${NODE_LTS_VERSION:-14}
NODE_LTS_VERSION=${NODE_LTS_VERSION:-16}

source "${PROJECT_DIRECTORY}/.evergreen/init-node-and-npm-env.sh"

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"require": "./lib/bson.cjs"
},
"engines": {
"node": ">=14.20.1"
"node": ">=16.20.1"
},
"scripts": {
"pretest": "npm run build",
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const tsConfig = {
checkJs: false,
strict: true,
alwaysStrict: true,
target: 'es2020',
target: 'es2021',
module: 'esnext',
moduleResolution: 'node',
removeComments: true,
lib: ['es2020'],
lib: ['es2021'],
importHelpers: false,
noEmitHelpers: false,
noEmitOnError: true,
Expand Down
8 changes: 2 additions & 6 deletions test/load_bson.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ const fs = require('node:fs');
const path = require('node:path');
const crypto = require('node:crypto');

// TODO(NODE-4787): Node.js 16 was when the atob and btoa globals were introduced, so we need replacements for testing on 14
const shim_btoa = input => Buffer.prototype.toString.call(Buffer.from(input), 'base64');
const shim_atob = input => Buffer.from(input, 'base64').toString('binary');

const commonGlobals = {
TextEncoder,
TextDecoder,
btoa: typeof btoa !== 'undefined' ? btoa : shim_btoa,
atob: typeof atob !== 'undefined' ? atob : shim_atob,
btoa,
atob,
crypto: {
getRandomValues(buffer) {
const random = crypto.randomBytes(buffer.byteLength);
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"checkJs": false,
"strict": true,
"alwaysStrict": true,
"target": "es2020",
"target": "es2021",
"module": "commonjs",
"moduleResolution": "node",
"skipLibCheck": true,
"lib": [
"es2020",
"es2021",
],
"outDir": "lib",
"importHelpers": false,
Expand Down

0 comments on commit 1dcca92

Please sign in to comment.