@wordbricks/velen 0.1.3 → 0.1.4-darwin-x64

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 CHANGED
@@ -34,10 +34,13 @@ Install:
34
34
  - `bun install -g @wordbricks/velen`
35
35
  - `bunx @wordbricks/velen --help`
36
36
  - `npx @wordbricks/velen --help`
37
+ - Linux npm installs ship musl-linked binaries so the CLI runs on both glibc and musl-based distributions, including Alpine.
38
+ - Windows npm installs ship both x64 and arm64 platform binaries.
37
39
 
38
40
  Release:
39
41
 
40
42
  - Keep `apps/cli/package.json` and `apps/cli/crates/velen-cli/Cargo.toml` on the same version.
41
43
  - Configure npm trusted publishing for `@wordbricks/velen` with GitHub Actions using the workflow filename `cli-release.yml`.
42
44
  - Push a tag like `cli-v0.1.0` or `cli-v0.1.0-alpha.1`.
43
- - The `cli-release` workflow builds platform binaries, stages npm tarballs, creates a GitHub release, and publishes them to npm with `npm publish --provenance`.
45
+ - The `cli-release` workflow builds GNU and musl Linux binaries plus the other platform binaries, stages npm tarballs, creates a GitHub release, and publishes them to npm with `npm publish --provenance`.
46
+ - Linux npm platform tarballs are staged from musl artifacts for the broadest runtime compatibility.
package/package.json CHANGED
@@ -1,32 +1,27 @@
1
1
  {
2
2
  "name": "@wordbricks/velen",
3
- "version": "0.1.3",
3
+ "version": "0.1.4-darwin-x64",
4
4
  "description": "Velen CLI",
5
5
  "license": "Apache-2.0",
6
- "type": "module",
7
- "bin": {
8
- "velen": "bin/velen.js"
9
- },
6
+ "os": [
7
+ "darwin"
8
+ ],
9
+ "cpu": [
10
+ "x64"
11
+ ],
10
12
  "files": [
11
- "bin",
13
+ "vendor",
12
14
  "README.md"
13
15
  ],
14
- "engines": {
15
- "node": ">=18"
16
- },
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
16
  "repository": {
21
17
  "type": "git",
22
18
  "url": "git+https://github.com/wordbricks/velen.git",
23
19
  "directory": "apps/cli"
24
20
  },
25
- "optionalDependencies": {
26
- "velen-linux-x64": "npm:@wordbricks/velen@0.1.3-linux-x64",
27
- "velen-linux-arm64": "npm:@wordbricks/velen@0.1.3-linux-arm64",
28
- "velen-darwin-x64": "npm:@wordbricks/velen@0.1.3-darwin-x64",
29
- "velen-darwin-arm64": "npm:@wordbricks/velen@0.1.3-darwin-arm64",
30
- "velen-win32-x64": "npm:@wordbricks/velen@0.1.3-win32-x64"
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "engines": {
25
+ "node": ">=18"
31
26
  }
32
27
  }
package/bin/velen.js DELETED
@@ -1,176 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawn } from "node:child_process";
4
- import { chmodSync, existsSync, statSync } from "node:fs";
5
- import { createRequire } from "node:module";
6
- import path from "node:path";
7
- import { fileURLToPath } from "node:url";
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = path.dirname(__filename);
11
- const require = createRequire(import.meta.url);
12
-
13
- const CLI_PACKAGE_NAME = "@wordbricks/velen";
14
- const PLATFORM_PACKAGE_BY_TARGET = {
15
- "x86_64-unknown-linux-gnu": "velen-linux-x64",
16
- "aarch64-unknown-linux-gnu": "velen-linux-arm64",
17
- "x86_64-apple-darwin": "velen-darwin-x64",
18
- "aarch64-apple-darwin": "velen-darwin-arm64",
19
- "x86_64-pc-windows-msvc": "velen-win32-x64",
20
- };
21
-
22
- const { platform, arch } = process;
23
-
24
- let targetTriple = null;
25
- switch (platform) {
26
- case "linux":
27
- case "android":
28
- switch (arch) {
29
- case "x64":
30
- targetTriple = "x86_64-unknown-linux-gnu";
31
- break;
32
- case "arm64":
33
- targetTriple = "aarch64-unknown-linux-gnu";
34
- break;
35
- default:
36
- break;
37
- }
38
- break;
39
- case "darwin":
40
- switch (arch) {
41
- case "x64":
42
- targetTriple = "x86_64-apple-darwin";
43
- break;
44
- case "arm64":
45
- targetTriple = "aarch64-apple-darwin";
46
- break;
47
- default:
48
- break;
49
- }
50
- break;
51
- case "win32":
52
- if (arch === "x64") {
53
- targetTriple = "x86_64-pc-windows-msvc";
54
- }
55
- break;
56
- default:
57
- break;
58
- }
59
-
60
- if (!targetTriple) {
61
- throw new Error(`Unsupported platform: ${platform} (${arch})`);
62
- }
63
-
64
- const platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
65
- if (!platformPackage) {
66
- throw new Error(`Unsupported target triple: ${targetTriple}`);
67
- }
68
-
69
- // CONTEXT: platform packages are installed through npm alias names so the
70
- // launcher resolves the alias folder, not the underlying published package id.
71
- const binaryName = platform === "win32" ? "velen.exe" : "velen";
72
- const localVendorRoot = path.join(__dirname, "..", "vendor");
73
- const localBinaryPath = path.join(
74
- localVendorRoot,
75
- targetTriple,
76
- "velen",
77
- binaryName,
78
- );
79
-
80
- let vendorRoot;
81
- try {
82
- const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
83
- vendorRoot = path.join(path.dirname(packageJsonPath), "vendor");
84
- } catch {
85
- if (existsSync(localBinaryPath)) {
86
- vendorRoot = localVendorRoot;
87
- } else {
88
- const packageManager = detectPackageManager();
89
- const reinstallCommand =
90
- packageManager === "bun"
91
- ? `bun install -g ${CLI_PACKAGE_NAME}@latest`
92
- : `npm install -g ${CLI_PACKAGE_NAME}@latest`;
93
- throw new Error(
94
- `Missing optional dependency ${platformPackage}. Reinstall Velen CLI: ${reinstallCommand}`,
95
- );
96
- }
97
- }
98
-
99
- const binaryPath = path.join(vendorRoot, targetTriple, "velen", binaryName);
100
-
101
- if (platform !== "win32") {
102
- ensureExecutable(binaryPath);
103
- }
104
-
105
- const child = spawn(binaryPath, process.argv.slice(2), {
106
- stdio: "inherit",
107
- env: process.env,
108
- });
109
-
110
- child.on("error", (error) => {
111
- console.error(error);
112
- process.exit(1);
113
- });
114
-
115
- const forwardSignal = (signal) => {
116
- if (child.killed) {
117
- return;
118
- }
119
-
120
- try {
121
- child.kill(signal);
122
- } catch {}
123
- };
124
-
125
- ["SIGINT", "SIGTERM", "SIGHUP"].forEach((signal) => {
126
- process.on(signal, () => forwardSignal(signal));
127
- });
128
-
129
- const childResult = await new Promise((resolve) => {
130
- child.on("exit", (code, signal) => {
131
- if (signal) {
132
- resolve({ type: "signal", signal });
133
- return;
134
- }
135
-
136
- resolve({ type: "code", exitCode: code ?? 1 });
137
- });
138
- });
139
-
140
- if (childResult.type === "signal") {
141
- process.kill(process.pid, childResult.signal);
142
- } else {
143
- process.exit(childResult.exitCode);
144
- }
145
-
146
- function detectPackageManager() {
147
- const userAgent = process.env.npm_config_user_agent ?? "";
148
- if (/\bbun\//.test(userAgent)) {
149
- return "bun";
150
- }
151
-
152
- const execPath = process.env.npm_execpath ?? "";
153
- if (execPath.includes("bun")) {
154
- return "bun";
155
- }
156
-
157
- if (
158
- __dirname.includes(".bun/install/global") ||
159
- __dirname.includes(".bun\\install\\global")
160
- ) {
161
- return "bun";
162
- }
163
-
164
- return userAgent ? "npm" : null;
165
- }
166
-
167
- function ensureExecutable(filePath) {
168
- const currentMode = statSync(filePath).mode & 0o777;
169
- if ((currentMode & 0o111) !== 0) {
170
- return;
171
- }
172
-
173
- // CONTEXT: npm tarballs store vendored native binaries without execute bits,
174
- // so restore the expected mode before spawning the packaged CLI binary.
175
- chmodSync(filePath, currentMode | 0o755);
176
- }