@d-dev/bin-upload-win-x64 0.0.11 → 0.0.12
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/bin/bin-upload.exe +0 -0
- package/index.js +8 -43
- package/package.json +4 -11
|
Binary file
|
package/index.js
CHANGED
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
["win32-x64", "@d-dev/bin-upload-win-x64"],
|
|
13
|
-
|
|
14
|
-
["darwin-x64", "@d-dev/bin-upload-darwin-x64"],
|
|
15
|
-
|
|
16
|
-
["darwin-arm64", "@d-dev/bin-upload-darwin-arm64"],
|
|
17
|
-
|
|
18
|
-
]);
|
|
19
|
-
|
|
20
|
-
async function run() {
|
|
21
|
-
return new Promise(async (resolve) => {
|
|
22
|
-
const os = process.platform;
|
|
23
|
-
const cpu = process.arch;
|
|
24
|
-
const key = `${os}-${cpu}`;
|
|
25
|
-
if (!supported_platforms.has(key)) {
|
|
26
|
-
throw new Error(`Platform ${key} is not supported`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const args = process.argv.slice(2);
|
|
30
|
-
let getBinPath;
|
|
31
|
-
try {
|
|
32
|
-
const d = await import(supported_platforms.get(key));
|
|
33
|
-
getBinPath = d.getBinPath;
|
|
34
|
-
} catch (err) {
|
|
35
|
-
console.error(`Failed to import ${supported_platforms.get(key)}.`);
|
|
36
|
-
console.error(`Please make sure to install the package ${supported_platforms.get(key)} as a dependency.`);
|
|
37
|
-
throw err;
|
|
38
|
-
}
|
|
39
|
-
const binPath = getBinPath();
|
|
40
|
-
await chmod(binPath, 0o774);
|
|
41
|
-
const cp = spawn(binPath, args, { stdio: "inherit" });
|
|
42
|
-
cp.on("close", resolve);
|
|
43
|
-
});
|
|
5
|
+
export function getBinPath() {
|
|
6
|
+
const binPath = join(import.meta.dirname, "bin", "bin-upload.exe");
|
|
7
|
+
if (!existsSync(binPath)) {
|
|
8
|
+
throw new Error(`Binary not found at expected path: ${binPath}`);
|
|
9
|
+
}
|
|
10
|
+
return binPath;
|
|
44
11
|
}
|
|
45
|
-
|
|
46
|
-
process.exit(await run());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-dev/bin-upload-win-x64",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Publish binaries to npm, pypi, and github releases.",
|
|
5
5
|
"author": "Derek Worthen <worthend.derek@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,20 +24,13 @@
|
|
|
24
24
|
"package.json",
|
|
25
25
|
"index.js",
|
|
26
26
|
"README.md",
|
|
27
|
-
"LICENSE"
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"bin"
|
|
28
29
|
],
|
|
29
30
|
"os": [
|
|
30
31
|
"win32"
|
|
31
32
|
],
|
|
32
33
|
"cpu": [
|
|
33
34
|
"x64"
|
|
34
|
-
]
|
|
35
|
-
"bin": "index.js",
|
|
36
|
-
"optionalDependencies": {
|
|
37
|
-
"@d-dev/bin-upload-linux-x64": "0.0.11",
|
|
38
|
-
"@d-dev/bin-upload-linux-arm64": "0.0.11",
|
|
39
|
-
"@d-dev/bin-upload-win-x64": "0.0.11",
|
|
40
|
-
"@d-dev/bin-upload-darwin-x64": "0.0.11",
|
|
41
|
-
"@d-dev/bin-upload-darwin-arm64": "0.0.11"
|
|
42
|
-
}
|
|
35
|
+
]
|
|
43
36
|
}
|