bluekiwi 1.0.9 → 1.0.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/package.json
CHANGED
|
@@ -38,6 +38,20 @@ if (existsSync(join(standaloneDist, "server.js"))) {
|
|
|
38
38
|
if (existsSync(publicDir)) {
|
|
39
39
|
cpSync(publicDir, join(appRuntimeDist, "public"), { recursive: true });
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
// Remove platform-specific native binaries — postinstall downloads the correct one
|
|
43
|
+
const sqliteBuild = join(
|
|
44
|
+
appRuntimeDist,
|
|
45
|
+
"node_modules",
|
|
46
|
+
"better-sqlite3",
|
|
47
|
+
"build",
|
|
48
|
+
);
|
|
49
|
+
if (existsSync(sqliteBuild)) {
|
|
50
|
+
rmSync(sqliteBuild, { recursive: true, force: true });
|
|
51
|
+
console.log(
|
|
52
|
+
" Stripped better-sqlite3 native binary (postinstall will rebuild)",
|
|
53
|
+
);
|
|
54
|
+
}
|
|
41
55
|
}
|
|
42
56
|
|
|
43
57
|
console.log("Assets bundled → dist/assets");
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* rebuild-native.mjs
|
|
3
|
-
* Runs after `npm install -g bluekiwi` to
|
|
4
|
-
* for the user's
|
|
3
|
+
* Runs after `npm install -g bluekiwi` to download the correct
|
|
4
|
+
* better-sqlite3 prebuilt binary for the user's platform.
|
|
5
5
|
*
|
|
6
|
-
* The npm tarball
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* falling back to node-gyp if no prebuilt is available.
|
|
6
|
+
* The npm tarball intentionally excludes the .node binary
|
|
7
|
+
* (stripped by bundle-assets.mjs) so every platform gets
|
|
8
|
+
* the right one via prebuild-install at install time.
|
|
10
9
|
*/
|
|
11
10
|
import { execFileSync } from "child_process";
|
|
12
|
-
import { existsSync } from "fs";
|
|
11
|
+
import { existsSync, mkdirSync } from "fs";
|
|
13
12
|
import { join, dirname } from "path";
|
|
14
13
|
import { fileURLToPath } from "url";
|
|
15
14
|
|
|
@@ -29,45 +28,35 @@ if (!existsSync(sqliteDir)) {
|
|
|
29
28
|
process.exit(0);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
// Ensure build/Release directory exists
|
|
32
|
+
mkdirSync(join(sqliteDir, "build", "Release"), { recursive: true });
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Quick sanity: try to dlopen it
|
|
38
|
-
process.dlopen({ exports: {} }, binaryPath);
|
|
39
|
-
// Binary loads fine — skip rebuild
|
|
40
|
-
process.exit(0);
|
|
41
|
-
} catch {
|
|
42
|
-
// Binary exists but wrong platform — rebuild
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
console.log("[bluekiwi] Rebuilding better-sqlite3 for your platform...");
|
|
34
|
+
console.log(
|
|
35
|
+
`[bluekiwi] Installing better-sqlite3 for ${process.platform}-${process.arch}...`,
|
|
36
|
+
);
|
|
47
37
|
|
|
48
38
|
try {
|
|
49
39
|
execFileSync("npx", ["-y", "prebuild-install"], {
|
|
50
40
|
cwd: sqliteDir,
|
|
51
|
-
stdio: "
|
|
41
|
+
stdio: "inherit",
|
|
52
42
|
timeout: 60_000,
|
|
53
43
|
});
|
|
54
|
-
console.log("[bluekiwi] better-sqlite3 native binary
|
|
44
|
+
console.log("[bluekiwi] better-sqlite3 native binary ready.");
|
|
55
45
|
} catch {
|
|
56
46
|
// prebuild-install failed — try node-gyp as fallback
|
|
57
47
|
try {
|
|
58
|
-
|
|
48
|
+
console.log("[bluekiwi] Prebuilt not available, compiling from source...");
|
|
49
|
+
execFileSync("npx", ["-y", "node-gyp", "rebuild", "--release"], {
|
|
59
50
|
cwd: sqliteDir,
|
|
60
|
-
stdio: "
|
|
51
|
+
stdio: "inherit",
|
|
61
52
|
timeout: 120_000,
|
|
62
53
|
});
|
|
63
|
-
console.log("[bluekiwi] better-sqlite3
|
|
54
|
+
console.log("[bluekiwi] better-sqlite3 compiled successfully.");
|
|
64
55
|
} catch (e) {
|
|
65
56
|
console.warn(
|
|
66
57
|
"[bluekiwi] Warning: Could not build better-sqlite3 native module.",
|
|
67
58
|
);
|
|
68
|
-
console.warn(
|
|
69
|
-
" The 'bluekiwi start' command (local SQLite mode) may not work.",
|
|
70
|
-
);
|
|
59
|
+
console.warn(" 'bluekiwi start' (local SQLite mode) will not work.");
|
|
71
60
|
console.warn(" Docker mode is unaffected.");
|
|
72
61
|
console.warn(` Error: ${e.message ?? e}`);
|
|
73
62
|
// Don't fail the install — CLI commands other than `start` still work
|