@gaossr/kiri 0.1.6 → 0.1.9-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
@@ -1,8 +1,8 @@
1
1
  # Kiri npm Packaging
2
2
 
3
- This directory packages Kiri for npm with precompiled macOS binaries.
3
+ This directory packages Kiri for npm with precompiled macOS, Linux x64, and Windows x64 binaries.
4
4
 
5
- After the npm package is published, users install it with:
5
+ Users install it with:
6
6
 
7
7
  ```bash
8
8
  npm install -g @gaossr/kiri
@@ -21,7 +21,9 @@ Root package optional dependencies:
21
21
  ```json
22
22
  {
23
23
  "@gaossr/kiri-darwin-arm64": "npm:@gaossr/kiri@<version>-darwin-arm64",
24
- "@gaossr/kiri-darwin-x64": "npm:@gaossr/kiri@<version>-darwin-x64"
24
+ "@gaossr/kiri-darwin-x64": "npm:@gaossr/kiri@<version>-darwin-x64",
25
+ "@gaossr/kiri-linux-x64": "npm:@gaossr/kiri@<version>-linux-x64",
26
+ "@gaossr/kiri-win32-x64": "npm:@gaossr/kiri@<version>-win32-x64"
25
27
  }
26
28
  ```
27
29
 
@@ -33,6 +35,10 @@ vendor/
33
35
  ports
34
36
  darwin-x64/
35
37
  ports
38
+ linux-x64/
39
+ ports
40
+ win32-x64/
41
+ ports.exe
36
42
  ```
37
43
 
38
44
  If the matching binary is missing, the shim prints a clear error explaining that the npm package artifacts are missing and should be reinstalled.
@@ -49,15 +55,33 @@ Build release tarballs from GitHub Release assets:
49
55
 
50
56
  ```bash
51
57
  node scripts/build-packages.js \
52
- --version 0.1.6 \
58
+ --version 0.1.9 \
53
59
  --release-dir ../../dist \
54
60
  --output-dir ../../dist/npm
55
61
  ```
56
62
 
57
- Publish order, after verifying tarball contents and npm authentication:
63
+ Publishing uses npm Trusted Publishing through GitHub Actions OIDC. Do not store
64
+ `NPM_TOKEN` in GitHub Actions secrets for the normal release path.
65
+
66
+ Required npm trusted publisher configuration for `@gaossr/kiri`:
67
+
68
+ - Provider: GitHub Actions
69
+ - Repository: `GaoSSR/kiri`
70
+ - Workflow filename: `npm-publish.yml`
71
+ - Allowed action: `npm publish`
72
+
73
+ The equivalent npm CLI setup command is:
74
+
75
+ ```bash
76
+ npm trust github @gaossr/kiri --file npm-publish.yml --repo GaoSSR/kiri --allow-publish
77
+ ```
78
+
79
+ This requires npm CLI 11.10.0 or newer, write access to `@gaossr/kiri`, and
80
+ 2FA enabled on the npm account.
81
+
82
+ After the Release workflow has uploaded and checksummed the npm tarballs, publish
83
+ the already-built artifacts with:
58
84
 
59
85
  ```bash
60
- npm publish ../../dist/npm/kiri-npm-darwin-arm64-0.1.6.tgz --tag darwin-arm64 --access public --registry https://registry.npmjs.org/
61
- npm publish ../../dist/npm/kiri-npm-darwin-x64-0.1.6.tgz --tag darwin-x64 --access public --registry https://registry.npmjs.org/
62
- npm publish ../../dist/npm/kiri-npm-0.1.6.tgz --access public --registry https://registry.npmjs.org/
86
+ gh workflow run "Publish npm" --repo GaoSSR/kiri --ref main -f version=<version>
63
87
  ```
package/package.json CHANGED
@@ -1,27 +1,25 @@
1
1
  {
2
2
  "name": "@gaossr/kiri",
3
- "version": "0.1.6",
4
- "description": "Kiri CLI for inspecting local development ports; installs the ports command",
3
+ "version": "0.1.9-darwin-x64",
4
+ "description": "Kiri CLI for inspecting local development ports; installs the ports command (darwin-x64)",
5
5
  "license": "Apache-2.0",
6
- "bin": {
7
- "ports": "./bin/ports.js"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/GaoSSR/kiri.git",
12
- "directory": "packaging/npm"
13
- },
6
+ "os": [
7
+ "darwin"
8
+ ],
9
+ "cpu": [
10
+ "x64"
11
+ ],
14
12
  "files": [
15
13
  "LICENSE",
16
14
  "README.md",
17
- "bin/",
18
- "lib/"
15
+ "vendor/"
19
16
  ],
20
- "optionalDependencies": {
21
- "@gaossr/kiri-darwin-arm64": "npm:@gaossr/kiri@0.1.6-darwin-arm64",
22
- "@gaossr/kiri-darwin-x64": "npm:@gaossr/kiri@0.1.6-darwin-x64"
23
- },
24
17
  "engines": {
25
18
  "node": ">=18"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/GaoSSR/kiri.git",
23
+ "directory": "packaging/npm"
26
24
  }
27
25
  }
