@plures/pluresdb 1.6.10 → 2.9.7
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/README.md +97 -289
- package/crates/README.md +99 -0
- package/crates/pluresdb-node/README.md +181 -0
- package/crates/pluresdb-node/index.d.ts +0 -0
- package/crates/pluresdb-node/index.js +265 -0
- package/crates/pluresdb-node/package.json +35 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/napi/index.d.ts +38 -0
- package/dist/napi/index.d.ts.map +1 -0
- package/dist/napi/index.js +60 -0
- package/dist/napi/index.js.map +1 -0
- package/dist/node-index.d.ts +32 -0
- package/dist/node-index.d.ts.map +1 -1
- package/dist/node-index.js +52 -0
- package/dist/node-index.js.map +1 -1
- package/embedded.d.ts +1 -0
- package/embedded.js +46 -0
- package/package.json +21 -8
- package/examples/basic-usage.d.ts +0 -2
- package/examples/basic-usage.d.ts.map +0 -1
- package/examples/basic-usage.js +0 -26
- package/examples/basic-usage.js.map +0 -1
- package/examples/basic-usage.ts +0 -29
- package/examples/browser-demo/README.md +0 -204
- package/examples/browser-demo/index.html +0 -466
- package/examples/browser-wasm-integration.md +0 -411
- package/examples/ipc-demo/README.md +0 -127
- package/examples/local-first-usage.ts +0 -138
- package/examples/native-ipc-integration.md +0 -526
- package/examples/tauri-demo/README.md +0 -240
- package/examples/tauri-integration.md +0 -260
- package/examples/vscode-extension-example/README.md +0 -95
- package/examples/vscode-extension-example/package.json +0 -49
- package/examples/vscode-extension-example/src/extension.ts +0 -172
- package/examples/vscode-extension-example/tsconfig.json +0 -12
- package/examples/vscode-extension-integration.d.ts +0 -31
- package/examples/vscode-extension-integration.d.ts.map +0 -1
- package/examples/vscode-extension-integration.js +0 -319
- package/examples/vscode-extension-integration.js.map +0 -1
- package/examples/vscode-extension-integration.ts +0 -41
- package/legacy/benchmarks/memory-benchmarks.ts +0 -350
- package/legacy/benchmarks/run-benchmarks.ts +0 -315
- package/legacy/better-sqlite3-shared.ts +0 -157
- package/legacy/better-sqlite3.ts +0 -4
- package/legacy/cli.ts +0 -241
- package/legacy/config.ts +0 -50
- package/legacy/core/crdt.ts +0 -107
- package/legacy/core/database.ts +0 -529
- package/legacy/healthcheck.ts +0 -162
- package/legacy/http/api-server.ts +0 -569
- package/legacy/index.ts +0 -31
- package/legacy/local-first/unified-api.ts +0 -449
- package/legacy/logic/rules.ts +0 -46
- package/legacy/main.rs +0 -3
- package/legacy/main.ts +0 -197
- package/legacy/network/websocket-server.ts +0 -115
- package/legacy/node-index.ts +0 -827
- package/legacy/node-wrapper.ts +0 -329
- package/legacy/plugins/README.md +0 -181
- package/legacy/plugins/example-embedding-plugin.ts +0 -56
- package/legacy/plugins/plugin-system.ts +0 -315
- package/legacy/sqlite-compat.ts +0 -633
- package/legacy/sqlite3-compat.ts +0 -55
- package/legacy/storage/kv-storage.ts +0 -73
- package/legacy/tests/core.test.ts +0 -305
- package/legacy/tests/fixtures/performance-data.json +0 -71
- package/legacy/tests/fixtures/test-data.json +0 -129
- package/legacy/tests/integration/api-server.test.ts +0 -334
- package/legacy/tests/integration/mesh-network.test.ts +0 -303
- package/legacy/tests/logic.test.ts +0 -34
- package/legacy/tests/performance/load.test.ts +0 -290
- package/legacy/tests/security/input-validation.test.ts +0 -286
- package/legacy/tests/unit/core.test.ts +0 -226
- package/legacy/tests/unit/local-first-api.test.ts +0 -65
- package/legacy/tests/unit/plugin-system.test.ts +0 -388
- package/legacy/tests/unit/subscriptions.test.ts +0 -135
- package/legacy/tests/unit/vector-search.test.ts +0 -173
- package/legacy/tests/vscode_extension_test.ts +0 -281
- package/legacy/types/index.ts +0 -32
- package/legacy/types/node-types.ts +0 -80
- package/legacy/util/debug.ts +0 -27
- package/legacy/vector/index.ts +0 -59
- package/legacy/vscode/extension.ts +0 -387
- package/scripts/compiled-crud-verify.ts +0 -30
- package/scripts/dogfood.ts +0 -297
- package/scripts/publish-crates.sh +0 -95
- package/scripts/release-check.js +0 -224
- package/scripts/run-tests.ts +0 -178
- package/scripts/setup-libclang.ps1 +0 -209
- package/scripts/update-changelog.js +0 -214
- package/scripts/validate-npm-publish.js +0 -228
- package/web/README.md +0 -27
- package/web/svelte/package.json +0 -31
package/scripts/dogfood.ts
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S deno run -A --unstable-kv
|
|
2
|
-
|
|
3
|
-
import { GunDB } from "../legacy/core/database.ts";
|
|
4
|
-
import { startApiServer } from "../legacy/http/api-server.ts";
|
|
5
|
-
|
|
6
|
-
declare const Deno: any;
|
|
7
|
-
|
|
8
|
-
interface StepResult {
|
|
9
|
-
name: string;
|
|
10
|
-
ok: boolean;
|
|
11
|
-
details?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async function main() {
|
|
15
|
-
const results: StepResult[] = [];
|
|
16
|
-
const kvDir = await Deno.makeTempDir({ prefix: "pluresdb-dogfood-" });
|
|
17
|
-
const kvPath = `${kvDir}/kv`;
|
|
18
|
-
const wsPort = 4600 + Math.floor(Math.random() * 5000);
|
|
19
|
-
const apiPort = wsPort + 1;
|
|
20
|
-
const apiUrl = `http://localhost:${apiPort}`;
|
|
21
|
-
|
|
22
|
-
const db = new GunDB();
|
|
23
|
-
await db.ready(kvPath);
|
|
24
|
-
db.serve({ port: wsPort });
|
|
25
|
-
const api = startApiServer({ port: apiPort, db });
|
|
26
|
-
|
|
27
|
-
const cleanupTasks: Array<() => Promise<void> | void> = [
|
|
28
|
-
async () => {
|
|
29
|
-
try {
|
|
30
|
-
api.close();
|
|
31
|
-
} catch (_) {
|
|
32
|
-
/* ignore */
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
async () => {
|
|
36
|
-
try {
|
|
37
|
-
await db.close();
|
|
38
|
-
} catch (_) {
|
|
39
|
-
/* ignore */
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
async () => {
|
|
43
|
-
try {
|
|
44
|
-
await Deno.remove(kvDir, { recursive: true });
|
|
45
|
-
} catch (_) {
|
|
46
|
-
/* ignore */
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
const finalize = async () => {
|
|
52
|
-
for (const task of cleanupTasks) {
|
|
53
|
-
await Promise.resolve(task());
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const assert = (cond: boolean, message: string) => {
|
|
58
|
-
if (!cond) {
|
|
59
|
-
throw new Error(message);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const record = (name: string, ok: boolean, details?: string) => {
|
|
64
|
-
const entry: StepResult = { name, ok, details };
|
|
65
|
-
results.push(entry);
|
|
66
|
-
const icon = ok ? "✅" : "❌";
|
|
67
|
-
console.log(`${icon} ${name}${details ? ` — ${details}` : ""}`);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
console.log("🚀 Starting PluresDB dogfooding run");
|
|
72
|
-
console.log(`🗂️ KV path: ${kvPath}`);
|
|
73
|
-
console.log(`🔌 Mesh port: ${wsPort}`);
|
|
74
|
-
console.log(`🌐 API port: ${apiPort}`);
|
|
75
|
-
|
|
76
|
-
await waitFor(
|
|
77
|
-
async () => {
|
|
78
|
-
try {
|
|
79
|
-
const res = await fetch(`${apiUrl}/api/list`);
|
|
80
|
-
return res.ok;
|
|
81
|
-
} catch (_) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{ timeoutMs: 10_000, intervalMs: 250 },
|
|
86
|
-
);
|
|
87
|
-
record("Server readiness", true);
|
|
88
|
-
|
|
89
|
-
const nodeId = "dogfood:api";
|
|
90
|
-
const initialPayload = {
|
|
91
|
-
type: "DogfoodTest",
|
|
92
|
-
text: "Hello from the dogfooding script",
|
|
93
|
-
vector: Array.from({ length: 4 }, (_, i) => i + 1),
|
|
94
|
-
};
|
|
95
|
-
const putRes = await fetch(`${apiUrl}/api/put`, {
|
|
96
|
-
method: "POST",
|
|
97
|
-
headers: { "content-type": "application/json" },
|
|
98
|
-
body: JSON.stringify({ id: nodeId, data: initialPayload }),
|
|
99
|
-
});
|
|
100
|
-
assert(putRes.ok, `API put failed (${putRes.status})`);
|
|
101
|
-
record("API put", true);
|
|
102
|
-
|
|
103
|
-
const getRes = await fetch(
|
|
104
|
-
`${apiUrl}/api/get?id=${encodeURIComponent(nodeId)}`,
|
|
105
|
-
);
|
|
106
|
-
assert(getRes.ok, "API get failed");
|
|
107
|
-
const getJson = await getRes.json();
|
|
108
|
-
assert(getJson.text === initialPayload.text, "Unexpected API get payload");
|
|
109
|
-
record("API get", true);
|
|
110
|
-
|
|
111
|
-
const listRes = await fetch(`${apiUrl}/api/list`);
|
|
112
|
-
assert(listRes.ok, "API list failed");
|
|
113
|
-
const listJson = await listRes.json();
|
|
114
|
-
assert(
|
|
115
|
-
Array.isArray(listJson) && listJson.some((n: any) => n.id === nodeId),
|
|
116
|
-
"Node missing from API list",
|
|
117
|
-
);
|
|
118
|
-
record("API list", true);
|
|
119
|
-
|
|
120
|
-
const searchRes = await fetch(
|
|
121
|
-
`${apiUrl}/api/search?q=${encodeURIComponent("dogfood script test")}&k=5`,
|
|
122
|
-
);
|
|
123
|
-
assert(searchRes.ok, "API search failed");
|
|
124
|
-
const searchJson = await searchRes.json();
|
|
125
|
-
assert(
|
|
126
|
-
Array.isArray(searchJson) && searchJson.length > 0,
|
|
127
|
-
"Vector search returned no results",
|
|
128
|
-
);
|
|
129
|
-
record("API vector search", true);
|
|
130
|
-
|
|
131
|
-
const updatePayload = {
|
|
132
|
-
type: "DogfoodTest",
|
|
133
|
-
text: "Hello from the updated dogfooding script",
|
|
134
|
-
};
|
|
135
|
-
const putUpdate = await fetch(`${apiUrl}/api/put`, {
|
|
136
|
-
method: "POST",
|
|
137
|
-
headers: { "content-type": "application/json" },
|
|
138
|
-
body: JSON.stringify({ id: nodeId, data: updatePayload }),
|
|
139
|
-
});
|
|
140
|
-
assert(putUpdate.ok, "API put update failed");
|
|
141
|
-
record("API update", true);
|
|
142
|
-
|
|
143
|
-
const historyRes = await fetch(
|
|
144
|
-
`${apiUrl}/api/history?id=${encodeURIComponent(nodeId)}`,
|
|
145
|
-
);
|
|
146
|
-
assert(historyRes.ok, "API history failed");
|
|
147
|
-
const historyJson = await historyRes.json();
|
|
148
|
-
assert(
|
|
149
|
-
Array.isArray(historyJson) && historyJson.length >= 2,
|
|
150
|
-
"API history missing versions",
|
|
151
|
-
);
|
|
152
|
-
record("API history", true, `${historyJson.length} versions`);
|
|
153
|
-
|
|
154
|
-
const restoreTimestamp = historyJson.at(-1)?.timestamp ??
|
|
155
|
-
historyJson[historyJson.length - 1]?.timestamp;
|
|
156
|
-
assert(
|
|
157
|
-
typeof restoreTimestamp === "number",
|
|
158
|
-
"Failed to locate restore timestamp",
|
|
159
|
-
);
|
|
160
|
-
const restoreRes = await fetch(
|
|
161
|
-
`${apiUrl}/api/restore?id=${
|
|
162
|
-
encodeURIComponent(nodeId)
|
|
163
|
-
}×tamp=${restoreTimestamp}`,
|
|
164
|
-
);
|
|
165
|
-
assert(restoreRes.ok, "API restore failed");
|
|
166
|
-
record("API restore", true);
|
|
167
|
-
|
|
168
|
-
const restored = await (
|
|
169
|
-
await fetch(`${apiUrl}/api/get?id=${encodeURIComponent(nodeId)}`)
|
|
170
|
-
).json();
|
|
171
|
-
assert(
|
|
172
|
-
restored.text === initialPayload.text,
|
|
173
|
-
"Restore did not revert payload",
|
|
174
|
-
);
|
|
175
|
-
record("API post-restore verification", true);
|
|
176
|
-
|
|
177
|
-
const instancesRes = await fetch(
|
|
178
|
-
`${apiUrl}/api/instances?type=${encodeURIComponent("DogfoodTest")}`,
|
|
179
|
-
);
|
|
180
|
-
assert(instancesRes.ok, "API instances failed");
|
|
181
|
-
const instancesJson = await instancesRes.json();
|
|
182
|
-
assert(
|
|
183
|
-
Array.isArray(instancesJson) &&
|
|
184
|
-
instancesJson.some((n: any) => n.id === nodeId),
|
|
185
|
-
"Instances endpoint missing node",
|
|
186
|
-
);
|
|
187
|
-
record("API type instances", true);
|
|
188
|
-
|
|
189
|
-
const webRes = await fetch(`${apiUrl}/`);
|
|
190
|
-
assert(webRes.ok, "Web UI endpoint failed");
|
|
191
|
-
const webHtml = await webRes.text();
|
|
192
|
-
record("Web UI fetch", true, `${webHtml.length} chars`);
|
|
193
|
-
|
|
194
|
-
const cliId = "dogfood:cli";
|
|
195
|
-
const cliPut = await runCli([
|
|
196
|
-
"put",
|
|
197
|
-
cliId,
|
|
198
|
-
JSON.stringify({ type: "DogfoodTest", text: "CLI write" }),
|
|
199
|
-
"--kv",
|
|
200
|
-
kvPath,
|
|
201
|
-
]);
|
|
202
|
-
assert(cliPut.code === 0, `CLI put failed: ${cliPut.stderr}`);
|
|
203
|
-
record("CLI put", true);
|
|
204
|
-
|
|
205
|
-
const cliGet = await runCli(["get", cliId, "--kv", kvPath]);
|
|
206
|
-
assert(cliGet.code === 0, `CLI get failed: ${cliGet.stderr}`);
|
|
207
|
-
const cliGetJson = JSON.parse(cliGet.stdout.trim() || "null");
|
|
208
|
-
assert(cliGetJson?.text === "CLI write", "CLI get returned wrong payload");
|
|
209
|
-
record("CLI get", true);
|
|
210
|
-
|
|
211
|
-
const cliList = await runCli(["list", "--kv", kvPath]);
|
|
212
|
-
assert(cliList.code === 0, `CLI list failed: ${cliList.stderr}`);
|
|
213
|
-
const cliListJson = JSON.parse(cliList.stdout.trim() || "[]");
|
|
214
|
-
assert(
|
|
215
|
-
Array.isArray(cliListJson) && cliListJson.length >= 2,
|
|
216
|
-
"CLI list missing entries",
|
|
217
|
-
);
|
|
218
|
-
record("CLI list", true);
|
|
219
|
-
|
|
220
|
-
const cliSearch = await runCli([
|
|
221
|
-
"vsearch",
|
|
222
|
-
"dogfooding",
|
|
223
|
-
"5",
|
|
224
|
-
"--kv",
|
|
225
|
-
kvPath,
|
|
226
|
-
]);
|
|
227
|
-
assert(cliSearch.code === 0, `CLI vsearch failed: ${cliSearch.stderr}`);
|
|
228
|
-
const cliSearchJson = JSON.parse(cliSearch.stdout.trim() || "[]");
|
|
229
|
-
assert(
|
|
230
|
-
Array.isArray(cliSearchJson) && cliSearchJson.length > 0,
|
|
231
|
-
"CLI vsearch returned no results",
|
|
232
|
-
);
|
|
233
|
-
record("CLI vector search", true);
|
|
234
|
-
|
|
235
|
-
console.log("\n🎉 Dogfooding run succeeded!");
|
|
236
|
-
} catch (error) {
|
|
237
|
-
record(
|
|
238
|
-
"Dogfooding run",
|
|
239
|
-
false,
|
|
240
|
-
error instanceof Error ? error.message : String(error),
|
|
241
|
-
);
|
|
242
|
-
await finalize();
|
|
243
|
-
console.log("\n❌ Dogfooding run failed");
|
|
244
|
-
console.log(error);
|
|
245
|
-
Deno.exit(1);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
await finalize();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
async function runCli(args: string[]) {
|
|
252
|
-
const command = new Deno.Command("deno", {
|
|
253
|
-
args: [
|
|
254
|
-
"run",
|
|
255
|
-
"-A",
|
|
256
|
-
"--unstable-kv",
|
|
257
|
-
"--no-lock",
|
|
258
|
-
"legacy/main.ts",
|
|
259
|
-
...args,
|
|
260
|
-
],
|
|
261
|
-
stdout: "piped",
|
|
262
|
-
stderr: "piped",
|
|
263
|
-
});
|
|
264
|
-
const { code, stdout, stderr } = await command.output();
|
|
265
|
-
return {
|
|
266
|
-
code,
|
|
267
|
-
stdout: new TextDecoder().decode(stdout),
|
|
268
|
-
stderr: new TextDecoder().decode(stderr),
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
async function waitFor(
|
|
273
|
-
fn: () => Promise<boolean>,
|
|
274
|
-
opts: { timeoutMs: number; intervalMs: number },
|
|
275
|
-
) {
|
|
276
|
-
const deadline = Date.now() + opts.timeoutMs;
|
|
277
|
-
while (Date.now() < deadline) {
|
|
278
|
-
if (await fn()) return;
|
|
279
|
-
await sleep(opts.intervalMs);
|
|
280
|
-
}
|
|
281
|
-
throw new Error("Timed out waiting for condition");
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function sleep(ms: number): Promise<void>;
|
|
285
|
-
function sleep<T>(ms: number, value: T): Promise<T>;
|
|
286
|
-
function sleep(ms: number, value?: unknown) {
|
|
287
|
-
return new Promise((resolve) => {
|
|
288
|
-
const timer = setTimeout(() => {
|
|
289
|
-
clearTimeout(timer);
|
|
290
|
-
resolve(value);
|
|
291
|
-
}, ms);
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if ((import.meta as any).main) {
|
|
296
|
-
await main();
|
|
297
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Publish all PluresDB crates to crates.io
|
|
3
|
-
# Usage: ./scripts/publish-crates.sh
|
|
4
|
-
|
|
5
|
-
set -e
|
|
6
|
-
|
|
7
|
-
echo "=========================================="
|
|
8
|
-
echo "Publishing PluresDB Crates to crates.io"
|
|
9
|
-
echo "=========================================="
|
|
10
|
-
echo ""
|
|
11
|
-
|
|
12
|
-
# Check if logged in
|
|
13
|
-
if ! cargo login --check 2>/dev/null; then
|
|
14
|
-
echo "Error: Not logged in to crates.io"
|
|
15
|
-
echo "Run: cargo login <your-api-token>"
|
|
16
|
-
exit 1
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
# Colors for output
|
|
20
|
-
GREEN='\033[0;32m'
|
|
21
|
-
YELLOW='\033[1;33m'
|
|
22
|
-
RED='\033[0;31m'
|
|
23
|
-
NC='\033[0m' # No Color
|
|
24
|
-
|
|
25
|
-
# Function to publish a crate
|
|
26
|
-
publish_crate() {
|
|
27
|
-
local crate_name=$1
|
|
28
|
-
local crate_path=$2
|
|
29
|
-
|
|
30
|
-
echo -e "${YELLOW}Publishing ${crate_name}...${NC}"
|
|
31
|
-
cd "$crate_path"
|
|
32
|
-
|
|
33
|
-
# Verify it builds
|
|
34
|
-
echo " Building..."
|
|
35
|
-
if ! cargo build --release > /dev/null 2>&1; then
|
|
36
|
-
echo -e "${RED} ✗ Build failed${NC}"
|
|
37
|
-
return 1
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
# Run tests
|
|
41
|
-
echo " Running tests..."
|
|
42
|
-
if ! cargo test > /dev/null 2>&1; then
|
|
43
|
-
echo -e "${RED} ✗ Tests failed${NC}"
|
|
44
|
-
return 1
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
# Check package
|
|
48
|
-
echo " Checking package..."
|
|
49
|
-
if ! cargo package > /dev/null 2>&1; then
|
|
50
|
-
echo -e "${RED} ✗ Package check failed${NC}"
|
|
51
|
-
return 1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
# Publish
|
|
55
|
-
echo " Publishing to crates.io..."
|
|
56
|
-
if cargo publish; then
|
|
57
|
-
echo -e "${GREEN} ✓ ${crate_name} published successfully${NC}"
|
|
58
|
-
cd - > /dev/null
|
|
59
|
-
return 0
|
|
60
|
-
else
|
|
61
|
-
echo -e "${RED} ✗ Publishing failed${NC}"
|
|
62
|
-
cd - > /dev/null
|
|
63
|
-
return 1
|
|
64
|
-
fi
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
# Publish in dependency order
|
|
68
|
-
echo "Publishing crates in dependency order..."
|
|
69
|
-
echo ""
|
|
70
|
-
|
|
71
|
-
# Note: pluresdb-core and pluresdb-sync are already published
|
|
72
|
-
# Uncomment if you need to republish them:
|
|
73
|
-
# publish_crate "pluresdb-core" "crates/pluresdb-core"
|
|
74
|
-
# publish_crate "pluresdb-sync" "crates/pluresdb-sync"
|
|
75
|
-
|
|
76
|
-
# Publish storage (depends on core)
|
|
77
|
-
publish_crate "pluresdb-storage" "crates/pluresdb-storage"
|
|
78
|
-
echo ""
|
|
79
|
-
|
|
80
|
-
# Publish unified main crate (depends on core, storage, sync)
|
|
81
|
-
publish_crate "pluresdb" "crates/pluresdb"
|
|
82
|
-
echo ""
|
|
83
|
-
|
|
84
|
-
# Publish CLI (depends on core, storage, sync)
|
|
85
|
-
publish_crate "pluresdb-cli" "crates/pluresdb-cli"
|
|
86
|
-
echo ""
|
|
87
|
-
|
|
88
|
-
echo "=========================================="
|
|
89
|
-
echo -e "${GREEN}All crates published successfully!${NC}"
|
|
90
|
-
echo "=========================================="
|
|
91
|
-
echo ""
|
|
92
|
-
echo "Note: pluresdb-node and pluresdb-deno are published separately:"
|
|
93
|
-
echo " - pluresdb-node: npm publish (in crates/pluresdb-node)"
|
|
94
|
-
echo " - pluresdb-deno: deno publish (in crates/pluresdb-deno)"
|
|
95
|
-
|
package/scripts/release-check.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pre-release validation checks
|
|
5
|
-
* Ensures the repository is ready for a release
|
|
6
|
-
*
|
|
7
|
-
* Usage: node scripts/release-check.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const { execSync } = require('child_process');
|
|
11
|
-
const fs = require('fs');
|
|
12
|
-
const path = require('path');
|
|
13
|
-
|
|
14
|
-
function run(cmd, ignoreError = false) {
|
|
15
|
-
try {
|
|
16
|
-
return execSync(cmd, { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
17
|
-
} catch (e) {
|
|
18
|
-
if (ignoreError) return null;
|
|
19
|
-
throw e;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function checkGitStatus() {
|
|
24
|
-
console.log('🔍 Checking git status...');
|
|
25
|
-
const status = run('git status --porcelain', true);
|
|
26
|
-
|
|
27
|
-
if (status && status.length > 0) {
|
|
28
|
-
console.warn('⚠️ Warning: Working directory has uncommitted changes');
|
|
29
|
-
console.log(status);
|
|
30
|
-
} else {
|
|
31
|
-
console.log('✅ Working directory is clean');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function checkPackageVersions() {
|
|
36
|
-
console.log('\n🔍 Checking package versions...');
|
|
37
|
-
|
|
38
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
39
|
-
const cargoToml = fs.readFileSync('Cargo.toml', 'utf8');
|
|
40
|
-
|
|
41
|
-
let denoVersion = null;
|
|
42
|
-
if (fs.existsSync('deno.json')) {
|
|
43
|
-
const denoJson = JSON.parse(fs.readFileSync('deno.json', 'utf8'));
|
|
44
|
-
denoVersion = denoJson.version;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const packageVersion = packageJson.version;
|
|
48
|
-
const cargoMatch = cargoToml.match(/^version\s*=\s*"([^"]+)"/m);
|
|
49
|
-
const cargoVersion = cargoMatch ? cargoMatch[1] : null;
|
|
50
|
-
|
|
51
|
-
console.log(` package.json: ${packageVersion}`);
|
|
52
|
-
console.log(` Cargo.toml: ${cargoVersion || 'not found'}`);
|
|
53
|
-
if (denoVersion) {
|
|
54
|
-
console.log(` deno.json: ${denoVersion}`);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let hasError = false;
|
|
58
|
-
|
|
59
|
-
if (cargoVersion && packageVersion !== cargoVersion) {
|
|
60
|
-
console.error('❌ Version mismatch between package.json and Cargo.toml');
|
|
61
|
-
console.error('');
|
|
62
|
-
console.error('To fix this issue:');
|
|
63
|
-
console.error(` 1. Update package.json version from ${packageVersion} to ${cargoVersion}`);
|
|
64
|
-
console.error(` OR update Cargo.toml version from ${cargoVersion} to ${packageVersion}`);
|
|
65
|
-
console.error(' 2. Ensure both files always have the same version number');
|
|
66
|
-
console.error(' 3. Run this check again: npm run release-check');
|
|
67
|
-
console.error('');
|
|
68
|
-
console.error('Note: The version in both files must be identical for releases.');
|
|
69
|
-
hasError = true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (denoVersion && packageVersion !== denoVersion) {
|
|
73
|
-
console.error('❌ Version mismatch between package.json and deno.json');
|
|
74
|
-
console.error('');
|
|
75
|
-
console.error('To fix this issue:');
|
|
76
|
-
console.error(` 1. Update deno.json version from ${denoVersion} to ${packageVersion}`);
|
|
77
|
-
console.error(` OR update package.json version from ${packageVersion} to ${denoVersion}`);
|
|
78
|
-
console.error(' 2. Ensure both files always have the same version number');
|
|
79
|
-
console.error('');
|
|
80
|
-
hasError = true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (hasError) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
console.log('✅ Package versions are consistent');
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function checkChangelog() {
|
|
92
|
-
console.log('\n🔍 Checking CHANGELOG.md...');
|
|
93
|
-
|
|
94
|
-
if (!fs.existsSync('CHANGELOG.md')) {
|
|
95
|
-
console.error('❌ CHANGELOG.md not found');
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
|
|
100
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
101
|
-
const currentVersion = packageJson.version;
|
|
102
|
-
|
|
103
|
-
if (!changelog.includes(`## [${currentVersion}]`)) {
|
|
104
|
-
console.warn(`⚠️ Warning: Current version ${currentVersion} not found in CHANGELOG.md`);
|
|
105
|
-
} else {
|
|
106
|
-
console.log(`✅ CHANGELOG.md includes current version ${currentVersion}`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function checkCommitMessages() {
|
|
113
|
-
console.log('\n🔍 Checking recent commit messages...');
|
|
114
|
-
|
|
115
|
-
const lastTag = run('git describe --tags --abbrev=0 2>/dev/null', true);
|
|
116
|
-
const range = lastTag ? `${lastTag}..HEAD` : '--all';
|
|
117
|
-
|
|
118
|
-
const commits = run(`git log --format="%s" ${range}`, true);
|
|
119
|
-
|
|
120
|
-
if (!commits) {
|
|
121
|
-
console.log('ℹ️ No commits to check');
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const commitLines = commits.split('\n').filter(Boolean);
|
|
126
|
-
const conventionalTypes = ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'ci', 'build', 'revert'];
|
|
127
|
-
|
|
128
|
-
let conventionalCount = 0;
|
|
129
|
-
commitLines.forEach(commit => {
|
|
130
|
-
const match = commit.match(/^(\w+)(\(.+\))?:/);
|
|
131
|
-
if (match && conventionalTypes.includes(match[1])) {
|
|
132
|
-
conventionalCount++;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
const percentage = (conventionalCount / commitLines.length * 100).toFixed(0);
|
|
137
|
-
console.log(` ${conventionalCount}/${commitLines.length} commits follow conventional format (${percentage}%)`);
|
|
138
|
-
|
|
139
|
-
if (conventionalCount === 0) {
|
|
140
|
-
console.warn('⚠️ Warning: No conventional commits found');
|
|
141
|
-
} else {
|
|
142
|
-
console.log('✅ Found conventional commits');
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function checkBuildStatus() {
|
|
149
|
-
console.log('\n🔍 Checking if project builds...');
|
|
150
|
-
|
|
151
|
-
try {
|
|
152
|
-
// Check if npm build works
|
|
153
|
-
console.log(' Running npm run build:lib...');
|
|
154
|
-
run('npm run build:lib');
|
|
155
|
-
console.log('✅ Build successful');
|
|
156
|
-
return true;
|
|
157
|
-
} catch (e) {
|
|
158
|
-
console.error('❌ Build failed');
|
|
159
|
-
console.error(e.message);
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function checkTests() {
|
|
165
|
-
console.log('\n🔍 Checking tests...');
|
|
166
|
-
|
|
167
|
-
try {
|
|
168
|
-
console.log(' Running tests...');
|
|
169
|
-
run('npm test');
|
|
170
|
-
console.log('✅ Tests passed');
|
|
171
|
-
return true;
|
|
172
|
-
} catch (e) {
|
|
173
|
-
console.error('❌ Tests failed');
|
|
174
|
-
console.error(e.message);
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function main() {
|
|
180
|
-
console.log('🚀 Running pre-release checks for pluresdb\n');
|
|
181
|
-
|
|
182
|
-
let allPassed = true;
|
|
183
|
-
|
|
184
|
-
try {
|
|
185
|
-
checkGitStatus();
|
|
186
|
-
|
|
187
|
-
if (!checkPackageVersions()) {
|
|
188
|
-
allPassed = false;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (!checkChangelog()) {
|
|
192
|
-
allPassed = false;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
checkCommitMessages();
|
|
196
|
-
|
|
197
|
-
// Skip build and test checks in CI for now
|
|
198
|
-
if (process.env.CI !== 'true') {
|
|
199
|
-
if (!checkBuildStatus()) {
|
|
200
|
-
allPassed = false;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (!checkTests()) {
|
|
204
|
-
allPassed = false;
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
console.log('\nℹ️ Skipping build and test checks in CI');
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
console.log('\n' + '='.repeat(50));
|
|
211
|
-
if (allPassed) {
|
|
212
|
-
console.log('✅ All pre-release checks passed!');
|
|
213
|
-
process.exit(0);
|
|
214
|
-
} else {
|
|
215
|
-
console.log('❌ Some pre-release checks failed');
|
|
216
|
-
process.exit(1);
|
|
217
|
-
}
|
|
218
|
-
} catch (e) {
|
|
219
|
-
console.error('\n❌ Pre-release check error:', e.message);
|
|
220
|
-
process.exit(1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
main();
|