dob-script 0.1.0
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 +19 -0
- package/bin/dob-script.exe +0 -0
- package/bin/dob-script.js +46 -0
- package/bin/opencv_world490.dll +0 -0
- package/package.json +20 -0
package/README.md
ADDED
|
Binary file
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process"
|
|
4
|
+
import { existsSync } from "node:fs"
|
|
5
|
+
import { dirname, resolve } from "node:path"
|
|
6
|
+
import { fileURLToPath } from "node:url"
|
|
7
|
+
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
const executablePath = resolve(__dirname, "dob-script.exe")
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 输出平台不支持提示。
|
|
13
|
+
*/
|
|
14
|
+
function printUnsupportedPlatformMessage() {
|
|
15
|
+
console.error("dob-script 当前仅支持 Windows 平台。")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 执行本地 Rust 可执行文件,并透传退出码。
|
|
20
|
+
*/
|
|
21
|
+
function runExecutable() {
|
|
22
|
+
if (!existsSync(executablePath)) {
|
|
23
|
+
console.error(`未找到可执行文件: ${executablePath}`)
|
|
24
|
+
console.error("请重新安装,或联系发布者确认 npm 包中包含 dob-script.exe。")
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const result = spawnSync(executablePath, process.argv.slice(2), {
|
|
29
|
+
stdio: "inherit",
|
|
30
|
+
windowsHide: false
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
if (result.error) {
|
|
34
|
+
console.error(`启动 dob-script.exe 失败: ${result.error.message}`)
|
|
35
|
+
process.exit(1)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
process.exit(typeof result.status === "number" ? result.status : 1)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (process.platform !== "win32") {
|
|
42
|
+
printUnsupportedPlatformMessage()
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
runExecutable()
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dob-script",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Run DNA Builder script files from command line",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"dob-script": "bin/dob-script.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"release": "npm publish --registry https://registry.npmjs.org/"
|
|
12
|
+
},
|
|
13
|
+
"files": ["bin/dob-script.js", "bin/dob-script.exe", "bin/opencv_world490.dll", "README.md"],
|
|
14
|
+
"os": ["win32"],
|
|
15
|
+
"cpu": ["x64", "arm64"],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"keywords": ["dna-builder", "script", "cli", "dob-script"]
|
|
20
|
+
}
|