@tsonic/tsbindgen 0.7.4 → 0.7.5
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/{postinstall.js → bin.js} +9 -23
- package/package.json +4 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
4
5
|
import { dirname, join } from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
|
|
@@ -20,8 +21,8 @@ const findBinary = () => {
|
|
|
20
21
|
const packageName = PLATFORMS[key];
|
|
21
22
|
|
|
22
23
|
if (!packageName) {
|
|
23
|
-
console.error(`
|
|
24
|
-
console.error("
|
|
24
|
+
console.error(`Unsupported platform: ${key}`);
|
|
25
|
+
console.error("tsbindgen supports: darwin-arm64, darwin-x64, linux-arm64, linux-x64");
|
|
25
26
|
process.exit(1);
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -43,29 +44,14 @@ const findBinary = () => {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
console.error(`
|
|
47
|
+
console.error(`Could not find tsbindgen binary for ${key}`);
|
|
47
48
|
console.error(`Package @tsonic/${packageName} may not be installed.`);
|
|
48
49
|
process.exit(1);
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
// Create bin directory if needed
|
|
52
|
-
const binDir = join(__dirname, "bin");
|
|
53
|
-
if (!existsSync(binDir)) {
|
|
54
|
-
mkdirSync(binDir);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Find the platform binary
|
|
58
52
|
const binaryPath = findBinary();
|
|
53
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
54
|
+
stdio: "inherit",
|
|
55
|
+
});
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
const symlinkPath = join(binDir, "tsbindgen");
|
|
62
|
-
|
|
63
|
-
// Remove existing symlink if present
|
|
64
|
-
if (existsSync(symlinkPath)) {
|
|
65
|
-
unlinkSync(symlinkPath);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
symlinkSync(binaryPath, symlinkPath);
|
|
69
|
-
chmodSync(symlinkPath, 0o755);
|
|
70
|
-
|
|
71
|
-
console.log(`tsbindgen: Linked to ${binaryPath}`);
|
|
57
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsonic/tsbindgen",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "Generate TypeScript declarations from .NET assemblies",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"tsbindgen": "./bin
|
|
7
|
+
"tsbindgen": "./bin.js"
|
|
8
8
|
},
|
|
9
9
|
"main": "./index.js",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./index.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"
|
|
14
|
+
"bin.js",
|
|
15
15
|
"index.js",
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "./scripts/build-native.sh"
|
|
20
|
-
"postinstall": "node postinstall.js"
|
|
19
|
+
"build": "./scripts/build-native.sh"
|
|
21
20
|
},
|
|
22
21
|
"optionalDependencies": {
|
|
23
22
|
"@tsonic/tsbindgen-darwin-arm64": "0.7.4",
|