@goodfoot/wiki 0.5.15 → 0.5.18
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/package.json +6 -6
- package/scripts/postinstall.js +18 -12
- package/bin/wiki +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodfoot/wiki",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.18",
|
|
4
4
|
"bin": "bin/wiki",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node scripts/postinstall.js",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"scripts/postinstall.js"
|
|
16
16
|
],
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@goodfoot/wiki-darwin-arm64": "0.5.
|
|
19
|
-
"@goodfoot/wiki-darwin-x64": "0.5.
|
|
20
|
-
"@goodfoot/wiki-linux-arm64": "0.5.
|
|
21
|
-
"@goodfoot/wiki-linux-x64": "0.5.
|
|
22
|
-
"@goodfoot/wiki-win32-x64": "0.5.
|
|
18
|
+
"@goodfoot/wiki-darwin-arm64": "0.5.18",
|
|
19
|
+
"@goodfoot/wiki-darwin-x64": "0.5.18",
|
|
20
|
+
"@goodfoot/wiki-linux-arm64": "0.5.18",
|
|
21
|
+
"@goodfoot/wiki-linux-x64": "0.5.18",
|
|
22
|
+
"@goodfoot/wiki-win32-x64": "0.5.18"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
package/scripts/postinstall.js
CHANGED
|
@@ -26,7 +26,8 @@ function main() {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const packageName = `@goodfoot/wiki-${platform}-${arch}`;
|
|
29
|
-
const
|
|
29
|
+
const sourceBinaryName = process.platform === 'win32' ? 'wiki.exe' : 'wiki';
|
|
30
|
+
const runtimeBinaryName = 'wiki';
|
|
30
31
|
|
|
31
32
|
let packageDir;
|
|
32
33
|
try {
|
|
@@ -37,33 +38,38 @@ function main() {
|
|
|
37
38
|
process.exit(0);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
const sourceBinary = path.join(packageDir, 'bin',
|
|
41
|
+
const sourceBinary = path.join(packageDir, 'bin', sourceBinaryName);
|
|
41
42
|
if (!fs.existsSync(sourceBinary)) {
|
|
42
43
|
console.log(`@goodfoot/wiki: Binary not found in ${packageName}. The package may not have been published yet.`);
|
|
43
44
|
process.exit(0);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
const targetDir = path.join(__dirname, '..', 'lib');
|
|
47
|
-
const
|
|
48
|
+
const runtimeBinary = path.join(targetDir, runtimeBinaryName);
|
|
48
49
|
|
|
49
50
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
for (const targetPath of [runtimeBinary, path.join(targetDir, sourceBinaryName)]) {
|
|
53
|
+
try {
|
|
54
|
+
fs.unlinkSync(targetPath);
|
|
55
|
+
} catch {
|
|
56
|
+
// Ignore if it doesn't exist
|
|
57
|
+
}
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
// Try symlink first, fall back to copy
|
|
59
61
|
try {
|
|
60
|
-
fs.symlinkSync(sourceBinary,
|
|
62
|
+
fs.symlinkSync(sourceBinary, runtimeBinary);
|
|
61
63
|
} catch {
|
|
62
|
-
fs.copyFileSync(sourceBinary,
|
|
63
|
-
fs.chmodSync(
|
|
64
|
+
fs.copyFileSync(sourceBinary, runtimeBinary);
|
|
65
|
+
fs.chmodSync(runtimeBinary, 0o755);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (sourceBinaryName !== runtimeBinaryName) {
|
|
69
|
+
fs.copyFileSync(runtimeBinary, path.join(targetDir, sourceBinaryName));
|
|
64
70
|
}
|
|
65
71
|
|
|
66
|
-
console.log(`@goodfoot/wiki: Installed ${
|
|
72
|
+
console.log(`@goodfoot/wiki: Installed ${runtimeBinaryName} from ${packageName}`);
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
main();
|
package/bin/wiki
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
const { spawnSync } = require("child_process");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
|
|
8
|
-
const binaryName = process.platform === "win32" ? "wiki.exe" : "wiki";
|
|
9
|
-
const nativePath = path.join(__dirname, "..", "lib", binaryName);
|
|
10
|
-
|
|
11
|
-
if (!fs.existsSync(nativePath)) {
|
|
12
|
-
process.stderr.write(
|
|
13
|
-
"@goodfoot/wiki: Native binary not found.\n" +
|
|
14
|
-
"Try reinstalling: npm install @goodfoot/wiki\n"
|
|
15
|
-
);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const result = spawnSync(nativePath, process.argv.slice(2), { stdio: "inherit" });
|
|
20
|
-
process.exit(result.status ?? 1);
|