node-bin-gen 11.2.1 → 11.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +15 -12
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
import { open, unlink, mkdir, writeFile, readFile } from "node:fs/promises";
|
|
5
5
|
import { Writable, Transform } from "node:stream";
|
|
6
6
|
import { join, resolve, dirname } from "node:path";
|
|
7
|
-
import { debuglog } from "node:util";
|
|
8
|
-
import { execFile, spawn } from "node:child_process";
|
|
7
|
+
import { debuglog, promisify } from "node:util";
|
|
8
|
+
import { execFile as execFile_, spawn } from "node:child_process";
|
|
9
9
|
import { fileURLToPath } from "url";
|
|
10
10
|
|
|
11
11
|
import verr from "verror";
|
|
12
|
-
import rimraf from "rimraf";
|
|
12
|
+
import {rimraf} from "rimraf";
|
|
13
13
|
import zlib from "zlib";
|
|
14
14
|
import yargs from "yargs";
|
|
15
15
|
|
|
16
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
17
|
const __dirname = dirname(__filename);
|
|
18
|
+
const execFile = promisify(execFile_);
|
|
18
19
|
|
|
19
20
|
const { VError } = verr;
|
|
20
21
|
|
|
@@ -125,7 +126,7 @@ async function buildArchPackage(os, cpu, version, pre) {
|
|
|
125
126
|
await res.body.pipeTo(Writable.toWeb(f.createWriteStream()));
|
|
126
127
|
f.close();
|
|
127
128
|
|
|
128
|
-
const running = execFile("unzip", [
|
|
129
|
+
const running = await execFile("unzip", [
|
|
129
130
|
"-d",
|
|
130
131
|
`${dir}/bin`,
|
|
131
132
|
"-o",
|
|
@@ -134,10 +135,8 @@ async function buildArchPackage(os, cpu, version, pre) {
|
|
|
134
135
|
`${base}/node.exe`,
|
|
135
136
|
]);
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
running.on("exit", y);
|
|
140
|
-
});
|
|
138
|
+
if (running.stderr) console.warn("error from unzip", running.stderr);
|
|
139
|
+
|
|
141
140
|
await unlink(filename);
|
|
142
141
|
} else {
|
|
143
142
|
const c = spawn("tar", ["--strip-components=1", "-C", dir, "-x"], {
|
|
@@ -147,8 +146,11 @@ async function buildArchPackage(os, cpu, version, pre) {
|
|
|
147
146
|
const unzip = Transform.toWeb(zlib.createGunzip());
|
|
148
147
|
|
|
149
148
|
await res.body.pipeThrough(unzip).pipeTo(Writable.toWeb(c.stdin));
|
|
149
|
+
c.stdin.end();
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
debug("Finished unpacking into", dir);
|
|
153
|
+
|
|
152
154
|
await writeFile(join(dir, "package.json"), JSON.stringify(pkg, null, 2));
|
|
153
155
|
return pkg;
|
|
154
156
|
}
|
|
@@ -200,6 +202,7 @@ async function main() {
|
|
|
200
202
|
"linux-x64",
|
|
201
203
|
"linux-x86",
|
|
202
204
|
"sunos-x64",
|
|
205
|
+
"win-arm64",
|
|
203
206
|
"win-x64",
|
|
204
207
|
"win-x86",
|
|
205
208
|
];
|
|
@@ -212,7 +215,7 @@ async function main() {
|
|
|
212
215
|
return (
|
|
213
216
|
!/^headers|^src/.test(f) &&
|
|
214
217
|
!/pkg$/.test(f) &&
|
|
215
|
-
!/^win
|
|
218
|
+
!/^win-([^-]+)-(exe|msi|7z)/.test(f)
|
|
216
219
|
);
|
|
217
220
|
})
|
|
218
221
|
.map(function (f) {
|
|
@@ -224,9 +227,9 @@ async function main() {
|
|
|
224
227
|
};
|
|
225
228
|
});
|
|
226
229
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
+
for (const v of binaries) {
|
|
231
|
+
await buildArchPackage(v.os, v.cpu, version, pre)
|
|
232
|
+
}
|
|
230
233
|
|
|
231
234
|
const pkg = await buildMetapackage(version + (pre != null ? "-" + pre : ""));
|
|
232
235
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-bin-gen",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.3",
|
|
4
4
|
"description": "Generate a node binary package",
|
|
5
5
|
"author": "Aria Stewart <aredridel@dinhe.net>",
|
|
6
6
|
"main": "index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"node": ">=18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"rimraf": "^
|
|
18
|
+
"rimraf": "^5.0.1",
|
|
19
19
|
"verror": "^1.9.0",
|
|
20
20
|
"yargs": "^17.0.1"
|
|
21
21
|
},
|