From ff84dc00d7ae46c823dcc8f2dffafb9271cba2a7 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 13:46:01 -0700 Subject: [PATCH 1/8] fix: use execa for prebiuld script --- .gitignore | 5 ++ package.json | 5 +- pnpm-lock.yaml | 114 +++++++++++++++++++++++++++ script/{prebuild.ts => prebuild.mts} | 13 +-- script/tsconfig.esm.json | 9 +++ 5 files changed, 138 insertions(+), 8 deletions(-) rename script/{prebuild.ts => prebuild.mts} (93%) create mode 100644 script/tsconfig.esm.json diff --git a/.gitignore b/.gitignore index 346d4de0..f369c2cc 100644 --- a/.gitignore +++ b/.gitignore @@ -14,12 +14,17 @@ test.js .cache/ test/typings-compatibility/ /script/*.js +/script/*.mjs /script/*.d.ts +/script/*.d.mts /script/*.js.map +/script/*.mjs.map /script/*/*.js +/script/*/*.mjs /script/*/*.d.ts /script/*/*.js.map tsconfig.tsbuildinfo +tsconfig.esm.tsbuildinfo /docs-raw .DS_Store .idea diff --git a/package.json b/package.json index 960c0755..3271ca12 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "eslint": "^8", "eslint-config-atomic": "^1.22.0", "eslint-plugin-prettier": "^4.2.1", + "execa": "^9.2.0", "fs-extra": "^10.1.0", "gh-pages": "^4.0.0", "minify-all-cli": "^1.0.13", @@ -84,11 +85,11 @@ "clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep", "build.library.compat": "shx rm -rf ./lib/ts3.7 && downlevel-dts ./lib ./lib/ts3.7 --to=3.7", "build.library": "tsc -p ./src/tsconfig.json && run-s build.library.compat", - "build.script": "tsc -p ./script/tsconfig.json", + "build.script": "tsc -p ./script/tsconfig.json && tsc -p ./script/tsconfig.esm.json", "build.js": "run-p build.script build.library", "build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-raw -d docs --jsCompressor terser", "deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"", - "prebuild": "run-s build.js && node ./script/prebuild.js", + "prebuild": "run-s build.js && node ./script/prebuild.mjs", "build.native": "node-gyp configure --release && node-gyp configure --release -- -f compile_commands_json && node-gyp build --release", "build.native.debug": "node-gyp configure --debug && node-gyp configure --debug -- -f compile_commands_json && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug", "build": "run-s build.js build.native", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8cce5bd6..3813156a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,6 +73,9 @@ importers: eslint-plugin-prettier: specifier: ^4.2.1 version: 4.2.1(eslint@8.57.0)(prettier@2.8.8) + execa: + specifier: ^9.2.0 + version: 9.2.0 fs-extra: specifier: ^10.1.0 version: 10.1.0 @@ -420,6 +423,13 @@ packages: resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@sec-ant/readable-stream@0.4.1': + resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} + + '@sindresorhus/merge-streams@4.0.0': + resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} + engines: {node: '>=18'} + '@trysound/sax@0.2.0': resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} @@ -1574,6 +1584,10 @@ packages: resolution: {integrity: sha512-RztN09XglpYI7aBBrJCPW95jEH7YF1UEPOoX9yDhUTPdp7mK+CQvnLTuD10BNXZ3byLTu2uehZ8EcKT/4CGiFw==} engines: {node: '>=4'} + execa@9.2.0: + resolution: {integrity: sha512-vpOyYg7UAVKLAWWtRS2gAdgkT7oJbCn0me3gmUmxZih4kd3MF/oo8kNTBTIbkO3yuuF5uB4ZCZfn8BOolITYhg==} + engines: {node: ^18.19.0 || >=20.5.0} + execspawn@1.0.1: resolution: {integrity: sha512-s2k06Jy9i8CUkYe0+DxRlvtkZoOkwwfhB+Xxo5HGUtrISVW2m98jO2tr67DGRFxZwkjQqloA3v/tNtjhBRBieg==} @@ -1606,6 +1620,10 @@ packages: fecha@4.2.3: resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==} + figures@6.1.0: + resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} + engines: {node: '>=18'} + file-entry-cache@6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -1724,6 +1742,10 @@ packages: resolution: {integrity: sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==} engines: {node: '>=4'} + get-stream@9.0.1: + resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} + engines: {node: '>=18'} + get-symbol-description@1.0.0: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} @@ -1901,6 +1923,10 @@ packages: resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} engines: {node: '>= 14'} + human-signals@7.0.0: + resolution: {integrity: sha512-74kytxOUSvNbjrT9KisAbaTZ/eJwD/LrbM/kh5j0IhPuJzwuA19dWvniFGwBzN9rVjg+O/e+F310PjObDXS+9Q==} + engines: {node: '>=18.18.0'} + iconv-lite@0.6.3: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} @@ -2094,6 +2120,10 @@ packages: resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} engines: {node: '>=8'} + is-plain-obj@4.1.0: + resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} + engines: {node: '>=12'} + is-redirect@1.0.0: resolution: {integrity: sha512-cr/SlUEe5zOGmzvj9bUyC4LVvkNVAXu4GytXLNMr1pny+a65MpQ9IJzFHD5vi7FyJgb4qt27+eS3TuQnqB+RQw==} engines: {node: '>=0.10.0'} @@ -2125,6 +2155,10 @@ packages: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} + is-stream@4.0.1: + resolution: {integrity: sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==} + engines: {node: '>=18'} + is-string@1.0.7: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} @@ -2141,6 +2175,10 @@ packages: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} + is-unicode-supported@2.0.0: + resolution: {integrity: sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==} + engines: {node: '>=18'} + is-valid-path@0.1.1: resolution: {integrity: sha512-+kwPrVDu9Ms03L90Qaml+79+6DZHqHyRoANI6IsZJ/g8frhnfchDOBCa0RbQ6/kdHt5CS5OeIEyrYznNuVN+8A==} engines: {node: '>=0.10.0'} @@ -2558,6 +2596,10 @@ packages: resolution: {integrity: sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==} engines: {node: '>=8'} + npm-run-path@5.3.0: + resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} @@ -2671,6 +2713,10 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} + parse-ms@4.0.0: + resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==} + engines: {node: '>=18'} + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -2690,6 +2736,10 @@ packages: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} + path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} @@ -2944,6 +2994,10 @@ packages: engines: {node: '>=14'} hasBin: true + pretty-ms@9.0.0: + resolution: {integrity: sha512-E9e9HJ9R9NasGOgPaPE8VMeiPKAyWR5jcFpNnwIejslIhWqdqOrb2wShBsncMPUb+BcCd2OPYfh7p2W6oemTng==} + engines: {node: '>=18'} + proc-log@3.0.0: resolution: {integrity: sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -3323,6 +3377,10 @@ packages: resolution: {integrity: sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==} engines: {node: '>=0.10.0'} + strip-final-newline@4.0.0: + resolution: {integrity: sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==} + engines: {node: '>=18'} + strip-json-comments@1.0.4: resolution: {integrity: sha512-AOPG8EBc5wAikaG1/7uFCNFJwnKOuQwFTpYBdTW6OvWHeZBQBrAA/amefHGrEiOnCPcLFZK6FUPtWVKpQVIRgg==} engines: {node: '>=0.8.0'} @@ -3757,6 +3815,10 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + yoctocolors@2.0.2: + resolution: {integrity: sha512-Ct97huExsu7cWeEjmrXlofevF8CvzUglJ4iGUet5B8xn1oumtAZBpHU4GzYuoE6PVqcZ5hghtBrSlhwHuR1Jmw==} + engines: {node: '>=18'} + snapshots: '@aminya/eslint-plugin-only-warn@1.2.2': {} @@ -4146,6 +4208,10 @@ snapshots: '@pkgr/core@0.1.1': {} + '@sec-ant/readable-stream@0.4.1': {} + + '@sindresorhus/merge-streams@4.0.0': {} + '@trysound/sax@0.2.0': {} '@tsconfig/node10@1.0.9': {} @@ -5690,6 +5756,21 @@ snapshots: signal-exit: 3.0.7 strip-eof: 1.0.0 + execa@9.2.0: + dependencies: + '@sindresorhus/merge-streams': 4.0.0 + cross-spawn: 7.0.3 + figures: 6.1.0 + get-stream: 9.0.1 + human-signals: 7.0.0 + is-plain-obj: 4.1.0 + is-stream: 4.0.1 + npm-run-path: 5.3.0 + pretty-ms: 9.0.0 + signal-exit: 4.1.0 + strip-final-newline: 4.0.0 + yoctocolors: 2.0.2 + execspawn@1.0.1: dependencies: util-extend: 1.0.3 @@ -5720,6 +5801,10 @@ snapshots: fecha@4.2.3: {} + figures@6.1.0: + dependencies: + is-unicode-supported: 2.0.0 + file-entry-cache@6.0.1: dependencies: flat-cache: 3.2.0 @@ -5844,6 +5929,11 @@ snapshots: get-stream@3.0.0: {} + get-stream@9.0.1: + dependencies: + '@sec-ant/readable-stream': 0.4.1 + is-stream: 4.0.1 + get-symbol-description@1.0.0: dependencies: call-bind: 1.0.2 @@ -6082,6 +6172,8 @@ snapshots: transitivePeerDependencies: - supports-color + human-signals@7.0.0: {} + iconv-lite@0.6.3: dependencies: safer-buffer: 2.1.2 @@ -6247,6 +6339,8 @@ snapshots: is-plain-obj@2.1.0: {} + is-plain-obj@4.1.0: {} + is-redirect@1.0.0: {} is-regex@1.1.4: @@ -6270,6 +6364,8 @@ snapshots: is-stream@2.0.1: {} + is-stream@4.0.1: {} + is-string@1.0.7: dependencies: has-tostringtag: 1.0.0 @@ -6284,6 +6380,8 @@ snapshots: is-unicode-supported@0.1.0: {} + is-unicode-supported@2.0.0: {} + is-valid-path@0.1.1: dependencies: is-invalid-path: 0.1.0 @@ -6756,6 +6854,10 @@ snapshots: dependencies: path-key: 3.1.1 + npm-run-path@5.3.0: + dependencies: + path-key: 4.0.0 + nth-check@2.1.1: dependencies: boolbase: 1.0.0 @@ -6899,6 +7001,8 @@ snapshots: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + parse-ms@4.0.0: {} + path-exists@4.0.0: {} path-is-absolute@1.0.1: {} @@ -6909,6 +7013,8 @@ snapshots: path-key@3.1.1: {} + path-key@4.0.0: {} + path-parse@1.0.7: {} path-scurry@1.10.1: @@ -7129,6 +7235,10 @@ snapshots: prettier@3.3.2: {} + pretty-ms@9.0.0: + dependencies: + parse-ms: 4.0.0 + proc-log@3.0.0: {} promise-retry@2.0.1: @@ -7591,6 +7701,8 @@ snapshots: strip-eof@1.0.0: {} + strip-final-newline@4.0.0: {} + strip-json-comments@1.0.4: {} strip-json-comments@2.0.1: {} @@ -8072,3 +8184,5 @@ snapshots: yn@3.1.1: {} yocto-queue@0.1.0: {} + + yoctocolors@2.0.2: {} diff --git a/script/prebuild.ts b/script/prebuild.mts similarity index 93% rename from script/prebuild.ts rename to script/prebuild.mts index 9ddc3cff..d7dd86bb 100644 --- a/script/prebuild.ts +++ b/script/prebuild.mts @@ -1,8 +1,4 @@ -import {spawnSync} from "child_process" - -main().catch(e => { - throw e -}) +import {execaCommandSync} from "execa" async function main() { console.log("Building distribution binary...") @@ -37,13 +33,18 @@ async function main() { prebuildScript = `/alpine/enter-chroot ${prebuildScript}` } - spawnSync(prebuildScript, { + execaCommandSync(prebuildScript, { shell: true, + windowsHide: true, stdio: "inherit", encoding: "utf8", }) } +main().catch(e => { + throw e +}) + function getNodearch(): string { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/strict-boolean-expressions const arch = process.env.ARCH || process.arch diff --git a/script/tsconfig.esm.json b/script/tsconfig.esm.json new file mode 100644 index 00000000..698433fd --- /dev/null +++ b/script/tsconfig.esm.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "node", + }, + "include": ["./**/*.mts"], + "exclude": [] +} From 600d65263629ec392e6837512a02fdd23b5c0590 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 13:56:23 -0700 Subject: [PATCH 2/8] fix: update prebuildify to fix the Windows prebuilds --- package.json | 2 +- pnpm-lock.yaml | 23 +++++------------------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 3271ca12..2c6a2c3a 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "mocha": "^10.4.0", "node-gyp": "^10.1.0", "npm-run-all2": "^6.2.0", - "prebuildify": "^5.0.1", + "prebuildify": "^6.0.1", "prettier": "^2.8.8", "rocha": "^2.5.10", "semver": "^7.6.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3813156a..f3300ebb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -95,8 +95,8 @@ importers: specifier: ^6.2.0 version: 6.2.0 prebuildify: - specifier: ^5.0.1 - version: 5.0.1 + specifier: ^6.0.1 + version: 6.0.1 prettier: specifier: ^2.8.8 version: 2.8.8 @@ -1588,9 +1588,6 @@ packages: resolution: {integrity: sha512-vpOyYg7UAVKLAWWtRS2gAdgkT7oJbCn0me3gmUmxZih4kd3MF/oo8kNTBTIbkO3yuuF5uB4ZCZfn8BOolITYhg==} engines: {node: ^18.19.0 || >=20.5.0} - execspawn@1.0.1: - resolution: {integrity: sha512-s2k06Jy9i8CUkYe0+DxRlvtkZoOkwwfhB+Xxo5HGUtrISVW2m98jO2tr67DGRFxZwkjQqloA3v/tNtjhBRBieg==} - exit@0.1.2: resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} engines: {node: '>= 0.8.0'} @@ -2968,8 +2965,8 @@ packages: resolution: {integrity: sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==} engines: {node: ^10 || ^12 || >=14} - prebuildify@5.0.1: - resolution: {integrity: sha512-vXpKLfIEsDCqMJWVIoSrUUBJQIuAk9uHAkLiGJuTdXdqKSJ10sHmWeuNCDkIoRFTV1BDGYMghHVmDFP8NfkA2Q==} + prebuildify@6.0.1: + resolution: {integrity: sha512-8Y2oOOateom/s8dNBsGIcnm6AxPmLH4/nanQzL5lQMU+sC0CMhzARZHizwr36pUPLdvBnOkCNQzxg4djuFSgIw==} hasBin: true prelude-ls@1.2.1: @@ -3662,9 +3659,6 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - util-extend@1.0.3: - resolution: {integrity: sha512-mLs5zAK+ctllYBj+iAQvlDCwoxU/WDOUaJkcFudeiAX6OajC6BKXJUa9a+tbtkC11dz2Ufb7h0lyvIOVn4LADA==} - v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} @@ -5771,10 +5765,6 @@ snapshots: strip-final-newline: 4.0.0 yoctocolors: 2.0.2 - execspawn@1.0.1: - dependencies: - util-extend: 1.0.3 - exit@0.1.2: {} exponential-backoff@3.1.1: {} @@ -7213,9 +7203,8 @@ snapshots: picocolors: 1.0.0 source-map-js: 1.0.2 - prebuildify@5.0.1: + prebuildify@6.0.1: dependencies: - execspawn: 1.0.1 minimist: 1.2.7 mkdirp-classic: 0.5.3 node-abi: 3.28.0 @@ -8003,8 +7992,6 @@ snapshots: util-deprecate@1.0.2: {} - util-extend@1.0.3: {} - v8-compile-cache-lib@3.0.1: {} validate-npm-package-license@3.0.4: From be9c0caa2bd4b0e01eca0179705c4fb27bdc2b83 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 14:01:38 -0700 Subject: [PATCH 3/8] test: remove instance checks for abstract sockets --- test/unit/socket-construction-test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/unit/socket-construction-test.ts b/test/unit/socket-construction-test.ts index 813dd039..fe09d6dd 100644 --- a/test/unit/socket-construction-test.ts +++ b/test/unit/socket-construction-test.ts @@ -86,7 +86,6 @@ describe("socket construction", function () { } const sock1 = new MySocket() const sock2 = new MySocket() - assert.instanceOf(sock1, zmq.Socket) assert.equal(sock1.context, sock2.context) }) @@ -98,7 +97,6 @@ describe("socket construction", function () { } const context = new zmq.Context() const socket = new MySocket({context}) - assert.instanceOf(socket, zmq.Socket) assert.equal(socket.context, context) }) }) @@ -121,7 +119,6 @@ describe("socket construction", function () { it("should create socket with given context", function () { const ctxt = new zmq.Context() const sock = new zmq.Dealer({context: ctxt}) - assert.instanceOf(sock, zmq.Socket) assert.equal(sock.context, ctxt) }) From e90e2951e8c7615ae273b68936722e76ec153f16 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 14:01:47 -0700 Subject: [PATCH 4/8] test: do not throw on which failures --- test/unit/typings-compatibility-test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/typings-compatibility-test.ts b/test/unit/typings-compatibility-test.ts index c22da5df..a34962f5 100644 --- a/test/unit/typings-compatibility-test.ts +++ b/test/unit/typings-compatibility-test.ts @@ -170,7 +170,9 @@ async function prepareTestPackage( async function getPackageManager() { const packageManagers = ["pnpm", "yarn", "npm"] - const versionResults = await Promise.all(packageManagers.map(pm => which(pm))) + const versionResults: Array = await Promise.all( + packageManagers.map(pm => which(pm, {nothrow: true})), + ) const packageManagerIndex = versionResults.findIndex( versionResult => typeof versionResult === "string", From d347d8cadf30d0b661a23f95473b65e94ffc74c8 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 14:05:43 -0700 Subject: [PATCH 5/8] test: fix skipping the curve tests --- test/unit/socket-curve-send-receive-test.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/unit/socket-curve-send-receive-test.ts b/test/unit/socket-curve-send-receive-test.ts index c2681679..8b22ecf1 100644 --- a/test/unit/socket-curve-send-receive-test.ts +++ b/test/unit/socket-curve-send-receive-test.ts @@ -5,14 +5,14 @@ import {testProtos, uniqAddress} from "./helpers" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} curve send/receive`, function () { + if (!zmq.capability.curve) { + return + } + let sockA: zmq.Pair let sockB: zmq.Pair beforeEach(function () { - if (!zmq.capability.curve) { - this.skip() - } - const serverKeypair = zmq.curveKeyPair() const clientKeypair = zmq.curveKeyPair() @@ -39,10 +39,6 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { describe("when connected", function () { beforeEach(async function () { - if (!zmq.capability.curve) { - this.skip() - } - const address = uniqAddress(proto) await sockB.bind(address) await sockA.connect(address) From e8443eaee81d6598c8fc0ae918e2bdeba7c712fa Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 14:09:33 -0700 Subject: [PATCH 6/8] test: fix error throw check for proxy termination --- test/unit/proxy-terminate-test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/unit/proxy-terminate-test.ts b/test/unit/proxy-terminate-test.ts index 2d4afea8..b36c0a4c 100644 --- a/test/unit/proxy-terminate-test.ts +++ b/test/unit/proxy-terminate-test.ts @@ -28,11 +28,12 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await proxy.frontEnd.bind(uniqAddress(proto)) await proxy.backEnd.bind(uniqAddress(proto)) - setTimeout(() => proxy.terminate(), 50) - await proxy.run() - try { + const timer = setTimeout(() => proxy.terminate(), 50) + await proxy.run() + await proxy.terminate() + timer.unref() assert.ok(false) } catch (err) { if (!isFullError(err)) { From bafaca0705c57eb201d426c561845bd26b540691 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 14:15:41 -0700 Subject: [PATCH 7/8] test: remove typescript 3.7 compat tests --- package.json | 3 +-- test/unit/typings-compatibility-test.ts | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index 2c6a2c3a..5f7922fd 100644 --- a/package.json +++ b/package.json @@ -83,8 +83,7 @@ "install": "(shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true aminya-node-gyp-build", "clean": "shx rm -rf ./build ./lib/ ./prebuilds ./script/*.js ./script/*.js.map ./script/*.d.ts ./script/*.tsbuildinfo", "clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep", - "build.library.compat": "shx rm -rf ./lib/ts3.7 && downlevel-dts ./lib ./lib/ts3.7 --to=3.7", - "build.library": "tsc -p ./src/tsconfig.json && run-s build.library.compat", + "build.library": "tsc -p ./src/tsconfig.json", "build.script": "tsc -p ./script/tsconfig.json && tsc -p ./script/tsconfig.esm.json", "build.js": "run-p build.script build.library", "build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-raw -d docs --jsCompressor terser", diff --git a/test/unit/typings-compatibility-test.ts b/test/unit/typings-compatibility-test.ts index a34962f5..b0677953 100644 --- a/test/unit/typings-compatibility-test.ts +++ b/test/unit/typings-compatibility-test.ts @@ -23,9 +23,6 @@ import {assert} from "chai" type TestDef = {version: string; minTarget: string; requiredLibs?: string[]} const tsVersions: TestDef[] = [ - // the oldest supported version - {version: "3.7.x", minTarget: "es3"}, - // 4.x {version: "4.x", minTarget: "es3"}, ] From 3701e9d7e052d1a6049e93cf1f5ca72c2d491d1c Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 14 Jun 2024 14:21:26 -0700 Subject: [PATCH 8/8] build: avoid running the prebuild script before the build --- .github/workflows/CI.yml | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 371e13f9..0c6db85e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -65,7 +65,7 @@ jobs: docker: node:18-alpine docker_cmd: apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake - musl-dev && npm i -g pnpm && pnpm install && pnpm run prebuild + musl-dev && npm i -g pnpm && pnpm install && pnpm run build.prebuild node_version: 18 node_arch: x64 ARCH: x64 @@ -133,7 +133,7 @@ jobs: - name: Prebuild if: ${{ !matrix.docker }} - run: pnpm run prebuild + run: pnpm run build.prebuild - name: Prebuild Docker if: ${{ matrix.docker }} diff --git a/package.json b/package.json index 5f7922fd..29815452 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "build.js": "run-p build.script build.library", "build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-raw -d docs --jsCompressor terser", "deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"", - "prebuild": "run-s build.js && node ./script/prebuild.mjs", + "build.prebuild": "run-s build.js && node ./script/prebuild.mjs", "build.native": "node-gyp configure --release && node-gyp configure --release -- -f compile_commands_json && node-gyp build --release", "build.native.debug": "node-gyp configure --debug && node-gyp configure --debug -- -f compile_commands_json && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug", "build": "run-s build.js build.native",