omnicrawl-cli 0.1.68 → 0.1.70

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/README.md +14 -2
  2. package/bin/omnicrawl.mjs +58 -57
  3. package/package.json +33 -27
package/README.md CHANGED
@@ -9,6 +9,7 @@ OmniCrawl 启动器:按 `platform-arch` 选包node_modules的内核二进制
9
9
  | --- | --- |
10
10
  | `omnicrawl-cli` | JS 启动器(`bin/omnicrawl.mjs`) |
11
11
  | `@omnicrawl/cli-linux-x64` | 内核二进制(Linux x64,musl 静态) |
12
+ | `@omnicrawl/cli-linux-arm-musl` | 内核二进制(Linux armv7,musl 静态,嵌入式目标) |
12
13
  | `@omnicrawl/cli-linux-arm64-musl` | 内核二进制(Linux arm64,嵌入式目标) |
13
14
  | `@omnicrawl/cli-win32-x64` | 内核二进制(Windows x64) |
14
15
 
@@ -31,12 +32,22 @@ OMNICRAWL_BINARY=/path/to/omnicrawl node packages/cli/bin/omnicrawl.mjs --versio
31
32
 
32
33
  ## 发布
33
34
 
34
- 1. 交叉编译三个平台(Linuxmusl 静态,嵌入式目标优先):
35
+ 手动发布前先 `npm login`(CI Trusted Publishing,无需登录与 token)。
36
+
37
+ 1. 交叉编译各平台(Linux 走 musl 静态,嵌入式目标优先):
35
38
 
36
39
  ```bash
37
40
  cargo build --release -p omnicrawl-cli --target x86_64-pc-windows-msvc
38
41
  cargo build --release -p omnicrawl-cli --target x86_64-unknown-linux-musl
39
42
  cargo build --release -p omnicrawl-cli --target aarch64-unknown-linux-musl
43
+ cargo build --release -p omnicrawl-cli --target armv7-unknown-linux-musleabihf
44
+ ```
45
+
46
+ 非 Linux 宿主没有 musl 链接器,Linux 目标改用 `cargo zigbuild`(需 `zig` 与
47
+ `rustup target add <triple>`):
48
+
49
+ ```bash
50
+ cargo zigbuild --release -p omnicrawl-cli --target armv7-unknown-linux-musleabihf
40
51
  ```
41
52
 
42
53
  2. 门槛检查(缺任何平台会失败并列出缺失平台):
@@ -49,6 +60,7 @@ OMNICRAWL_BINARY=/path/to/omnicrawl node packages/cli/bin/omnicrawl.mjs --versio
49
60
 
