From 19a4c6f72d97afbb62d4589f5863e05ad1cbc2e3 Mon Sep 17 00:00:00 2001 From: Marek Serafin Date: Wed, 25 Sep 2024 06:48:10 +0200 Subject: [PATCH] fix(prebuildify-cross): patching packages to fix prebuilding --- package.json | 36 +++++++++++++---------- patches/@vweevers+docker-pull+1.1.1.patch | 13 ++++++++ patches/docker-run+3.1.0.patch | 13 ++++++++ patches/prebuildify-cross+5.1.0.patch | 26 ++++++++++++++++ 4 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 patches/@vweevers+docker-pull+1.1.1.patch create mode 100644 patches/docker-run+3.1.0.patch create mode 100644 patches/prebuildify-cross+5.1.0.patch diff --git a/package.json b/package.json index 268f587e..1b83a85d 100644 --- a/package.json +++ b/package.json @@ -28,38 +28,44 @@ "node": ">=6" }, "dependencies": { - "debug": "^4.3.4", + "debug": "^4.3.7", "napi-thread-safe-callback": "^0.0.6", - "node-addon-api": "^4.3.0", - "node-gyp-build": "^4.6.1" + "node-addon-api": "^8.1.0", + "node-gyp-build": "^4.8.1", + "patch-package": "^8.0.0" }, "optionalDependencies": { "@stoprocent/bluetooth-hci-socket": "^1.3.0" }, "devDependencies": { + "@commitlint/cli": "^19.3.0", + "@commitlint/config-conventional": "^19.2.2", + "@eslint/js": "^9.7.0", + "@semantic-release/changelog": "^6.0.3", "@semantic-release/exec": "^6.0.3", - "async": "^3.2.5", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^10.1.1", + "async": "^3.2.6", "cross-env": "^7.0.3", - "eslint": "^8", - "eslint-config-semistandard": "^17.0.0", - "eslint-config-standard": "^17.0.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-n": "^15.6.0", - "eslint-plugin-promise": "^6.2.0", - "mocha": "^10.4.0", - "node-gyp": "^10.0.0", - "nyc": "^15.1.0", + "eslint": "^8.57.1", + "eslint-plugin-import": "^2.30.0", + "eslint-plugin-n": "^17.10.3", + "eslint-plugin-promise": "^7.1.0", + "mocha": "^10.7.0", + "nyc": "^17.0.0", "prebuildify": "^6.0.1", "prebuildify-cross": "^5.1.0", - "prettier": "^2.8.1", + "semantic-release": "^24.1.1", + "jshint": "^2.13.6", + "prettier": "^3.3.3", "proxyquire": "^2.1.3", - "semantic-release": "^23.1.1", "should": "^13.2.3", "sinon": "^15.0.1", "ws": "^8.11.0" }, "scripts": { "install": "node-gyp-build", + "postinstall": "patch-package", "lint": "eslint \"**/*.js\"", "lint-fix": "eslint \"**/*.js\" --fix", "prebuildify": "prebuildify --napi --target 14.0.0 --force --strip --verbose", diff --git a/patches/@vweevers+docker-pull+1.1.1.patch b/patches/@vweevers+docker-pull+1.1.1.patch new file mode 100644 index 00000000..1e04480c --- /dev/null +++ b/patches/@vweevers+docker-pull+1.1.1.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@vweevers/docker-pull/index.js b/node_modules/@vweevers/docker-pull/index.js +index 67b3e73..bac4a84 100644 +--- a/node_modules/@vweevers/docker-pull/index.js ++++ b/node_modules/@vweevers/docker-pull/index.js +@@ -12,7 +12,7 @@ var pull = function (image, opts, cb) { + image = parse(image) + if (!image) throw new Error('Invalid image') + +- var request = docker({host: opts.host, version: opts.version || 'v1.21'}) ++ var request = docker({host: opts.host, version: opts.version || 'v1.24'}) + var that = new events.EventEmitter() + var layers = {} + var progress = {} diff --git a/patches/docker-run+3.1.0.patch b/patches/docker-run+3.1.0.patch new file mode 100644 index 00000000..7ae1959d --- /dev/null +++ b/patches/docker-run+3.1.0.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/docker-run/index.js b/node_modules/docker-run/index.js +index ea7fc0d..1f08702 100644 +--- a/node_modules/docker-run/index.js ++++ b/node_modules/docker-run/index.js +@@ -14,7 +14,7 @@ var endsWith = function(str, suffix) { + var run = function(image, opts) { + if (!opts) opts = {} + +- var request = docker(opts.host, {version:'v1.14'}) ++ var request = docker(opts.host, {version:'v1.24'}) + var that = new events.EventEmitter() + var tty = !!opts.tty + diff --git a/patches/prebuildify-cross+5.1.0.patch b/patches/prebuildify-cross+5.1.0.patch new file mode 100644 index 00000000..6c3151e8 --- /dev/null +++ b/patches/prebuildify-cross+5.1.0.patch @@ -0,0 +1,26 @@ +diff --git a/node_modules/prebuildify-cross/guest.js b/node_modules/prebuildify-cross/guest.js +index dfd9eb7..c660f86 100644 +--- a/node_modules/prebuildify-cross/guest.js ++++ b/node_modules/prebuildify-cross/guest.js +@@ -10,18 +10,12 @@ const files = JSON.parse(process.env.PREBUILDIFY_CROSS_FILES) + const argv = process.argv.slice(2) + + // Copy host files to working directory +-for (const file of files) { +- const a = path.join('/input', file) +- const b = path.join(cwd, file) ++fs.cpSync("/input", cwd, { recursive: true }) + +- fs.mkdirSync(path.dirname(b), { recursive: true }) +- fs.copyFileSync(a, b, fs.constants.COPYFILE_EXCL) +- fs.chmodSync(b, 0o644) ++if (fs.existsSync(cwd + "/build")) { ++ fs.rmSync(cwd + "/build", { recursive: true, }) + } + +-// Use node_modules of host to avoid a second install step +-fs.symlinkSync('/input/node_modules', path.join(cwd, 'node_modules')) +- + const stdio = ['ignore', 2, 2] + const res = cp.spawnSync('npx', ['--no-install', 'prebuildify', ...argv], { cwd, stdio }) +