pybao-xc-sdk 1.5.61 → 1.5.62
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/bin/pyb.exe +1 -0
- package/{postinstall.js → install.cjs} +23 -12
- package/package.json +6 -5
- package/bin/pyb.js +0 -11
package/bin/pyb.exe
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This placeholder is replaced by install.cjs during postinstall.
|
|
@@ -5,16 +5,27 @@ const path = require('node:path')
|
|
|
5
5
|
const { resolveRuntime } = require('./lib/runtime-resolver.cjs')
|
|
6
6
|
const { detectRuntimePlatform, getRuntimePackageName } = require('./lib/platform.cjs')
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function safeWrite(stream, line) {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
stream.write(`${line}\n`)
|
|
11
11
|
} catch {}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function safeLog(line) {
|
|
15
|
+
safeWrite(process.stdout, line)
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
function safeWarn(line) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
safeWrite(process.stderr, line)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function installResolvedBinary(sourcePath, targetPath) {
|
|
23
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true })
|
|
24
|
+
fs.rmSync(targetPath, { force: true })
|
|
25
|
+
fs.copyFileSync(sourcePath, targetPath)
|
|
26
|
+
if (process.platform !== 'win32') {
|
|
27
|
+
fs.chmodSync(targetPath, 0o755)
|
|
28
|
+
}
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
function main() {
|
|
@@ -25,14 +36,14 @@ function main() {
|
|
|
25
36
|
return
|
|
26
37
|
}
|
|
27
38
|
|
|
39
|
+
const installedBinaryPath = path.join(packageRoot, 'bin', 'pyb.exe')
|
|
40
|
+
|
|
28
41
|
try {
|
|
29
42
|
const runtime = resolveRuntime(packageRoot)
|
|
30
|
-
|
|
31
|
-
safeLog(`✅ Pyb
|
|
32
|
-
safeLog(`
|
|
33
|
-
|
|
34
|
-
safeLog(` resources: ${resourcesDir}`)
|
|
35
|
-
}
|
|
43
|
+
installResolvedBinary(runtime.binaryPath, installedBinaryPath)
|
|
44
|
+
safeLog(`✅ Pyb binary installed: ${installedBinaryPath}`)
|
|
45
|
+
safeLog(` runtime: ${runtime.packageName}`)
|
|
46
|
+
safeLog(` source: ${runtime.binaryPath}`)
|
|
36
47
|
} catch (error) {
|
|
37
48
|
const packageName = getRuntimePackageName(platformSuffix)
|
|
38
49
|
safeWarn(`⚠️ Pyb runtime package missing for ${platformSuffix}`)
|
|
@@ -42,6 +53,6 @@ function main() {
|
|
|
42
53
|
}
|
|
43
54
|
}
|
|
44
55
|
|
|
45
|
-
if (process.env.npm_lifecycle_event === 'postinstall') {
|
|
56
|
+
if (require.main === module || process.env.npm_lifecycle_event === 'postinstall') {
|
|
46
57
|
main()
|
|
47
58
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pybao-xc-sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.62",
|
|
4
4
|
"bin": {
|
|
5
|
-
"pyb": "bin/pyb.
|
|
5
|
+
"pyb": "bin/pyb.exe",
|
|
6
6
|
"pyb-acp": "bin/pyb-acp.js"
|
|
7
7
|
},
|
|
8
8
|
"engines": {
|
|
@@ -27,9 +27,10 @@
|
|
|
27
27
|
"url": "https://github.com/pyb-xc/pyb-ts/issues"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
|
-
"bin
|
|
30
|
+
"bin/pyb.exe",
|
|
31
|
+
"bin/pyb-acp.js",
|
|
31
32
|
"lib/**/*",
|
|
32
|
-
"
|
|
33
|
+
"install.cjs",
|
|
33
34
|
"README.md",
|
|
34
35
|
"LICENSE"
|
|
35
36
|
],
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"build:native-lock": "node scripts/build-native-lock.mjs",
|
|
61
62
|
"clean": "node scripts/clean.mjs",
|
|
62
63
|
"prepublishOnly": "bun scripts/sync-runtime-package-metadata.mjs && node scripts/prepublish-check.js",
|
|
63
|
-
"postinstall": "node
|
|
64
|
+
"postinstall": "node install.cjs || true",
|
|
64
65
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json}\" \"tests/**/*.{ts,tsx,js,jsx,json}\"",
|
|
65
66
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json}\" \"tests/**/*.{ts,tsx,js,jsx,json}\"",
|
|
66
67
|
"lint": "eslint . --ext .ts,.tsx,.js --max-warnings 0",
|
package/bin/pyb.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { runResolvedBinary } = require('../lib/runtime-resolver.cjs')
|
|
4
|
-
|
|
5
|
-
try {
|
|
6
|
-
const exitCode = runResolvedBinary()
|
|
7
|
-
process.exit(exitCode)
|
|
8
|
-
} catch (error) {
|
|
9
|
-
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
|
|
10
|
-
process.exit(1)
|
|
11
|
-
}
|