tsgonest 0.4.1 → 0.4.2
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/tsgonest +70 -0
- package/package.json +9 -9
package/bin/tsgonest
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Launcher script for the tsgonest binary.
|
|
5
|
+
// Locates the platform-specific binary from @tsgonest/cli-<platform> and
|
|
6
|
+
// executes it with the same arguments. Follows the esbuild pattern.
|
|
7
|
+
|
|
8
|
+
const { execFileSync } = require("child_process");
|
|
9
|
+
const { existsSync } = require("fs");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
const PLATFORMS = {
|
|
13
|
+
"darwin-arm64": { pkg: "@tsgonest/cli-darwin-arm64", bin: "tsgonest" },
|
|
14
|
+
"darwin-x64": { pkg: "@tsgonest/cli-darwin-x64", bin: "tsgonest" },
|
|
15
|
+
"linux-x64": { pkg: "@tsgonest/cli-linux-x64", bin: "tsgonest" },
|
|
16
|
+
"linux-arm64": { pkg: "@tsgonest/cli-linux-arm64", bin: "tsgonest" },
|
|
17
|
+
"win32-x64": { pkg: "@tsgonest/cli-win32-x64", bin: "tsgonest.exe" },
|
|
18
|
+
"win32-arm64": { pkg: "@tsgonest/cli-win32-arm64", bin: "tsgonest.exe" },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function getBinaryPath() {
|
|
22
|
+
// 1. Check TSGONEST_BINARY_PATH environment variable (override)
|
|
23
|
+
if (process.env.TSGONEST_BINARY_PATH) {
|
|
24
|
+
return process.env.TSGONEST_BINARY_PATH;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 2. Check for a locally-built binary (development: go build -o packages/core/bin/tsgonest-native)
|
|
28
|
+
const localBinary = path.join(__dirname, "tsgonest-native");
|
|
29
|
+
if (existsSync(localBinary)) {
|
|
30
|
+
return localBinary;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 3. Resolve from platform-specific optional dependency
|
|
34
|
+
const entry = PLATFORMS[`${process.platform}-${process.arch}`];
|
|
35
|
+
if (!entry) {
|
|
36
|
+
console.error(
|
|
37
|
+
`tsgonest: unsupported platform ${process.platform}-${process.arch}\n` +
|
|
38
|
+
`No pre-built binary is available for this platform.`
|
|
39
|
+
);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
return require.resolve(`${entry.pkg}/bin/${entry.bin}`);
|
|
45
|
+
} catch {
|
|
46
|
+
console.error(
|
|
47
|
+
`tsgonest: could not find binary package ${entry.pkg}\n` +
|
|
48
|
+
`Make sure it is installed. You may need to run "npm install" or "pnpm install".`
|
|
49
|
+
);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const binPath = getBinaryPath();
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
execFileSync(binPath, process.argv.slice(2), {
|
|
58
|
+
stdio: "inherit",
|
|
59
|
+
env: process.env,
|
|
60
|
+
});
|
|
61
|
+
} catch (err) {
|
|
62
|
+
// execFileSync throws on non-zero exit code — forward it
|
|
63
|
+
if (err.status != null) {
|
|
64
|
+
process.exit(err.status);
|
|
65
|
+
}
|
|
66
|
+
// Actual execution error (binary missing, permission denied, etc.)
|
|
67
|
+
console.error(`tsgonest: failed to execute ${binPath}`);
|
|
68
|
+
console.error(err.message);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsgonest",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "TypeScript compiler with runtime validation, serialization, and OpenAPI generation for NestJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"jsonc-parser": "^3.3.1",
|
|
35
|
-
"@tsgonest/
|
|
36
|
-
"@tsgonest/
|
|
35
|
+
"@tsgonest/runtime": "0.4.2",
|
|
36
|
+
"@tsgonest/types": "0.4.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"ts-morph": "^25.0.0",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"vitest": "^4.0.0"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@tsgonest/cli-darwin-
|
|
46
|
-
"@tsgonest/cli-darwin-
|
|
47
|
-
"@tsgonest/cli-linux-
|
|
48
|
-
"@tsgonest/cli-
|
|
49
|
-
"@tsgonest/cli-
|
|
50
|
-
"@tsgonest/cli-win32-x64": "0.4.
|
|
45
|
+
"@tsgonest/cli-darwin-x64": "0.4.2",
|
|
46
|
+
"@tsgonest/cli-darwin-arm64": "0.4.2",
|
|
47
|
+
"@tsgonest/cli-linux-arm64": "0.4.2",
|
|
48
|
+
"@tsgonest/cli-linux-x64": "0.4.2",
|
|
49
|
+
"@tsgonest/cli-win32-arm64": "0.4.2",
|
|
50
|
+
"@tsgonest/cli-win32-x64": "0.4.2"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsdown",
|