Binary file
package/bin/ports.js DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { runBinary } = require("../lib/resolve-binary");
4
-
5
- runBinary("ports");
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("node:fs");
4
- const path = require("node:path");
5
- const { spawnSync } = require("node:child_process");
6
-
7
- const PLATFORM_PACKAGES = {
8
- "darwin-arm64": "@gaossr/kiri-darwin-arm64",
9
- "darwin-x64": "@gaossr/kiri-darwin-x64",
10
- };
11
-
12
- function platformKey(runtime = process) {
13
- const platform = runtime.platform;
14
- const arch = runtime.arch;
15
-
16
- if (platform === "darwin" && arch === "arm64") {
17
- return "darwin-arm64";
18
- }
19
- if (platform === "darwin" && arch === "x64") {
20
- return "darwin-x64";
21
- }
22
- if (platform === "linux" && arch === "x64") {
23
- return "linux-x64";
24
- }
25
- if (platform === "win32" && arch === "x64") {
26
- return "win32-x64";
27
- }
28
-
29
- return `${platform}-${arch}`;
30
- }
31
-
32
- function binaryName(command) {
33
- return process.platform === "win32" ? `${command}.exe` : command;
34
- }
35
-
36
- function platformPackageName(key) {
37
- return PLATFORM_PACKAGES[key];
38
- }
39
-
40
- function binaryPath(command, options = {}) {
41
- const packageRoot = options.packageRoot || path.join(__dirname, "..");
42
- const runtime = options.runtime || process;
43
- return path.join(packageRoot, "vendor", platformKey(runtime), binaryName(command));
44
- }
45
-
46
- function platformPackageBinaryPath(packageRoot, key, command) {
47
- return path.join(packageRoot, "vendor", key, binaryName(command));
48
- }
49
-
50
- function resolveBinary(command, options = {}) {
51
- const runtime = options.runtime || process;
52
- const key = platformKey(runtime);
53
- const platformPackage = platformPackageName(key);
54
-
55
- if (!platformPackage) {
56
- return null;
57
- }
58
-
59
- const requireFn = options.requireFn || require;
60
- try {
61
- const packageJsonPath = requireFn.resolve(`${platformPackage}/package.json`);
62
- const resolved = platformPackageBinaryPath(
63
- path.dirname(packageJsonPath),
64
- key,
65
- command
66
- );
67
- if (fs.existsSync(resolved)) {
68
- return resolved;
69
- }
70
- } catch {
71
- // Fall back to local vendor for staged-package verification.
72
- }
73
-
74
- const localBinary = binaryPath(command, options);
75
- if (fs.existsSync(localBinary)) {
76
- return localBinary;
77
- }
78
-
79
- return null;
80
- }
81
-
82
- function runBinary(command) {
83
- const key = platformKey();
84
- const resolved = resolveBinary(command);
85
-
86
- if (!platformPackageName(key)) {
87
- console.error(
88
- [
89
- `Kiri does not have a bundled binary for ${key}.`,
90
- "macOS is supported first; Linux and Windows packages will be added after their collectors ship.",
91
- "This npm package does not compile Rust locally and does not require Cargo.",
92
- ].join("\n")
93
- );
94
- process.exit(1);
95
- }
96
-
97
- if (!resolved || !fs.existsSync(resolved)) {
98
- console.error(
99
- [
100
- `Kiri npm package artifacts are missing for ${key}.`,
101
- "Reinstall Kiri with: npm install -g @gaossr/kiri@latest",
102
- "The npm package uses precompiled release binaries and does not compile Rust locally.",
103
- "This npm package does not compile Rust locally and does not require Cargo.",
104
- ].join("\n")
105
- );
106
- process.exit(1);
107
- }
108
-
109
- const result = spawnSync(resolved, process.argv.slice(2), {
110
- stdio: "inherit",
111
- });
112
-
113
- if (result.error) {
114
- console.error(result.error.message);
115
- process.exit(1);
116
- }
117
-
118
- process.exit(result.status ?? 1);
119
- }
120
-
121
- module.exports = {
122
- binaryPath,
123
- platformPackageName,
124
- platformKey,
125
- resolveBinary,
126
- runBinary,
127
- };