@cnb-rs/cli 0.0.1-init → 1.0.0-alpha.10
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 +40 -0
- package/bin/cli.js +50 -0
- package/package.json +43 -5
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @cnb-rs/cli
|
|
2
|
+
|
|
3
|
+
**Unofficial [CNB](https://cnb.cool) command-line tool built with Rust.**
|
|
4
|
+
|
|
5
|
+
在终端中高效管理你的 CNB 平台资源。
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Global install
|
|
11
|
+
npm install -g @cnb-rs/cli
|
|
12
|
+
|
|
13
|
+
# One-off usage (no install needed)
|
|
14
|
+
npx @cnb-rs/cli --help
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Supported Node.js Versions
|
|
18
|
+
|
|
19
|
+
| Version | Status |
|
|
20
|
+
| ------- | ------ |
|
|
21
|
+
| 22 LTS | ✅ |
|
|
22
|
+
| 24 LTS | ✅ |
|
|
23
|
+
| 26+ | ✅ |
|
|
24
|
+
|
|
25
|
+
## Supported Platforms
|
|
26
|
+
|
|
27
|
+
| Platform | Architecture |
|
|
28
|
+
| -------------- | ------------ |
|
|
29
|
+
| Linux | x64, arm64 |
|
|
30
|
+
| macOS (Darwin) | x64, arm64 |
|
|
31
|
+
| Windows | x64, arm64 |
|
|
32
|
+
|
|
33
|
+
## Documentation
|
|
34
|
+
|
|
35
|
+
- 文档站: <https://cnb.wwvo.fun>
|
|
36
|
+
- 仓库: <https://cnb.cool/wwvo/cnb-rs/cnb-rs>
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
GPL-3.0-or-later
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict'
|
|
4
|
+
|
|
5
|
+
const { spawnSync } = require('child_process')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
const os = require('os')
|
|
8
|
+
|
|
9
|
+
const PLATFORMS = {
|
|
10
|
+
'darwin-arm64': '@cnb-rs/cli-darwin-arm64',
|
|
11
|
+
'darwin-x64': '@cnb-rs/cli-darwin-x64',
|
|
12
|
+
'linux-arm64': '@cnb-rs/cli-linux-arm64',
|
|
13
|
+
'linux-x64': '@cnb-rs/cli-linux-x64',
|
|
14
|
+
'win32-arm64': '@cnb-rs/cli-win32-arm64',
|
|
15
|
+
'win32-x64': '@cnb-rs/cli-win32-x64',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const platformKey = `${os.platform()}-${os.arch()}`
|
|
19
|
+
const pkg = PLATFORMS[/** @type {keyof typeof PLATFORMS} */ (platformKey)]
|
|
20
|
+
|
|
21
|
+
if (!pkg) {
|
|
22
|
+
console.error(`cnb-rs: unsupported platform "${platformKey}"\n` + `Supported platforms: ${Object.keys(PLATFORMS).join(', ')}`)
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let binPath
|
|
27
|
+
try {
|
|
28
|
+
const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`))
|
|
29
|
+
const ext = os.platform() === 'win32' ? '.exe' : ''
|
|
30
|
+
binPath = path.join(pkgDir, 'bin', `cnb-rs${ext}`)
|
|
31
|
+
} catch {
|
|
32
|
+
console.error(`cnb-rs: could not locate the binary package "${pkg}".\n` + `This usually means the optional dependency was not installed.\n` + `Try reinstalling: npm install -g @cnb-rs/cli`)
|
|
33
|
+
process.exit(1)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const result = spawnSync(binPath, process.argv.slice(2), {
|
|
37
|
+
stdio: 'inherit',
|
|
38
|
+
env: process.env,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
if (result.error) {
|
|
42
|
+
if (/** @type {NodeJS.ErrnoException} */ (result.error).code === 'ENOENT') {
|
|
43
|
+
console.error(`cnb-rs: binary not found at "${binPath}"`)
|
|
44
|
+
} else {
|
|
45
|
+
console.error(`cnb-rs: ${result.error.message}`)
|
|
46
|
+
}
|
|
47
|
+
process.exit(1)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
process.exit(result.status ?? 1)
|
package/package.json
CHANGED
|
@@ -1,7 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnb-rs/cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
|
+
"description": "Unofficial CNB command-line tool built with Rust",
|
|
5
|
+
"bin": {
|
|
6
|
+
"cnb-rs": "bin/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/wwvl/Mia.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cnb",
|
|
17
|
+
"cnb-rs",
|
|
18
|
+
"cli",
|
|
19
|
+
"devtools",
|
|
20
|
+
"git",
|
|
21
|
+
"code-review",
|
|
22
|
+
"issue",
|
|
23
|
+
"pull-request"
|
|
24
|
+
],
|
|
25
|
+
"author": "wwvo",
|
|
26
|
+
"license": "GPL-3.0-or-later",
|
|
27
|
+
"homepage": "https://cnb.cool/wwvo/cnb-rs/cnb-rs",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://cnb.cool/wwvo/cnb-rs/cnb-rs/-/issues"
|
|
30
|
+
},
|
|
31
|
+
"optionalDependencies": {
|
|
32
|
+
"@cnb-rs/cli-darwin-arm64": "1.0.0-alpha.10",
|
|
33
|
+
"@cnb-rs/cli-darwin-x64": "1.0.0-alpha.10",
|
|
34
|
+
"@cnb-rs/cli-linux-arm64": "1.0.0-alpha.10",
|
|
35
|
+
"@cnb-rs/cli-linux-x64": "1.0.0-alpha.10",
|
|
36
|
+
"@cnb-rs/cli-win32-arm64": "1.0.0-alpha.10",
|
|
37
|
+
"@cnb-rs/cli-win32-x64": "1.0.0-alpha.10"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=22"
|
|
44
|
+
}
|
|
45
|
+
}
|