typeslayer 0.1.1 → 0.1.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/README.md +1 -1
- package/bin/typeslayer.js +19 -6
- package/package.json +1 -2
- package/scripts/postinstall.js +8 -4
package/README.md
CHANGED
package/bin/typeslayer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawn } from "node:child_process";
|
|
3
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { arch, platform } from "node:os";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
@@ -45,11 +45,24 @@ try {
|
|
|
45
45
|
const binaryInfo = getBinaryInfo();
|
|
46
46
|
|
|
47
47
|
if (!existsSync(binaryInfo.path)) {
|
|
48
|
-
console.error(`\n
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
console.error(`\n⚠️ Binary not found for ${binaryInfo.platform}. Attempting download...`);
|
|
49
|
+
const postinstallPath = join(__dirname, "..", "scripts", "postinstall.js");
|
|
50
|
+
const res = spawnSync(process.execPath, [postinstallPath], {
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
env: process.env,
|
|
53
|
+
});
|
|
54
|
+
if (res.status !== 0) {
|
|
55
|
+
console.error("\n❌ Failed to download platform binary.");
|
|
56
|
+
}
|
|
57
|
+
if (!existsSync(binaryInfo.path)) {
|
|
58
|
+
console.error(
|
|
59
|
+
`\n❌ Binary still unavailable at ${binaryInfo.path}. Please check the release assets or your network.`,
|
|
60
|
+
);
|
|
61
|
+
console.error(
|
|
62
|
+
"You can manually download from: https://github.com/dimitropoulos/typeslayer/releases",
|
|
63
|
+
);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
const proc = spawn(binaryInfo.path, [], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typeslayer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Slay your TypeScript types",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"bin",
|
|
30
|
-
"binaries",
|
|
31
30
|
"scripts"
|
|
32
31
|
],
|
|
33
32
|
"os": [
|
package/scripts/postinstall.js
CHANGED
|
@@ -15,26 +15,30 @@ const getBinaryInfo = () => {
|
|
|
15
15
|
const plat = platform();
|
|
16
16
|
const architecture = arch();
|
|
17
17
|
|
|
18
|
-
let platformDir, binaryName;
|
|
18
|
+
let platformDir, binaryName, releaseAssetName;
|
|
19
19
|
|
|
20
20
|
if (plat === "linux" && architecture === "x64") {
|
|
21
21
|
platformDir = "linux-x64";
|
|
22
22
|
binaryName = "typeslayer";
|
|
23
|
+
releaseAssetName = "typeslayer-linux-x64";
|
|
23
24
|
} else if (plat === "darwin" && architecture === "x64") {
|
|
24
25
|
platformDir = "darwin-x64";
|
|
25
26
|
binaryName = "typeslayer";
|
|
27
|
+
releaseAssetName = "typeslayer-darwin-x64";
|
|
26
28
|
} else if (plat === "darwin" && architecture === "arm64") {
|
|
27
29
|
platformDir = "darwin-arm64";
|
|
28
30
|
binaryName = "typeslayer";
|
|
31
|
+
releaseAssetName = "typeslayer-darwin-arm64";
|
|
29
32
|
} else if (plat === "win32" && architecture === "x64") {
|
|
30
33
|
platformDir = "win32-x64";
|
|
31
34
|
binaryName = "typeslayer.exe";
|
|
35
|
+
releaseAssetName = "typeslayer-win32-x64.exe";
|
|
32
36
|
} else {
|
|
33
37
|
console.warn(`⚠️ Platform ${plat}-${architecture} is not supported`);
|
|
34
38
|
process.exit(0); // Don't fail the install, just skip
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
return { platformDir, binaryName };
|
|
41
|
+
return { platformDir, binaryName, releaseAssetName };
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
const downloadBinary = (url, destPath) => {
|
|
@@ -83,7 +87,7 @@ const downloadBinary = (url, destPath) => {
|
|
|
83
87
|
|
|
84
88
|
(async () => {
|
|
85
89
|
try {
|
|
86
|
-
const { platformDir, binaryName } = getBinaryInfo();
|
|
90
|
+
const { platformDir, binaryName, releaseAssetName } = getBinaryInfo();
|
|
87
91
|
const binariesDir = join(__dirname, "..", "binaries", platformDir);
|
|
88
92
|
const binaryPath = join(binariesDir, binaryName);
|
|
89
93
|
|
|
@@ -97,7 +101,7 @@ const downloadBinary = (url, destPath) => {
|
|
|
97
101
|
mkdirSync(binariesDir, { recursive: true });
|
|
98
102
|
|
|
99
103
|
// Download from GitHub release
|
|
100
|
-
const releaseUrl = `https://github.com/dimitropoulos/typeslayer/releases/download/typeslayer-v${PACKAGE_VERSION}/${
|
|
104
|
+
const releaseUrl = `https://github.com/dimitropoulos/typeslayer/releases/download/typeslayer-v${PACKAGE_VERSION}/${releaseAssetName}`;
|
|
101
105
|
|
|
102
106
|
await downloadBinary(releaseUrl, binaryPath);
|
|
103
107
|
} catch (error) {
|