Skip to content

Commit

Permalink
Add support for Node.js 18 and 19
Browse files Browse the repository at this point in the history
As node-pre-gyp is no longer maintained this is the path of least resistance to adding new versions,
we include a patch within this project that updates the abi_crosswalk file within node-pre-gyp that
is used to map the versions of node to their module/v8 versions. Then in run.js we call patch-package
before spawning anything to ensure that our patches are applied correctly.

This isn't by any means perfect but it's the quickest way to update the supported versions of node
without having to go and make any major refactors to the setup here, or the code in ioslib/the SDK
  • Loading branch information
ewanharris committed Jan 11, 2023
1 parent 33a9ce4 commit 4652c0c
Show file tree
Hide file tree
Showing 4 changed files with 294 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ if (process.platform !== 'darwin') {
}

const spawnSync = require('child_process').spawnSync;

spawnSync('patch-package', { stdio: 'inherit' });

const args = process.argv.slice(2);
const cmd = args.shift();

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"@mapbox/node-pre-gyp": "^1.0.10",
"debug": "^4.3.4",
"nan": "^2.17.0",
"node-pre-gyp-init": "^1.2.1"
"node-pre-gyp-init": "^1.2.1",
"patch-package": "^6.5.1"
},
"devDependencies": {
"@octokit/rest": "^18.12.0"
Expand All @@ -54,7 +55,9 @@
"14.19.1": 83,
"15.14.0": 88,
"16.14.2": 93,
"17.7.2": 102
"17.7.2": 102,
"18.13.0": 108,
"19.4.0": 111
}
},
"engines": {
Expand Down
19 changes: 19 additions & 0 deletions patches/@mapbox+node-pre-gyp+1.0.10.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json b/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json
index 7f52972..089c6e9 100644
--- a/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json
+++ b/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json
@@ -2598,5 +2598,13 @@
"17.1.0": {
"node_abi": 102,
"v8": "9.5"
+ },
+ "18.13.0":{
+ "node_abi": 108,
+ "v8": "10.2"
+ } ,
+ "19.4.0": {
+ "node_abi": 111,
+ "v8": "10.8"
}
}
\ No newline at end of file
Loading

0 comments on commit 4652c0c

Please sign in to comment.