50
61
  ```bash
51
62
  npm publish dist/npm/cli-linux-x64
63
+ npm publish dist/npm/cli-linux-arm-musl
52
64
  npm publish dist/npm/cli-linux-arm64-musl
53
65
  npm publish dist/npm/cli-win32-x64
54
66
  npm publish dist/npm/cli
@@ -56,7 +68,7 @@ OMNICRAWL_BINARY=/path/to/omnicrawl node packages/cli/bin/omnicrawl.mjs --versio
56
68
 
57
69
  脚本跑完会把这几行命令直接打出来。
58
70
 
59
- 4. 版本reproducibility:四个包同版本;平台包只装二进制,升级它们就是换内核。
71
+ 4. 版本reproducibility:平台分包与启动器同版本;平台包只装二进制,升级它们就是换内核。
60
72
 
61
73
  ## 发布前自检
62
74
 
package/bin/omnicrawl.mjs CHANGED
@@ -1,58 +1,59 @@
1
1
  #!/usr/bin/env node
2
- // OmniCrawl 启动器:按 platform/arch 选出内核二进制并转交 stdio。
3
- //
4
- // 它不做任何协议转换——宿主直接与内核进程对话,启动器只是平台分包的解析器。
5
- import { spawn } from 'node:child_process'
6
- import { existsSync } from 'node:fs'
7
- import { createRequire } from 'node:module'
8
- import { dirname, join } from 'node:path'
9
- import process from 'node:process'
10
-
11
- const PLATFORM_PACKAGES = {
12
- 'linux-x64': '@omnicrawl/cli-linux-x64',
13
- 'linux-arm64': '@omnicrawl/cli-linux-arm64-musl',
14
- 'win32-x64': '@omnicrawl/cli-win32-x64',
15
- 'win32-ia32': '@omnicrawl/cli-win32-ia32',
16
- }
17
-
18
- function resolveBinary() {
19
- // 开发与测试用的逃生口:跳过分包直接指定二进制。
20
- if (process.env.OMNICRAWL_BINARY) return process.env.OMNICRAWL_BINARY
21
-
22
- const key = `${process.platform}-${process.arch}`
23
- const packageName = PLATFORM_PACKAGES[key]
24
- if (!packageName) {
25
- throw new Error(`不支持的平台 ${key};已支持:${Object.keys(PLATFORM_PACKAGES).join('、')}`)
26
- }
27
-
28
- const require = createRequire(import.meta.url)
29
- const packageRoot = dirname(require.resolve(`${packageName}/package.json`))
30
- const binary = join(packageRoot, 'bin', process.platform === 'win32' ? 'omnicrawl.exe' : 'omnicrawl')
31
- if (!existsSync(binary)) {
32
- throw new Error(`平台分包 ${packageName} 里没有二进制:${binary}\n请重装该包,或用 OMNICRAWL_BINARY 指定。`)
33
- }
34
- return binary
35
- }
36
-
37
- let binary
38
- try {
39
- binary = resolveBinary()
40
- } catch (error) {
41
- console.error(`omnicrawl:${error.message}`)
42
- process.exit(1)
43
- }
44
-
45
- const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' })
46
-
47
- child.on('error', (error) => {
48
- console.error(`omnicrawl:无法启动 ${binary}:${error.message}`)
49
- process.exit(1)
50
- })
51
-
52
- child.on('exit', (code, signal) => {
53
- if (signal) {
54
- console.error(`omnicrawl:内核被信号 ${signal} 终止`)
55
- process.exit(1)
56
- }
57
- process.exit(code ?? 0)
58
- })
2
+ // OmniCrawl 启动器:按 platform/arch 选出内核二进制并转交 stdio。
3
+ //
4
+ // 它不做任何协议转换——宿主直接与内核进程对话,启动器只是平台分包的解析器。
5
+ import { spawn } from 'node:child_process'
6
+ import { existsSync } from 'node:fs'
7
+ import { createRequire } from 'node:module'
8
+ import { dirname, join } from 'node:path'
9
+ import process from 'node:process'
10
+
11
+ const PLATFORM_PACKAGES = {
12
+ 'linux-x64': '@omnicrawl/cli-linux-x64',
13
+ 'linux-arm': '@omnicrawl/cli-linux-arm-musl',
14
+ 'linux-arm64': '@omnicrawl/cli-linux-arm64-musl',
15
+ 'win32-x64': '@omnicrawl/cli-win32-x64',
16
+ 'win32-ia32': '@omnicrawl/cli-win32-ia32',
17
+ }
18
+
19
+ function resolveBinary() {
20
+ // 开发与测试用的逃生口:跳过分包直接指定二进制。
21
+ if (process.env.OMNICRAWL_BINARY) return process.env.OMNICRAWL_BINARY
22
+
23
+ const key = `${process.platform}-${process.arch}`
24
+ const packageName = PLATFORM_PACKAGES[key]
25
+ if (!packageName) {
26
+ throw new Error(`不支持的平台 ${key};已支持:${Object.keys(PLATFORM_PACKAGES).join('、')}`)
27
+ }
28
+
29
+ const require = createRequire(import.meta.url)
30
+ const packageRoot = dirname(require.resolve(`${packageName}/package.json`))
31
+ const binary = join(packageRoot, 'bin', process.platform === 'win32' ? 'omnicrawl.exe' : 'omnicrawl')
32
+ if (!existsSync(binary)) {
33
+ throw new Error(`平台分包 ${packageName} 里没有二进制:${binary}\n请重装该包,或用 OMNICRAWL_BINARY 指定。`)
34
+ }
35
+ return binary
36
+ }
37
+
38
+ let binary
39
+ try {
40
+ binary = resolveBinary()
41
+ } catch (error) {
42
+ console.error(`omnicrawl:${error.message}`)
43
+ process.exit(1)
44
+ }
45
+
46
+ const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' })
47
+
48
+ child.on('error', (error) => {
49
+ console.error(`omnicrawl:无法启动 ${binary}:${error.message}`)
50
+ process.exit(1)
51
+ })
52
+
53
+ child.on('exit', (code, signal) => {
54
+ if (signal) {
55
+ console.error(`omnicrawl:内核被信号 ${signal} 终止`)
56
+ process.exit(1)
57
+ }
58
+ process.exit(code ?? 0)
59
+ })
package/package.json CHANGED
@@ -1,27 +1,33 @@
1
- {
2
- "name": "omnicrawl-cli",
3
- "version": "0.1.68",
4
- "description": "OmniCrawl 启动器:按平台选择内核二进制并转交 stdio",
5
- "type": "module",
6
- "bin": {
7
- "omnicrawl": "bin/omnicrawl.mjs"
8
- },
9
- "files": [
10
- "bin",
11
- "README.md"
12
- ],
13
- "engines": {
14
- "node": ">=20"
15
- },
16
- "scripts": {
17
- "test": "node --test",
18
- "prepare:binaries": "node scripts/prepare.mjs"
19
- },
20
- "license": "MIT",
21
- "optionalDependencies": {
22
- "@omnicrawl/cli-win32-x64": "0.1.68",
23
- "@omnicrawl/cli-win32-ia32": "0.1.68",
24
- "@omnicrawl/cli-linux-x64": "0.1.68",
25
- "@omnicrawl/cli-linux-arm64-musl": "0.1.68"
26
- }
27
- }
1
+ {
2
+ "name": "omnicrawl-cli",
3
+ "version": "0.1.70",
4
+ "description": "OmniCrawl 启动器:按平台选择内核二进制并转交 stdio",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/cccchiban/omnicrawl.git",
8
+ "directory": "packages/cli"
9
+ },
10
+ "type": "module",
11
+ "bin": {
12
+ "omnicrawl": "bin/omnicrawl.mjs"
13
+ },
14
+ "files": [
15
+ "bin",
16
+ "README.md"
17
+ ],
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "scripts": {
22
+ "test": "node --test",
23
+ "prepare:binaries": "node scripts/prepare.mjs"
24
+ },
25
+ "license": "MIT",
26
+ "optionalDependencies": {
27
+ "@omnicrawl/cli-win32-x64": "0.1.70",
28
+ "@omnicrawl/cli-win32-ia32": "0.1.70",
29
+ "@omnicrawl/cli-linux-x64": "0.1.70",
30
+ "@omnicrawl/cli-linux-arm-musl": "0.1.70",
31
+ "@omnicrawl/cli-linux-arm64-musl": "0.1.70"
32
+ }
33
+ }