tsgonest 0.2.0 → 0.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.
Files changed (3) hide show
  1. package/bin/tsgonest +0 -0
  2. package/package.json +12 -11
  3. package/install.js +0 -92
package/bin/tsgonest CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsgonest",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "description": "TypeScript compiler with runtime validation, serialization, and OpenAPI generation for NestJS",
5
5
  "keywords": [
6
6
  "typescript",
@@ -16,21 +16,22 @@
16
16
  "type": "git",
17
17
  "url": "https://github.com/tsgonest/tsgonest"
18
18
  },
19
+ "files": [
20
+ "bin/"
21
+ ],
19
22
  "bin": {
20
23
  "tsgonest": "bin/tsgonest"
21
24
  },
22
25
  "dependencies": {
23
- "@tsgonest/runtime": "0.2.0",
24
- "@tsgonest/types": "0.2.0"
26
+ "@tsgonest/types": "0.2.3",
27
+ "@tsgonest/runtime": "0.2.3"
25
28
  },
26
29
  "optionalDependencies": {
27
- "@tsgonest/cli-darwin-arm64": "0.2.0",
28
- "@tsgonest/cli-darwin-x64": "0.2.0",
29
- "@tsgonest/cli-linux-x64": "0.2.0",
30
- "@tsgonest/cli-linux-arm64": "0.2.0",
31
- "@tsgonest/cli-win32-x64": "0.2.0"
32
- },
33
- "scripts": {
34
- "postinstall": "node install.js"
30
+ "@tsgonest/cli-darwin-arm64": "0.2.3",
31
+ "@tsgonest/cli-darwin-x64": "0.2.3",
32
+ "@tsgonest/cli-win32-arm64": "0.2.3",
33
+ "@tsgonest/cli-linux-arm64": "0.2.3",
34
+ "@tsgonest/cli-linux-x64": "0.2.3",
35
+ "@tsgonest/cli-win32-x64": "0.2.3"
35
36
  }
36
37
  }
package/install.js DELETED
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- /**
5
- * Postinstall script for the `tsgonest` npm package.
6
- *
7
- * Production (npm publish):
8
- * Copies the pre-built Go binary from the matching @tsgonest/cli-<platform>
9
- * optional dependency into bin/tsgonest (or bin/tsgonest.exe on Windows).
10
- *
11
- * Development (pnpm workspace / local build):
12
- * The cli-* packages don't ship a real binary in source — CI populates them
13
- * before publishing. If the binary can't be found the script warns and exits
14
- * cleanly so workspace installs don't fail.
15
- *
16
- * Build the binary manually for local development:
17
- * go build -o packages/core/bin/tsgonest ./cmd/tsgonest
18
- */
19
-
20
- const { existsSync, mkdirSync, copyFileSync, chmodSync } = require("fs");
21
- const { join } = require("path");
22
-
23
- const PLATFORMS = {
24
- "darwin-arm64": { pkg: "@tsgonest/cli-darwin-arm64", bin: "tsgonest" },
25
- "darwin-x64": { pkg: "@tsgonest/cli-darwin-x64", bin: "tsgonest" },
26
- "linux-x64": { pkg: "@tsgonest/cli-linux-x64", bin: "tsgonest" },
27
- "linux-arm64": { pkg: "@tsgonest/cli-linux-arm64", bin: "tsgonest" },
28
- "win32-x64": { pkg: "@tsgonest/cli-win32-x64", bin: "tsgonest.exe" },
29
- };
30
-
31
- function getPlatformEntry() {
32
- return PLATFORMS[`${process.platform}-${process.arch}`] || null;
33
- }
34
-
35
- /** True when running inside a pnpm workspace install (no real binaries yet). */
36
- function isWorkspaceDev() {
37
- return (
38
- typeof process.env.npm_config_user_agent === "string" &&
39
- process.env.npm_config_user_agent.startsWith("pnpm/")
40
- );
41
- }
42
-
43
- function install() {
44
- const entry = getPlatformEntry();
45
-
46
- if (!entry) {
47
- console.warn(
48
- `tsgonest: unsupported platform ${process.platform}-${process.arch} ` +
49
- `(no pre-built binary available)`
50
- );
51
- return; // don't hard-fail — library exports still work
52
- }
53
-
54
- const { pkg, bin } = entry;
55
- const binDir = join(__dirname, "bin");
56
- const dest = join(binDir, bin);
57
-
58
- // If a binary is already present (e.g. dev built via `go build`) leave it.
59
- if (existsSync(dest)) {
60
- return;
61
- }
62
-
63
- try {
64
- // require.resolve resolves the exact file path inside the npm package.
65
- // bin name must match what CI wrote: tsgonest on Unix, tsgonest.exe on Windows.
66
- const src = require.resolve(`${pkg}/bin/${bin}`);
67
-
68
- if (!existsSync(binDir)) {
69
- mkdirSync(binDir, { recursive: true });
70
- }
71
-
72
- copyFileSync(src, dest);
73
-
74
- if (process.platform !== "win32") {
75
- chmodSync(dest, 0o755);
76
- }
77
- } catch (err) {
78
- if (isWorkspaceDev()) {
79
- // Expected: cli-* packages have empty bin/ stubs until CI populates them.
80
- console.warn(
81
- "tsgonest: binary not found in workspace — build it with:\n" +
82
- " go build -o packages/core/bin/tsgonest ./cmd/tsgonest"
83
- );
84
- } else {
85
- console.error(`tsgonest: failed to install binary from ${pkg}`);
86
- console.error(err.message);
87
- process.exit(1);
88
- }
89
- }
90
- }
91
-
92
- install();