@ladybugdb/core 0.15.4-dev.20260428 → 0.16.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.
Files changed (2) hide show
  1. package/install.js +51 -3
  2. package/package.json +6 -6
package/install.js CHANGED
@@ -7,6 +7,34 @@ const process = require("process");
7
7
  const isNpmBuildFromSourceSet = process.env.npm_config_build_from_source;
8
8
  const platform = process.platform;
9
9
  const arch = process.arch;
10
+ const DEFAULT_LBUG_SOURCE_DIR = path.resolve(__dirname, "../ladybug");
11
+
12
+ function resolveExistingPath(candidate) {
13
+ if (!candidate) {
14
+ return null;
15
+ }
16
+ const resolved = path.resolve(candidate);
17
+ return fs.existsSync(resolved) ? resolved : null;
18
+ }
19
+
20
+ function getDefaultBuildDir(lbugSourceDir) {
21
+ return lbugSourceDir ? path.join(lbugSourceDir, "build", "release") : null;
22
+ }
23
+
24
+ function getDefaultPrecompiledLibPath(lbugBuildDir) {
25
+ if (!lbugBuildDir) {
26
+ return null;
27
+ }
28
+ const candidates = platform === "win32"
29
+ ? [
30
+ path.join(lbugBuildDir, "src", "Release", "lbug.lib"),
31
+ path.join(lbugBuildDir, "src", "lbug.lib"),
32
+ path.join(lbugBuildDir, "src", "Release", "liblbug.lib"),
33
+ path.join(lbugBuildDir, "src", "liblbug.lib"),
34
+ ]
35
+ : [path.join(lbugBuildDir, "src", "liblbug.a")];
36
+ return candidates.find((candidate) => fs.existsSync(candidate)) || null;
37
+ }
10
38
 
11
39
  // When the package was published with prebuilt binaries, each platform's
12
40
  // binary lives in a dedicated optional sub-package. npm may hoist it to the
@@ -59,6 +87,17 @@ if (isNpmBuildFromSourceSet) {
59
87
  console.log("Prebuilt binary is not available, building from source...");
60
88
  }
61
89
 
90
+ const externalLbugSourceDir = resolveExistingPath(
91
+ process.env.LBUG_SOURCE_DIR || DEFAULT_LBUG_SOURCE_DIR
92
+ );
93
+ const externalLbugBuildDir = resolveExistingPath(
94
+ process.env.LBUG_BUILD_DIR || getDefaultBuildDir(externalLbugSourceDir)
95
+ );
96
+ const externalPrecompiledLibPath = resolveExistingPath(
97
+ process.env.LBUG_NODEJS_PRECOMPILED_LIB_PATH ||
98
+ getDefaultPrecompiledLibPath(externalLbugBuildDir)
99
+ );
100
+
62
101
  // Get number of threads
63
102
  const THREADS = os.cpus().length;
64
103
  console.log(`Using ${THREADS} threads to build Lbug.`);
@@ -73,6 +112,12 @@ childProcess.execSync("npm install", {
73
112
  // Build the Lbug source code
74
113
  console.log("Building Lbug source code...");
75
114
  const env = { ...process.env };
115
+ if (externalLbugSourceDir) {
116
+ env.LBUG_SOURCE_DIR = externalLbugSourceDir;
117
+ }
118
+ if (externalLbugBuildDir) {
119
+ env.LBUG_BUILD_DIR = externalLbugBuildDir;
120
+ }
76
121
 
77
122
  if (process.platform === "darwin") {
78
123
  const archflags = process.env["ARCHFLAGS"]
@@ -128,16 +173,19 @@ if (process.platform === "win32") {
128
173
  );
129
174
  }
130
175
 
131
- if (env.LBUG_NODEJS_PRECOMPILED_LIB_PATH) {
176
+ if (externalPrecompiledLibPath) {
177
+ env.LBUG_NODEJS_PRECOMPILED_LIB_PATH = externalPrecompiledLibPath;
132
178
  env.EXTRA_CMAKE_FLAGS = [
133
179
  env.EXTRA_CMAKE_FLAGS,
180
+ env.LBUG_SOURCE_DIR ? `-DLBUG_SOURCE_DIR=${env.LBUG_SOURCE_DIR}` : null,
181
+ env.LBUG_BUILD_DIR ? `-DLBUG_BUILD_DIR=${env.LBUG_BUILD_DIR}` : null,
134
182
  "-DBUILD_LBUG=FALSE",
135
183
  "-DBUILD_SHELL=FALSE",
136
184
  "-DLBUG_NODEJS_USE_PRECOMPILED_LIB=TRUE",
137
- `-DLBUG_NODEJS_PRECOMPILED_LIB_PATH=${env.LBUG_NODEJS_PRECOMPILED_LIB_PATH}`,
185
+ `-DLBUG_NODEJS_PRECOMPILED_LIB_PATH=${externalPrecompiledLibPath}`,
138
186
  ].filter(Boolean).join(" ");
139
187
  console.log(
140
- `Using precompiled liblbug from '${env.LBUG_NODEJS_PRECOMPILED_LIB_PATH}'.`
188
+ `Using precompiled liblbug from '${externalPrecompiledLibPath}'.`
141
189
  );
142
190
  }
143
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ladybugdb/core",
3
- "version": "0.15.4-dev.20260428",
3
+ "version": "0.16.0",
4
4
  "description": "An in-process property graph database management system built for query speed and scalability.",
5
5
  "main": "index.js",
6
6
  "module": "./index.mjs",
@@ -44,10 +44,10 @@
44
44
  "node-addon-api": "^6.0.0"
45
45
  },
46
46
  "optionalDependencies": {
47
- "@ladybugdb/core-darwin-arm64": "0.15.4-dev.20260428",
48
- "@ladybugdb/core-darwin-x64": "0.15.4-dev.20260428",
49
- "@ladybugdb/core-linux-arm64": "0.15.4-dev.20260428",
50
- "@ladybugdb/core-linux-x64": "0.15.4-dev.20260428",
51
- "@ladybugdb/core-win32-x64": "0.15.4-dev.20260428"
47
+ "@ladybugdb/core-darwin-arm64": "0.16.0",
48
+ "@ladybugdb/core-darwin-x64": "0.16.0",
49
+ "@ladybugdb/core-linux-arm64": "0.16.0",
50
+ "@ladybugdb/core-linux-x64": "0.16.0",
51
+ "@ladybugdb/core-win32-x64": "0.16.0"
52
52
  }
53
53
  }