@kineviz/ladybug-lite 0.15.3 → 0.16.1
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 +30 -27
- package/util/build.js +284 -248
- package/util/build.md +2 -2
- package/util/buildLadybugExtensions.sh +143 -79
- package/util/buildLadybugWithDocker.sh +1 -1
- package/util/buildLbugjsNode.sh +70 -0
- package/util/cloneLbugSource.sh +76 -0
- package/util/dev.md +14 -11
package/package.json
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kineviz/ladybug-lite",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A lightweight fork of the Ladybug (formerly Kùzu) embedded graph database, optimized for faster installation and broader compatibility.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"homepage": "https://ladybugdb.com/",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/Kineviz/ladybug-lite.git"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build:ladybug": "bash ./util/buildLadybugWithDocker.sh",
|
|
13
|
-
"build": "node util/build.js",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
}
|
|
27
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@kineviz/ladybug-lite",
|
|
3
|
+
"version": "0.16.1",
|
|
4
|
+
"description": "A lightweight fork of the Ladybug (formerly Kùzu) embedded graph database, optimized for faster installation and broader compatibility.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"homepage": "https://ladybugdb.com/",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Kineviz/ladybug-lite.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build:ladybug": "bash ./util/buildLadybugWithDocker.sh",
|
|
13
|
+
"build": "node util/build.js",
|
|
14
|
+
"build:native": "bash ./util/buildLbugjsNode.sh",
|
|
15
|
+
"build:extensions": "bash ./util/buildLadybugExtensions.sh",
|
|
16
|
+
"clone:source": "bash ./util/cloneLbugSource.sh",
|
|
17
|
+
"install": "node util/install.js",
|
|
18
|
+
"copy": "node util/copy.js",
|
|
19
|
+
"test": "node util/test.js",
|
|
20
|
+
"release": "npm publish --access public --registry https://registry.npmjs.org"
|
|
21
|
+
},
|
|
22
|
+
"author": "Ladybug Team",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@ladybugdb/core": "^0.16.1"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"https-proxy-agent": "^7.0.6"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/util/build.js
CHANGED
|
@@ -1,248 +1,284 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Install packages
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const installPackage = (packageName, group = 'dev') => {
|
|
12
|
-
|
|
13
|
-
console.log(
|
|
14
|
-
`Install package ${packageName}...`
|
|
15
|
-
);
|
|
16
|
-
const childProcess = require("child_process");
|
|
17
|
-
childProcess.execSync(`npm install ${packageName} --save-dev`, {
|
|
18
|
-
cwd: rootDir,
|
|
19
|
-
stdio: "inherit",
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Copies files from the 'node_modules/@ladybugdb/core' directory to the current directory.
|
|
27
|
-
* Excludes specific directories ('lbug-source', 'node_modules') and specific files ('lbugjs.node', 'package.json').
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
const copyDir = (src, dest, excludeEntries = []) => {
|
|
31
|
-
if (!fs.existsSync(dest)) {
|
|
32
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
36
|
-
|
|
37
|
-
for (const entry of entries) {
|
|
38
|
-
const srcPath = path.join(src, entry.name);
|
|
39
|
-
const destPath = path.join(dest, entry.name);
|
|
40
|
-
|
|
41
|
-
if (entry.isDirectory()) {
|
|
42
|
-
if (!excludeEntries.includes(entry.name)) {
|
|
43
|
-
copyDir(srcPath, destPath);
|
|
44
|
-
}
|
|
45
|
-
} else if (!excludeEntries.includes(entry.name)) {
|
|
46
|
-
fs.copyFileSync(srcPath, destPath);
|
|
47
|
-
console.log(`Copied: ${srcPath} -> ${destPath}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Deletes all files and directories in the current directory
|
|
54
|
-
* except for 'copy.js', 'package.json', and the 'node_modules' directory.
|
|
55
|
-
*/
|
|
56
|
-
const deleteFiles = (directory, excludeEntries = []) => {
|
|
57
|
-
const entries = fs.readdirSync(directory, { withFileTypes: true });
|
|
58
|
-
|
|
59
|
-
for (const entry of entries) {
|
|
60
|
-
const fullPath = path.join(directory, entry.name);
|
|
61
|
-
|
|
62
|
-
// Skip if the entry is in the exclusion list
|
|
63
|
-
if (excludeEntries.includes(entry.name)) {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (entry.isDirectory()) {
|
|
68
|
-
// Recursively delete directory contents then the directory itself
|
|
69
|
-
fs.rmSync(fullPath, { recursive: true, force: true });
|
|
70
|
-
console.log(`Deleted directory: ${fullPath}`);
|
|
71
|
-
} else {
|
|
72
|
-
// Delete file
|
|
73
|
-
fs.unlinkSync(fullPath);
|
|
74
|
-
console.log(`Deleted file: ${fullPath}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const npmPublish = (package) => {
|
|
80
|
-
console.log(
|
|
81
|
-
`Publishing package ${package.name}(${package.version})... to npm`
|
|
82
|
-
);
|
|
83
|
-
const npmrcPath = path.join(rootDir, ".npmrc");
|
|
84
|
-
fs.writeFileSync(
|
|
85
|
-
npmrcPath,
|
|
86
|
-
`//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`,
|
|
87
|
-
{ encoding: "utf-8" }
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const childProcess = require("child_process");
|
|
91
|
-
try {
|
|
92
|
-
childProcess.execSync("npm publish --access public --registry https://registry.npmjs.org", {
|
|
93
|
-
cwd: rootDir,
|
|
94
|
-
stdio: "inherit",
|
|
95
|
-
});
|
|
96
|
-
} catch (err) {
|
|
97
|
-
console.error("npm publish failed:", err);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
.
|
|
123
|
-
.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Install packages
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const installPackage = (packageName, group = 'dev') => {
|
|
12
|
+
|
|
13
|
+
console.log(
|
|
14
|
+
`Install package ${packageName}...`
|
|
15
|
+
);
|
|
16
|
+
const childProcess = require("child_process");
|
|
17
|
+
childProcess.execSync(`npm install ${packageName} --save-dev`, {
|
|
18
|
+
cwd: rootDir,
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Copies files from the 'node_modules/@ladybugdb/core' directory to the current directory.
|
|
27
|
+
* Excludes specific directories ('lbug-source', 'node_modules') and specific files ('lbugjs.node', 'package.json').
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const copyDir = (src, dest, excludeEntries = []) => {
|
|
31
|
+
if (!fs.existsSync(dest)) {
|
|
32
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
36
|
+
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
const srcPath = path.join(src, entry.name);
|
|
39
|
+
const destPath = path.join(dest, entry.name);
|
|
40
|
+
|
|
41
|
+
if (entry.isDirectory()) {
|
|
42
|
+
if (!excludeEntries.includes(entry.name)) {
|
|
43
|
+
copyDir(srcPath, destPath);
|
|
44
|
+
}
|
|
45
|
+
} else if (!excludeEntries.includes(entry.name)) {
|
|
46
|
+
fs.copyFileSync(srcPath, destPath);
|
|
47
|
+
console.log(`Copied: ${srcPath} -> ${destPath}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Deletes all files and directories in the current directory
|
|
54
|
+
* except for 'copy.js', 'package.json', and the 'node_modules' directory.
|
|
55
|
+
*/
|
|
56
|
+
const deleteFiles = (directory, excludeEntries = []) => {
|
|
57
|
+
const entries = fs.readdirSync(directory, { withFileTypes: true });
|
|
58
|
+
|
|
59
|
+
for (const entry of entries) {
|
|
60
|
+
const fullPath = path.join(directory, entry.name);
|
|
61
|
+
|
|
62
|
+
// Skip if the entry is in the exclusion list
|
|
63
|
+
if (excludeEntries.includes(entry.name)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (entry.isDirectory()) {
|
|
68
|
+
// Recursively delete directory contents then the directory itself
|
|
69
|
+
fs.rmSync(fullPath, { recursive: true, force: true });
|
|
70
|
+
console.log(`Deleted directory: ${fullPath}`);
|
|
71
|
+
} else {
|
|
72
|
+
// Delete file
|
|
73
|
+
fs.unlinkSync(fullPath);
|
|
74
|
+
console.log(`Deleted file: ${fullPath}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const npmPublish = (package) => {
|
|
80
|
+
console.log(
|
|
81
|
+
`Publishing package ${package.name}(${package.version})... to npm`
|
|
82
|
+
);
|
|
83
|
+
const npmrcPath = path.join(rootDir, ".npmrc");
|
|
84
|
+
fs.writeFileSync(
|
|
85
|
+
npmrcPath,
|
|
86
|
+
`//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`,
|
|
87
|
+
{ encoding: "utf-8" }
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const childProcess = require("child_process");
|
|
91
|
+
try {
|
|
92
|
+
childProcess.execSync("npm publish --access public --registry https://registry.npmjs.org", {
|
|
93
|
+
cwd: rootDir,
|
|
94
|
+
stdio: "inherit",
|
|
95
|
+
});
|
|
96
|
+
} catch (err) {
|
|
97
|
+
console.error("npm publish failed:", err);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Copies any lbugjs-*.node binaries that CI wrote into
|
|
103
|
+
* node_modules/@ladybugdb/core/prebuilt/ up into ./prebuilt/ at the repo root.
|
|
104
|
+
* This covers freshly-built artifacts on every platform (darwin-amd64 and the
|
|
105
|
+
* Alpine arm64 build would otherwise never make it to the committed prebuilt/
|
|
106
|
+
* directory, since copyPrebuiltBinaries below is gated to linux-x64/win32).
|
|
107
|
+
*/
|
|
108
|
+
const copyLocalPrebuiltBinaries = () => {
|
|
109
|
+
const localPrebuiltDir = path.join(srcDir, "prebuilt");
|
|
110
|
+
if (!fs.existsSync(localPrebuiltDir)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const rootPrebuiltDir = path.join(rootDir, "prebuilt");
|
|
114
|
+
if (!fs.existsSync(rootPrebuiltDir)) {
|
|
115
|
+
fs.mkdirSync(rootPrebuiltDir, { recursive: true });
|
|
116
|
+
}
|
|
117
|
+
const entries = fs
|
|
118
|
+
.readdirSync(localPrebuiltDir)
|
|
119
|
+
.filter((f) => f.endsWith(".node"));
|
|
120
|
+
for (const file of entries) {
|
|
121
|
+
const src = path.join(localPrebuiltDir, file);
|
|
122
|
+
const dest = path.join(rootPrebuiltDir, file);
|
|
123
|
+
fs.copyFileSync(src, dest);
|
|
124
|
+
console.log(`Copied: ${src} -> ${dest}`);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Fetches platform-specific prebuilt binaries from the scoped @ladybugdb/core-*
|
|
130
|
+
* packages and copies each one's lbugjs.node into ./prebuilt/, remapping x64
|
|
131
|
+
* filenames to amd64 so the runtime loader can find them.
|
|
132
|
+
*/
|
|
133
|
+
const copyPrebuiltBinaries = () => {
|
|
134
|
+
const corePackageJsonPath = path.join(srcDir, "package.json");
|
|
135
|
+
if (!fs.existsSync(corePackageJsonPath)) {
|
|
136
|
+
console.error("@ladybugdb/core package.json not found, skipping prebuilt fetch");
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const lbugVersion = JSON.parse(fs.readFileSync(corePackageJsonPath, "utf8")).version;
|
|
140
|
+
|
|
141
|
+
const platformPackages = [
|
|
142
|
+
"core-darwin-arm64",
|
|
143
|
+
"core-linux-arm64",
|
|
144
|
+
"core-linux-x64",
|
|
145
|
+
"core-win32-x64",
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
const installArgs = platformPackages
|
|
149
|
+
.map((pkg) => `@ladybugdb/${pkg}@${lbugVersion}`)
|
|
150
|
+
.join(" ");
|
|
151
|
+
|
|
152
|
+
console.log(`Installing platform-specific prebuilt packages: ${installArgs}`);
|
|
153
|
+
const childProcess = require("child_process");
|
|
154
|
+
childProcess.execSync(`npm install --force --no-save ${installArgs}`, {
|
|
155
|
+
cwd: rootDir,
|
|
156
|
+
stdio: "inherit",
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const prebuiltDir = path.join(rootDir, "prebuilt");
|
|
160
|
+
if (!fs.existsSync(prebuiltDir)) {
|
|
161
|
+
fs.mkdirSync(prebuiltDir, { recursive: true });
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
for (const pkg of platformPackages) {
|
|
165
|
+
const suffix = pkg.replace(/^core-/, "").replace(/-x64$/, "-amd64");
|
|
166
|
+
const srcBin = path.join(rootDir, "node_modules", "@ladybugdb", pkg, "lbugjs.node");
|
|
167
|
+
const destBin = path.join(prebuiltDir, `lbugjs-${suffix}.node`);
|
|
168
|
+
if (fs.existsSync(srcBin)) {
|
|
169
|
+
fs.copyFileSync(srcBin, destBin);
|
|
170
|
+
console.log(`Copied: ${srcBin} -> ${destBin}`);
|
|
171
|
+
} else {
|
|
172
|
+
console.warn(`Source binary not found: ${srcBin}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const asyncVersion = () => {
|
|
178
|
+
// Copy version from node_modules/@ladybugdb/core/package.json to ./package.json
|
|
179
|
+
const lbugPackageJsonPath = path.join(srcDir, "package.json");
|
|
180
|
+
const projectPackageJsonPath = path.join(rootDir, "package.json");
|
|
181
|
+
|
|
182
|
+
if (
|
|
183
|
+
!fs.existsSync(lbugPackageJsonPath) ||
|
|
184
|
+
!fs.existsSync(projectPackageJsonPath)
|
|
185
|
+
) {
|
|
186
|
+
console.error("the package.json file not found");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
let lbugPackageJson = {};
|
|
190
|
+
let projectPackageJson = {};
|
|
191
|
+
try {
|
|
192
|
+
// Read both package.json files
|
|
193
|
+
lbugPackageJson = JSON.parse(fs.readFileSync(lbugPackageJsonPath, "utf8"));
|
|
194
|
+
projectPackageJson = JSON.parse(
|
|
195
|
+
fs.readFileSync(projectPackageJsonPath, "utf8")
|
|
196
|
+
);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.error("Can not parse the package.json version:", error);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (projectPackageJson.version != lbugPackageJson.version) {
|
|
202
|
+
projectPackageJson.version = lbugPackageJson.version;
|
|
203
|
+
projectPackageJson.devDependencies["@ladybugdb/core"] = lbugPackageJson.version;
|
|
204
|
+
// Write the updated package.json back
|
|
205
|
+
fs.writeFileSync(
|
|
206
|
+
projectPackageJsonPath,
|
|
207
|
+
JSON.stringify(projectPackageJson, null, 2)
|
|
208
|
+
);
|
|
209
|
+
console.log(`Updated package.json version to ${lbugPackageJson.version}`);
|
|
210
|
+
npmPublish(projectPackageJson);
|
|
211
|
+
} else {
|
|
212
|
+
console.log(
|
|
213
|
+
`Package.json version is already up to date: ${lbugPackageJson.version}`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const rootDir = path.join(__dirname, "..");
|
|
219
|
+
|
|
220
|
+
// already install @ladybugdb/core with docker or action
|
|
221
|
+
// installPackage("@ladybugdb/core");
|
|
222
|
+
|
|
223
|
+
// Delete files before copying new ones. lbug-src is the upstream clone
|
|
224
|
+
// fetched by util/cloneLbugSource.sh; on Linux CI it contains files created
|
|
225
|
+
// by root inside the Alpine build container and rmdir fails with EACCES, so
|
|
226
|
+
// leave it alone (and it's .gitignored anyway).
|
|
227
|
+
deleteFiles(rootDir, [
|
|
228
|
+
"package.json",
|
|
229
|
+
"util",
|
|
230
|
+
"node_modules",
|
|
231
|
+
"README.md",
|
|
232
|
+
"test",
|
|
233
|
+
".git",
|
|
234
|
+
".vscode",
|
|
235
|
+
".gitignore",
|
|
236
|
+
".github",
|
|
237
|
+
".dockerignore",
|
|
238
|
+
"Dockerfile",
|
|
239
|
+
".npmignore",
|
|
240
|
+
"docs",
|
|
241
|
+
"prebuilt",
|
|
242
|
+
"lbug-src"
|
|
243
|
+
]);
|
|
244
|
+
|
|
245
|
+
const srcDir = path.join(rootDir, "node_modules", "@ladybugdb", "core");
|
|
246
|
+
const destDir = path.join(rootDir);
|
|
247
|
+
|
|
248
|
+
if (fs.existsSync(srcDir)) {
|
|
249
|
+
copyDir(srcDir, destDir, [
|
|
250
|
+
"lbug-source",
|
|
251
|
+
"node_modules",
|
|
252
|
+
"lbugjs.node",
|
|
253
|
+
"package.json",
|
|
254
|
+
"install.js",
|
|
255
|
+
"README.md",
|
|
256
|
+
"test",
|
|
257
|
+
".gitignore",
|
|
258
|
+
".github",
|
|
259
|
+
".dockerignore",
|
|
260
|
+
".npmignore",
|
|
261
|
+
"Dockerfile",
|
|
262
|
+
"prebuilt",
|
|
263
|
+
]);
|
|
264
|
+
console.log("Copying completed!");
|
|
265
|
+
} else {
|
|
266
|
+
console.error("Source directory not found:", srcDir);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Promote any freshly-built .node files from
|
|
270
|
+
// node_modules/@ladybugdb/core/prebuilt/ into the repo's ./prebuilt/ dir so
|
|
271
|
+
// they get committed/published. Runs on every platform.
|
|
272
|
+
copyLocalPrebuiltBinaries();
|
|
273
|
+
|
|
274
|
+
// Fetch platform-specific prebuilt binaries only on linux-x64 so a single CI
|
|
275
|
+
// runner produces them (matches the former `if: matrix.arch == 'amd64'` gate).
|
|
276
|
+
if (process.platform === "win32" || (process.platform === "linux" && process.arch === "x64")) {
|
|
277
|
+
copyPrebuiltBinaries();
|
|
278
|
+
} else {
|
|
279
|
+
console.log(
|
|
280
|
+
`Skipping platform-specific prebuilt fetch on ${process.platform}-${process.arch}`
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
asyncVersion();
|
package/util/build.md
CHANGED
|
@@ -15,7 +15,7 @@ docker run -it \
|
|
|
15
15
|
--name qemu-aarch64-alpine \
|
|
16
16
|
-v ./:/app \
|
|
17
17
|
--platform linux/arm64 \
|
|
18
|
-
node:
|
|
18
|
+
node:22-alpine
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
@@ -25,7 +25,7 @@ docker run -it \
|
|
|
25
25
|
--platform linux/amd64 \
|
|
26
26
|
-v ./:/app \
|
|
27
27
|
--name qemu-amd64-alpine \
|
|
28
|
-
node:
|
|
28
|
+
node:22-alpine
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -1,79 +1,143 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Script that only compiles Ladybug extensions, supports LBUG_DIR environment variable
|
|
4
|
-
# apk add --no-cache openssl openssl-dev
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
echo "
|
|
39
|
-
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
echo "
|
|
70
|
-
exit 1
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Script that only compiles Ladybug extensions, supports LBUG_DIR environment variable
|
|
4
|
+
# apk add --no-cache openssl openssl-dev
|
|
5
|
+
|
|
6
|
+
# Fail fast on any error. Without this, a failed `cmake --build` would let the
|
|
7
|
+
# script continue and print "All extensions copied" even though nothing was
|
|
8
|
+
# produced, making CI silently report success while committing nothing.
|
|
9
|
+
set -e
|
|
10
|
+
|
|
11
|
+
APP_ROOT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}")/..; pwd)
|
|
12
|
+
# Upstream @ladybugdb/core@0.15.x no longer ships lbug-source/ in the tarball;
|
|
13
|
+
# CI clones the source separately and passes LBUG_SOURCE_DIR. Fall back to the
|
|
14
|
+
# old in-node_modules path for local dev against older cores.
|
|
15
|
+
LBUG_SOURCE_DIR="${LBUG_SOURCE_DIR:-$APP_ROOT_DIR/node_modules/@ladybugdb/core/lbug-source}"
|
|
16
|
+
EXTENSION_DIR="${LBUG_SOURCE_DIR}/extension"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
SYSTEM="$(uname -o)"
|
|
20
|
+
if [ "$SYSTEM" = "Msys" ]; then
|
|
21
|
+
export MSYS2_ARG_CONV_EXCL="*"
|
|
22
|
+
echo "Msys"
|
|
23
|
+
APP_ROOT_DIR="$(cygpath -w $APP_ROOT_DIR)"
|
|
24
|
+
LBUG_SOURCE_DIR="$(cygpath -w $LBUG_SOURCE_DIR)"
|
|
25
|
+
EXTENSION_DIR="$(cygpath -w $EXTENSION_DIR)"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Architecture detection (moved above the cache check so $EXTENSION_DIST_DIR
|
|
29
|
+
# can be computed before deciding whether to skip the build).
|
|
30
|
+
ARCH=$(uname -m)
|
|
31
|
+
if [ "$ARCH" = "x86_64" ]; then
|
|
32
|
+
echo "Detected x86_64 architecture"
|
|
33
|
+
ARCH="amd64"
|
|
34
|
+
elif [ "$ARCH" = "aarch64" ]; then
|
|
35
|
+
echo "Detected aarch64 architecture"
|
|
36
|
+
ARCH="arm64"
|
|
37
|
+
else
|
|
38
|
+
echo "Unsupported architecture: $ARCH"
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
EXTENSION_DIST_DIR="${EXTENSION_OUTPUT_DIR:-$APP_ROOT_DIR/extensions/alpine-$ARCH}"
|
|
42
|
+
VERSION_FILE="$APP_ROOT_DIR/extensions/version"
|
|
43
|
+
CORE_PKG_JSON="$APP_ROOT_DIR/node_modules/@ladybugdb/core/package.json"
|
|
44
|
+
|
|
45
|
+
# Cache check: if extensions/version matches the target @ladybugdb/core
|
|
46
|
+
# version and $EXTENSION_DIST_DIR already contains at least one built
|
|
47
|
+
# artifact, skip the 4-8 minute cmake build. Set LBUG_FORCE_REBUILD=1 to
|
|
48
|
+
# bypass.
|
|
49
|
+
if [ "${LBUG_FORCE_REBUILD:-0}" != "1" ] \
|
|
50
|
+
&& [ -d "$EXTENSION_DIST_DIR" ] \
|
|
51
|
+
&& [ -f "$VERSION_FILE" ] \
|
|
52
|
+
&& [ -f "$CORE_PKG_JSON" ]; then
|
|
53
|
+
cached_ver=$(head -n 1 "$VERSION_FILE" | tr -d '[:space:]')
|
|
54
|
+
target_ver=$(node -p "require('$CORE_PKG_JSON').version")
|
|
55
|
+
existing=$(find "$EXTENSION_DIST_DIR" -maxdepth 1 -type f \( -name "*.lbug_extension" -o -name "*.kuzu_extension" \) 2>/dev/null | wc -l)
|
|
56
|
+
if [ "$cached_ver" = "$target_ver" ] && [ "$existing" -gt 0 ]; then
|
|
57
|
+
echo "Cache hit: $existing extension artifact(s) in $EXTENSION_DIST_DIR for v$target_ver, skipping rebuild."
|
|
58
|
+
exit 0
|
|
59
|
+
fi
|
|
60
|
+
echo "Cache miss (extensions/version=$cached_ver, target=$target_ver, artifacts=$existing); rebuilding."
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
#EXTENSION_LIST="$(find "${EXTENSION_DIR}" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | grep -v '^duckdb$' | sort | tr '\n' ';' | sed 's/;$//')"
|
|
64
|
+
EXTENSION_LIST="httpfs;json;fts;vector;neo4j;algo"
|
|
65
|
+
echo "Automatically detected extension list: ${EXTENSION_LIST}"
|
|
66
|
+
|
|
67
|
+
if [ ! -f "${LBUG_SOURCE_DIR}/CMakeLists.txt" ] || [ ! -d "${LBUG_SOURCE_DIR}/extension" ]; then
|
|
68
|
+
echo "Error: Please run this script in the root directory of the ladybug repository, or set the LBUG_DIR environment variable to point to the ladybug source directory"
|
|
69
|
+
echo "Current LBUG_SOURCE_DIR: ${LBUG_SOURCE_DIR}"
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
BUILD_DIR="${LBUG_SOURCE_DIR}/build_extensions"
|
|
74
|
+
if [ ! -d "$BUILD_DIR" ]; then
|
|
75
|
+
mkdir "$BUILD_DIR"
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
cd "$BUILD_DIR" || exit 1
|
|
79
|
+
|
|
80
|
+
# Check if already compiled, if so delete it
|
|
81
|
+
if [ -d "extension" ]; then
|
|
82
|
+
echo "Detected existing extension directory, deleting..."
|
|
83
|
+
rm -rf extension
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
echo "Configuring CMake to build only extensions..."
|
|
87
|
+
echo "Source directory: ${LBUG_SOURCE_DIR}"
|
|
88
|
+
# BUILD_LBUG=FALSE alone still pulls in tools/shell, whose printer target has
|
|
89
|
+
# a broken include path (upstream cmake doesn't add src/include when shell is
|
|
90
|
+
# built standalone). BUILD_SHELL=FALSE skips it; upstream install.js uses
|
|
91
|
+
# both flags for the nodejs native addon build.
|
|
92
|
+
cmake "${LBUG_SOURCE_DIR}" \
|
|
93
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
94
|
+
-DBUILD_EXTENSIONS="${EXTENSION_LIST}" \
|
|
95
|
+
-DOPENSSL_CRYPTO_LIBRARY=/usr/lib/libcrypto.so \
|
|
96
|
+
-DOPENSSL_SSL_LIBRARY=/usr/lib/libssl.so \
|
|
97
|
+
-DOPENSSL_USE_STATIC_LIBS=OFF \
|
|
98
|
+
-DBUILD_LBUG=FALSE \
|
|
99
|
+
-DBUILD_SHELL=FALSE
|
|
100
|
+
|
|
101
|
+
CORES=$(nproc --all)
|
|
102
|
+
echo "Using $CORES cores for compilation..."
|
|
103
|
+
|
|
104
|
+
# Use all target for compilation (more generic)
|
|
105
|
+
cmake --build . -- -j"$CORES"
|
|
106
|
+
|
|
107
|
+
echo "All extensions compiled successfully!"
|
|
108
|
+
|
|
109
|
+
#check cpu architecture
|
|
110
|
+
ARCH=$(uname -m)
|
|
111
|
+
if [ "$ARCH" = "x86_64" ]; then
|
|
112
|
+
echo "Detected x86_64 architecture"
|
|
113
|
+
ARCH="amd64"
|
|
114
|
+
elif [ "$ARCH" = "aarch64" ]; then
|
|
115
|
+
echo "Detected aarch64 architecture"
|
|
116
|
+
ARCH="arm64"
|
|
117
|
+
else
|
|
118
|
+
echo "Unsupported architecture: $ARCH"
|
|
119
|
+
exit 1
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Collect the built extensions into an output dir the publish pipeline can
|
|
123
|
+
# pick up. Default to $APP_ROOT_DIR/extensions/alpine-$ARCH.
|
|
124
|
+
EXTENSION_DIST_DIR="${EXTENSION_OUTPUT_DIR:-$APP_ROOT_DIR/extensions/alpine-$ARCH}"
|
|
125
|
+
mkdir -p "$EXTENSION_DIST_DIR"
|
|
126
|
+
|
|
127
|
+
# Use -name rather than -path with globbing. The prior -path "*/build/*.ext"
|
|
128
|
+
# pattern silently matched zero files under Alpine's busybox find even though
|
|
129
|
+
# the artifacts existed at extension/<name>/build/lib<name>.lbug_extension.
|
|
130
|
+
# -name is simpler and produced the same result set on the test run.
|
|
131
|
+
copied=0
|
|
132
|
+
for ext in $(find "${LBUG_SOURCE_DIR}/extension" -type f \( -name "*.lbug_extension" -o -name "*.kuzu_extension" \)); do
|
|
133
|
+
cp -f "$ext" "$EXTENSION_DIST_DIR/"
|
|
134
|
+
echo "Copied: $ext -> $EXTENSION_DIST_DIR/"
|
|
135
|
+
copied=$((copied + 1))
|
|
136
|
+
done
|
|
137
|
+
|
|
138
|
+
if [ "$copied" -eq 0 ]; then
|
|
139
|
+
echo "Error: No .lbug_extension or .kuzu_extension artifacts found under ${LBUG_SOURCE_DIR}/extension. Did the cmake build produce any?" >&2
|
|
140
|
+
exit 1
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
echo "$copied extension artifact(s) have been copied to the $EXTENSION_DIST_DIR directory"
|
|
@@ -42,7 +42,7 @@ run_test() {
|
|
|
42
42
|
docker run --rm \
|
|
43
43
|
--platform linux/$arch \
|
|
44
44
|
-v "${APP_ROOT_DIR}:/ladybug-lite" \
|
|
45
|
-
node:
|
|
45
|
+
node:22-alpine /bin/sh -c "
|
|
46
46
|
cd /ladybug-lite && \
|
|
47
47
|
cp -f /ladybug-lite/prebuilt/$node_file /ladybug-lite/lbugjs.node && \
|
|
48
48
|
cd /ladybug-lite/util && \
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Build the native Node.js addon (lbugjs.node) from a Ladybug source checkout
|
|
3
|
+
# and copy the result to OUTPUT_PATH.
|
|
4
|
+
#
|
|
5
|
+
# Inputs (env):
|
|
6
|
+
# LBUG_SOURCE_DIR Path to a checkout of github.com/LadybugDB/ladybug (required)
|
|
7
|
+
# OUTPUT_PATH Absolute path for the produced .node file (required)
|
|
8
|
+
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
: "${LBUG_SOURCE_DIR:?LBUG_SOURCE_DIR is required}"
|
|
12
|
+
: "${OUTPUT_PATH:?OUTPUT_PATH is required}"
|
|
13
|
+
|
|
14
|
+
APP_ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)
|
|
15
|
+
CORE_PKG_JSON="$APP_ROOT_DIR/node_modules/@ladybugdb/core/package.json"
|
|
16
|
+
|
|
17
|
+
# Cache check: if prebuilt/<target> already exists in the repo checkout and
|
|
18
|
+
# prebuilt/version matches the currently-installed @ladybugdb/core version,
|
|
19
|
+
# skip the 15-20 minute compile and just copy the cached binary to the
|
|
20
|
+
# expected OUTPUT_PATH. Lets same-version re-runs (e.g. CI reruns triggered
|
|
21
|
+
# by a sibling job's push) finish in seconds instead of ~20 min.
|
|
22
|
+
# Set LBUG_FORCE_REBUILD=1 to bypass.
|
|
23
|
+
CACHED_BIN="$APP_ROOT_DIR/prebuilt/$(basename "$OUTPUT_PATH")"
|
|
24
|
+
VERSION_FILE="$APP_ROOT_DIR/prebuilt/version"
|
|
25
|
+
if [ "${LBUG_FORCE_REBUILD:-0}" != "1" ] \
|
|
26
|
+
&& [ -f "$CACHED_BIN" ] \
|
|
27
|
+
&& [ -f "$VERSION_FILE" ] \
|
|
28
|
+
&& [ -f "$CORE_PKG_JSON" ]; then
|
|
29
|
+
cached_ver=$(head -n 1 "$VERSION_FILE" | tr -d '[:space:]')
|
|
30
|
+
target_ver=$(node -p "require('$CORE_PKG_JSON').version")
|
|
31
|
+
if [ "$cached_ver" = "$target_ver" ]; then
|
|
32
|
+
echo "Cache hit: $CACHED_BIN already built for v$target_ver, skipping compile."
|
|
33
|
+
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
|
34
|
+
cp -f "$CACHED_BIN" "$OUTPUT_PATH"
|
|
35
|
+
echo "Copied cached binary -> $OUTPUT_PATH"
|
|
36
|
+
exit 0
|
|
37
|
+
fi
|
|
38
|
+
echo "Cache miss (prebuilt/version=$cached_ver, target=$target_ver); rebuilding."
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
NODEJS_API_DIR="$LBUG_SOURCE_DIR/tools/nodejs_api"
|
|
42
|
+
|
|
43
|
+
if [ ! -d "$NODEJS_API_DIR" ]; then
|
|
44
|
+
echo "Error: $NODEJS_API_DIR not found. Is LBUG_SOURCE_DIR a valid ladybug checkout?" >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# tools/nodejs_api is a git submodule upstream. If the clone forgot
|
|
49
|
+
# --recurse-submodules the directory exists but is empty, and yarn silently
|
|
50
|
+
# walks up the tree to the repo-root package.json, running the wrong scripts.
|
|
51
|
+
# Refuse to proceed.
|
|
52
|
+
if [ ! -f "$NODEJS_API_DIR/package.json" ]; then
|
|
53
|
+
echo "Error: $NODEJS_API_DIR/package.json missing. Did the submodule fail to init? Try re-running with 'git submodule update --init --recursive' in $LBUG_SOURCE_DIR." >&2
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
cd "$NODEJS_API_DIR"
|
|
58
|
+
yarn install
|
|
59
|
+
yarn build
|
|
60
|
+
|
|
61
|
+
BUILT_NODE="$NODEJS_API_DIR/build/lbugjs.node"
|
|
62
|
+
if [ ! -f "$BUILT_NODE" ]; then
|
|
63
|
+
echo "Error: build did not produce $BUILT_NODE" >&2
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
|
68
|
+
cp -f "$BUILT_NODE" "$OUTPUT_PATH"
|
|
69
|
+
echo "Wrote $OUTPUT_PATH"
|
|
70
|
+
file "$OUTPUT_PATH" || true
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Clone the upstream LadybugDB/ladybug repo at the tag matching the installed
|
|
3
|
+
# @ladybugdb/core version, with selective submodule initialization.
|
|
4
|
+
#
|
|
5
|
+
# Upstream has 8 submodules (extension, benchmark, dataset, tools/{java,
|
|
6
|
+
# nodejs,python,rust,wasm}_api); each CI job only needs 1. Cloning all eight
|
|
7
|
+
# shallow clones wastes bandwidth and, in the macOS-native job, looked like a
|
|
8
|
+
# 6h hang. Inspect lbug-src/.gitmodules for the full list.
|
|
9
|
+
#
|
|
10
|
+
# Inputs (env):
|
|
11
|
+
# LBUG_SOURCE_DIR Destination directory (default: $APP_ROOT_DIR/lbug-src)
|
|
12
|
+
# LBUG_SUBMODULES Which submodules to init, space-separated. Controls
|
|
13
|
+
# submodule selection:
|
|
14
|
+
# unset → recurse ALL submodules (local-dev default)
|
|
15
|
+
# "" → no submodules (main repo only)
|
|
16
|
+
# "extension" → only extension/
|
|
17
|
+
# "tools/nodejs_api" → only tools/nodejs_api
|
|
18
|
+
# LBUG_REPO_URL Override upstream repo URL (default:
|
|
19
|
+
# https://github.com/LadybugDB/ladybug.git)
|
|
20
|
+
# LBUG_SHALLOW_SUBMODULES 1 (default) to shallow-clone submodules, 0 for full.
|
|
21
|
+
|
|
22
|
+
set -euo pipefail
|
|
23
|
+
|
|
24
|
+
APP_ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)
|
|
25
|
+
LBUG_SOURCE_DIR="${LBUG_SOURCE_DIR:-$APP_ROOT_DIR/lbug-src}"
|
|
26
|
+
CORE_PKG_JSON="$APP_ROOT_DIR/node_modules/@ladybugdb/core/package.json"
|
|
27
|
+
REPO_URL="${LBUG_REPO_URL:-https://github.com/LadybugDB/ladybug.git}"
|
|
28
|
+
SHALLOW_SUBMODULES="${LBUG_SHALLOW_SUBMODULES:-1}"
|
|
29
|
+
|
|
30
|
+
if [ ! -f "$CORE_PKG_JSON" ]; then
|
|
31
|
+
echo "Error: $CORE_PKG_JSON not found. Run 'yarn add @ladybugdb/core' first." >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
VER=$(node -p "require('$CORE_PKG_JSON').version")
|
|
36
|
+
TAG="v${VER}"
|
|
37
|
+
|
|
38
|
+
if [ -d "$LBUG_SOURCE_DIR/.git" ]; then
|
|
39
|
+
echo "LBUG_SOURCE_DIR already exists at $LBUG_SOURCE_DIR; skipping clone."
|
|
40
|
+
exit 0
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
shallow_args=()
|
|
44
|
+
if [ "$SHALLOW_SUBMODULES" = "1" ]; then
|
|
45
|
+
shallow_args=(--shallow-submodules)
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
if [ -z "${LBUG_SUBMODULES+x}" ]; then
|
|
49
|
+
# Unset: recurse all submodules (convenient for local dev).
|
|
50
|
+
echo "Cloning $REPO_URL @ $TAG with ALL submodules -> $LBUG_SOURCE_DIR"
|
|
51
|
+
git clone --depth 1 --branch "$TAG" --recurse-submodules "${shallow_args[@]}" "$REPO_URL" "$LBUG_SOURCE_DIR"
|
|
52
|
+
exit 0
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Set (possibly empty): clone main repo, then selectively init.
|
|
56
|
+
echo "Cloning $REPO_URL @ $TAG (main repo only) -> $LBUG_SOURCE_DIR"
|
|
57
|
+
git clone --depth 1 --branch "$TAG" "$REPO_URL" "$LBUG_SOURCE_DIR"
|
|
58
|
+
|
|
59
|
+
if [ -z "$LBUG_SUBMODULES" ]; then
|
|
60
|
+
echo "LBUG_SUBMODULES is empty; skipping submodule init."
|
|
61
|
+
exit 0
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
submodule_shallow=()
|
|
65
|
+
if [ "$SHALLOW_SUBMODULES" = "1" ]; then
|
|
66
|
+
submodule_shallow=(--depth 1)
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Split on whitespace to feed multiple paths; --recursive handles nested
|
|
70
|
+
# submodules inside the selected ones.
|
|
71
|
+
# shellcheck disable=SC2086
|
|
72
|
+
(
|
|
73
|
+
cd "$LBUG_SOURCE_DIR"
|
|
74
|
+
echo "Initializing submodules: $LBUG_SUBMODULES"
|
|
75
|
+
git submodule update --init --recursive "${submodule_shallow[@]}" -- $LBUG_SUBMODULES
|
|
76
|
+
)
|
package/util/dev.md
CHANGED
|
@@ -301,9 +301,9 @@ There are three workflows in [`.github/workflows/`](../.github/workflows/):
|
|
|
301
301
|
|
|
302
302
|
| Workflow | Trigger | What it does |
|
|
303
303
|
| --- | --- | --- |
|
|
304
|
-
| [`build.yaml`](../.github/workflows/build.yaml) | push / PR to `release`, manual | Matrix `{amd64, arm64}` on Ubuntu runners. Builds Alpine `.node` inside `node:
|
|
305
|
-
| [`buildMacOsIntel.yaml`](../.github/workflows/buildMacOsIntel.yaml) | push / PR to `release`, manual | Single job on `macos-26-intel`. Compiles `
|
|
306
|
-
| [`buildExtension.yaml`](../.github/workflows/buildExtension.yaml) | push / PR to `release`, manual | Matrix `{amd64, arm64}`. Runs `util/buildLadybugExtensions.sh` inside `node:
|
|
304
|
+
| [`build.yaml`](../.github/workflows/build.yaml) | push / PR to `release`, manual | Matrix `{amd64, arm64}` on Ubuntu runners. Builds Alpine `.node` inside `node:22-alpine` container, copies to `prebuilt/`, runs `util/test.js` smoke test in Alpine, commits `prebuilt/*.node + *.js + package.json` to the release branch, tags with the upstream version (`0.15.3` etc.), publishes via `yarn build`. |
|
|
305
|
+
| [`buildMacOsIntel.yaml`](../.github/workflows/buildMacOsIntel.yaml) | push / PR to `release`, manual | Single job on `macos-26-intel`. Compiles `tools/nodejs_api` from source (upstream ships no darwin-amd64/x64 prebuilt), copies the result to `prebuilt/lbugjs-darwin-amd64.node`, runs `util/test.js` natively, commits/tags/publishes the same way `build.yaml` does. Races with `build.yaml` on push/tag — the `merge -X ours` strategy and `npm publish` no-op-on-existing handle this safely. |
|
|
306
|
+
| [`buildExtension.yaml`](../.github/workflows/buildExtension.yaml) | push / PR to `release`, manual | Matrix `{amd64, arm64}`. Runs `util/buildLadybugExtensions.sh` inside `node:22-alpine`, force-pushes the resulting `extensions/*/*.lbug_extension` files. |
|
|
307
307
|
| [`daily.yaml`](../.github/workflows/daily.yaml) | cron `0 0 * * *` | Compares `npm view @ladybugdb/core version` vs `npm view @kineviz/ladybug-lite version`. If upstream is newer, opens an issue and triggers `build.yaml` via `workflow_dispatch`. **Note:** does not currently dispatch `buildMacOsIntel.yaml` — Intel Mac binaries piggyback on the next manual or PR-triggered run. |
|
|
308
308
|
|
|
309
309
|
So the **normal release cadence** is: upstream bumps → `daily.yaml` notices →
|
|
@@ -332,21 +332,24 @@ runtime and want to avoid rewriting the repo root.
|
|
|
332
332
|
|
|
333
333
|
| File | Built by | Notes |
|
|
334
334
|
| --- | --- | --- |
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
All `-amd64` filenames cover x86_64 / Node's `x64` arch; the `amd64` spelling
|
|
336
|
+
is canonical throughout this repo (install.js, copy.js, and build.js all
|
|
337
|
+
normalize Node's `x64` to `amd64` before path lookups).
|
|
338
|
+
|
|
339
|
+
| File | Built by | Notes |
|
|
340
|
+
| --- | --- | --- |
|
|
341
|
+
| `lbugjs-linux-amd64.node` | upstream `@ladybugdb/core` sub-package `core-linux-x64` | Copied from `node_modules/@ladybugdb/core-linux-x64/`, renamed `-x64` → `-amd64` by `build.js` |
|
|
342
|
+
| `lbugjs-linux-arm64.node` | upstream | same, no rename needed |
|
|
337
343
|
| `lbugjs-darwin-arm64.node` | upstream | Apple Silicon |
|
|
338
|
-
| `lbugjs-darwin-
|
|
339
|
-
| `lbugjs-win32-
|
|
344
|
+
| `lbugjs-darwin-amd64.node` | **us** (`buildMacOsIntel.yaml`, `macos-26-intel` runner) | Built from source; upstream does not ship Intel Mac for 0.15.x |
|
|
345
|
+
| `lbugjs-win32-amd64.node` | upstream | same rename as linux |
|
|
340
346
|
| `lbugjs-alpine-amd64.node` | **us** (`buildLadybugWithDocker.sh` / `build.yaml`) | musl libc |
|
|
341
347
|
| `lbugjs-alpine-arm64.node` | **us** | musl libc |
|
|
342
348
|
|
|
343
|
-
**Time-bounded support:** `darwin-
|
|
349
|
+
**Time-bounded support:** Intel Mac (`darwin-amd64`) depends on the
|
|
344
350
|
`macos-26-intel` GitHub-hosted runner, which Apple/GitHub will retire in
|
|
345
351
|
Fall 2027. After that, Intel Mac users must build from source locally.
|
|
346
352
|
|
|
347
|
-
The naming inconsistency between `linux-x64` (Node arch) and `alpine-amd64`
|
|
348
|
-
(Docker arch) is historical and is normalized by `install.js` — see §5.2.
|
|
349
|
-
|
|
350
353
|
---
|
|
351
354
|
|
|
352
355
|
## 8. Engine extensions
|