@nnova/runner 0.0.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/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @nova/runner
2
+
3
+ 跨平台发布的 `nova-runner` Rust 可执行文件。该包只负责选择并启动当前平台的
4
+ 二进制,Runner 的 gRPC、执行、取消和 workspace 行为仍全部实现于
5
+ `crates/runner`。
6
+
7
+ ## 使用
8
+
9
+ ```bash
10
+ pnpm add @nnova/runner
11
+ npx --yes --package @nnova/runner nova-runner --server http://127.0.0.1:50051 --token <runner-token> --workspace ./project
12
+ ```
13
+
14
+ 使用上面的 `npx --package` 方式时不需要先执行 `npm install`;npx 会按需获取并缓存
15
+ `@nnova/runner`。如果希望固定安装到项目依赖中,也可以执行 `npm install @nnova/runner`,
16
+ 之后直接运行 `npx nova-runner`。
17
+
18
+ 支持 Linux x64、macOS x64、macOS arm64 和 Windows x64。开发或自定义构建时可用
19
+ `NOVA_RUNNER_BIN` 指定二进制路径:
20
+
21
+ ```bash
22
+ NOVA_RUNNER_BIN=/path/to/nova-runner npx --yes --package @nnova/runner nova-runner --help
23
+ ```
24
+
25
+ Windows PowerShell:
26
+
27
+ ```powershell
28
+ $env:NOVA_RUNNER_BIN = 'E:\path\to\nova-runner.exe'
29
+ npx --yes --package @nnova/runner nova-runner --help
30
+ ```
31
+
32
+ 这个包不是 `@nova/runner-sdk` 的替代品,也不在 Node.js 中执行命令;它只是把已构建
33
+ 的 Rust binary 作为 npm 可安装物分发。发布包由 CI 在各自平台构建后合并生成。
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { accessSync, constants } from "node:fs";
4
+ import { platform, arch } from "node:process";
5
+ import { spawn } from "node:child_process";
6
+ import { dirname, join } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+
9
+ const target = `${platform}-${arch}`;
10
+ const extension = platform === "win32" ? ".exe" : "";
11
+ const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
12
+ const binary = process.env.NOVA_RUNNER_BIN ?? join(packageRoot, "vendor", target, `nova-runner${extension}`);
13
+
14
+ try {
15
+ accessSync(binary, constants.X_OK);
16
+ } catch {
17
+ console.error(`@nova/runner: no nova-runner binary is available for ${target}.`);
18
+ console.error(`Expected: ${binary}`);
19
+ console.error("Install a package version containing this platform or set NOVA_RUNNER_BIN to a compatible binary.");
20
+ process.exit(1);
21
+ }
22
+
23
+ const child = spawn(binary, process.argv.slice(2), { stdio: "inherit", windowsHide: false });
24
+ child.on("error", (error) => {
25
+ console.error(`@nova/runner: failed to start ${binary}: ${error.message}`);
26
+ process.exit(1);
27
+ });
28
+ child.on("exit", (code, signal) => {
29
+ if (signal !== null) {
30
+ process.kill(process.pid, signal);
31
+ } else {
32
+ process.exit(code ?? 1);
33
+ }
34
+ });
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@nnova/runner",
3
+ "version": "0.0.2",
4
+ "description": "Cross-platform nova-runner binary distribution",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "bin": {
8
+ "nova-runner": "bin/nova-runner.mjs"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "vendor"
13
+ ],
14
+ "scripts": {
15
+ "stage": "node scripts/stage.mjs",
16
+ "prepack": "node scripts/check-package.mjs",
17
+ "typecheck": "node --check bin/nova-runner.mjs && node --check scripts/stage.mjs && node --check scripts/check-package.mjs"
18
+ },
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ }
25
+ }
Binary file
Binary file
Binary file
Binary file