@plures/pluresdb 1.5.3 โ 2.9.6
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 +106 -414
- 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/napi/index.js +60 -0
- package/embedded.d.ts +1 -0
- package/embedded.js +46 -0
- package/package.json +27 -10
- package/dist/.tsbuildinfo +0 -1
- package/dist/better-sqlite3-shared.d.ts +0 -12
- package/dist/better-sqlite3-shared.d.ts.map +0 -1
- package/dist/better-sqlite3-shared.js +0 -143
- package/dist/better-sqlite3-shared.js.map +0 -1
- package/dist/better-sqlite3.d.ts +0 -4
- package/dist/better-sqlite3.d.ts.map +0 -1
- package/dist/better-sqlite3.js +0 -8
- package/dist/better-sqlite3.js.map +0 -1
- package/dist/cli.d.ts +0 -7
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/node-index.d.ts +0 -148
- package/dist/node-index.d.ts.map +0 -1
- package/dist/node-index.js +0 -665
- package/dist/node-index.js.map +0 -1
- package/dist/node-wrapper.d.ts +0 -44
- package/dist/node-wrapper.d.ts.map +0 -1
- package/dist/node-wrapper.js +0 -296
- package/dist/node-wrapper.js.map +0 -1
- package/dist/types/index.d.ts +0 -28
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/node-types.d.ts +0 -71
- package/dist/types/node-types.d.ts.map +0 -1
- package/dist/types/node-types.js +0 -6
- package/dist/types/node-types.js.map +0 -1
- package/dist/vscode/extension.d.ts +0 -81
- package/dist/vscode/extension.d.ts.map +0 -1
- package/dist/vscode/extension.js +0 -309
- package/dist/vscode/extension.js.map +0 -1
- 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/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 -438
- package/legacy/index.ts +0 -28
- 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 -823
- package/legacy/node-wrapper.ts +0 -329
- 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/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 -14
- 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/postinstall.js +0 -156
- 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/web/README.md +0 -27
- package/web/svelte/package.json +0 -31
package/scripts/postinstall.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-install script for PluresDB npm package
|
|
3
|
-
* This script ensures Deno is available and sets up the environment
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { spawn, exec } = require("child_process");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
const os = require("os");
|
|
10
|
-
|
|
11
|
-
const DENO_VERSION = "1.40.0";
|
|
12
|
-
|
|
13
|
-
function log(message) {
|
|
14
|
-
console.log(`[pluresdb] ${message}`);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function logError(message) {
|
|
18
|
-
console.error(`[pluresdb] ERROR: ${message}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function isDenoInstalled() {
|
|
22
|
-
return new Promise((resolve) => {
|
|
23
|
-
exec("deno --version", (error) => {
|
|
24
|
-
resolve(!error);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function installDeno() {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
const platform = os.platform();
|
|
32
|
-
const arch = os.arch();
|
|
33
|
-
|
|
34
|
-
log("Installing Deno...");
|
|
35
|
-
|
|
36
|
-
let installCommand;
|
|
37
|
-
|
|
38
|
-
if (platform === "win32") {
|
|
39
|
-
// Windows - use PowerShell
|
|
40
|
-
installCommand =
|
|
41
|
-
`powershell -c "iwr https://deno.land/install.ps1 -useb | iex"`;
|
|
42
|
-
} else if (platform === "darwin") {
|
|
43
|
-
// macOS - use Homebrew or curl
|
|
44
|
-
installCommand = "curl -fsSL https://deno.land/install.sh | sh";
|
|
45
|
-
} else {
|
|
46
|
-
// Linux - use curl
|
|
47
|
-
installCommand = "curl -fsSL https://deno.land/install.sh | sh";
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
exec(installCommand, (error, stdout, stderr) => {
|
|
51
|
-
if (error) {
|
|
52
|
-
logError(`Failed to install Deno: ${error.message}`);
|
|
53
|
-
logError("Please install Deno manually from https://deno.land/");
|
|
54
|
-
reject(error);
|
|
55
|
-
} else {
|
|
56
|
-
log("Deno installed successfully");
|
|
57
|
-
resolve();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function createStartScript() {
|
|
64
|
-
const scriptContent = `#!/bin/bash
|
|
65
|
-
# PluresDB start script
|
|
66
|
-
export DENO_INSTALL="$HOME/.deno"
|
|
67
|
-
export PATH="$DENO_INSTALL/bin:$PATH"
|
|
68
|
-
|
|
69
|
-
# Start PluresDB
|
|
70
|
-
deno run -A "${path.join(__dirname, "../src/main.ts")}" serve "$@"
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
const scriptPath = path.join(__dirname, "../bin/pluresdb.sh");
|
|
74
|
-
const scriptDir = path.dirname(scriptPath);
|
|
75
|
-
|
|
76
|
-
if (!fs.existsSync(scriptDir)) {
|
|
77
|
-
fs.mkdirSync(scriptDir, { recursive: true });
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fs.writeFileSync(scriptPath, scriptContent);
|
|
81
|
-
fs.chmodSync(scriptPath, "755");
|
|
82
|
-
|
|
83
|
-
log("Created start script");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function createWindowsStartScript() {
|
|
87
|
-
const scriptContent = `@echo off
|
|
88
|
-
REM PluresDB start script for Windows
|
|
89
|
-
set DENO_INSTALL=%USERPROFILE%\\.deno
|
|
90
|
-
set PATH=%DENO_INSTALL%\\bin;%PATH%
|
|
91
|
-
|
|
92
|
-
REM Start PluresDB
|
|
93
|
-
deno run -A "${path.join(__dirname, "../src/main.ts")}" serve %*
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
const scriptPath = path.join(__dirname, "../bin/pluresdb.bat");
|
|
97
|
-
const scriptDir = path.dirname(scriptPath);
|
|
98
|
-
|
|
99
|
-
if (!fs.existsSync(scriptDir)) {
|
|
100
|
-
fs.mkdirSync(scriptDir, { recursive: true });
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
fs.writeFileSync(scriptPath, scriptContent);
|
|
104
|
-
|
|
105
|
-
log("Created Windows start script");
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
async function main() {
|
|
109
|
-
try {
|
|
110
|
-
log("Setting up PluresDB...");
|
|
111
|
-
|
|
112
|
-
// Check if Deno is installed
|
|
113
|
-
const denoInstalled = await isDenoInstalled();
|
|
114
|
-
|
|
115
|
-
if (!denoInstalled) {
|
|
116
|
-
log("Deno not found, attempting to install...");
|
|
117
|
-
try {
|
|
118
|
-
await installDeno();
|
|
119
|
-
} catch {
|
|
120
|
-
logError("Failed to install Deno automatically");
|
|
121
|
-
logError("Please install Deno manually:");
|
|
122
|
-
logError(" Windows: iwr https://deno.land/install.ps1 -useb | iex");
|
|
123
|
-
logError(" macOS/Linux: curl -fsSL https://deno.land/install.sh | sh");
|
|
124
|
-
logError(" Or visit: https://deno.land/");
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
log("Deno is already installed");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Create start scripts
|
|
132
|
-
createStartScript();
|
|
133
|
-
if (os.platform() === "win32") {
|
|
134
|
-
createWindowsStartScript();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Create data directory
|
|
138
|
-
const dataDir = path.join(os.homedir(), ".pluresdb");
|
|
139
|
-
if (!fs.existsSync(dataDir)) {
|
|
140
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
141
|
-
log(`Created data directory: ${dataDir}`);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
log("Setup complete!");
|
|
145
|
-
log("Usage:");
|
|
146
|
-
log(" npx pluresdb serve");
|
|
147
|
-
log(" or");
|
|
148
|
-
log(" node node_modules/pluresdb/dist/cli.js serve");
|
|
149
|
-
} catch (error) {
|
|
150
|
-
logError(`Setup failed: ${error.message}`);
|
|
151
|
-
Deno.exit(1);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Run the setup
|
|
156
|
-
main();
|
|
@@ -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();
|
package/scripts/run-tests.ts
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S deno run -A --unstable-kv
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
|
-
interface TestSuite {
|
|
6
|
-
name: string;
|
|
7
|
-
command: string;
|
|
8
|
-
description: string;
|
|
9
|
-
timeout?: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface TestResults {
|
|
13
|
-
suite: string;
|
|
14
|
-
passed: boolean;
|
|
15
|
-
duration: number;
|
|
16
|
-
output: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
class TestRunner {
|
|
21
|
-
private results: TestResults[] = [];
|
|
22
|
-
|
|
23
|
-
async runTestSuite(suite: TestSuite): Promise<TestResults> {
|
|
24
|
-
console.log(`\n๐งช Running ${suite.name}...`);
|
|
25
|
-
console.log(` ${suite.description}`);
|
|
26
|
-
|
|
27
|
-
const startTime = performance.now();
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const command = new Deno.Command("deno", {
|
|
31
|
-
args: suite.command.split(" "),
|
|
32
|
-
stdout: "piped",
|
|
33
|
-
stderr: "piped",
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const { code, stdout, stderr } = await command.output();
|
|
37
|
-
const duration = performance.now() - startTime;
|
|
38
|
-
|
|
39
|
-
const output = new TextDecoder().decode(stdout);
|
|
40
|
-
const error = new TextDecoder().decode(stderr);
|
|
41
|
-
|
|
42
|
-
const result: TestResults = {
|
|
43
|
-
suite: suite.name,
|
|
44
|
-
passed: code === 0,
|
|
45
|
-
duration,
|
|
46
|
-
output,
|
|
47
|
-
error: code !== 0 ? error : undefined,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
this.results.push(result);
|
|
51
|
-
|
|
52
|
-
if (result.passed) {
|
|
53
|
-
console.log(` โ
Passed (${duration.toFixed(2)}ms)`);
|
|
54
|
-
} else {
|
|
55
|
-
console.log(` โ Failed (${duration.toFixed(2)}ms)`);
|
|
56
|
-
console.log(` Error: ${result.error}`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return result;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
const duration = performance.now() - startTime;
|
|
62
|
-
|
|
63
|
-
const result: TestResults = {
|
|
64
|
-
suite: suite.name,
|
|
65
|
-
passed: false,
|
|
66
|
-
duration,
|
|
67
|
-
output: "",
|
|
68
|
-
error: error.message,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
this.results.push(result);
|
|
72
|
-
|
|
73
|
-
console.log(` โ Failed (${duration.toFixed(2)}ms)`);
|
|
74
|
-
console.log(` Error: ${error.message}`);
|
|
75
|
-
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
printSummary() {
|
|
81
|
-
console.log("\n" + "=".repeat(80));
|
|
82
|
-
console.log("TEST SUMMARY");
|
|
83
|
-
console.log("=".repeat(80));
|
|
84
|
-
|
|
85
|
-
const passed = this.results.filter((r) => r.passed).length;
|
|
86
|
-
const total = this.results.length;
|
|
87
|
-
const totalDuration = this.results.reduce((sum, r) => sum + r.duration, 0);
|
|
88
|
-
|
|
89
|
-
console.log(`Total Tests: ${total}`);
|
|
90
|
-
console.log(`Passed: ${passed}`);
|
|
91
|
-
console.log(`Failed: ${total - passed}`);
|
|
92
|
-
console.log(`Total Duration: ${totalDuration.toFixed(2)}ms`);
|
|
93
|
-
console.log(`Success Rate: ${((passed / total) * 100).toFixed(1)}%`);
|
|
94
|
-
|
|
95
|
-
console.log("\nDetailed Results:");
|
|
96
|
-
this.results.forEach((result) => {
|
|
97
|
-
const status = result.passed ? "โ
" : "โ";
|
|
98
|
-
console.log(
|
|
99
|
-
` ${status} ${result.suite} (${result.duration.toFixed(2)}ms)`,
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
if (passed < total) {
|
|
104
|
-
console.log("\nFailed Tests:");
|
|
105
|
-
this.results
|
|
106
|
-
.filter((r) => !r.passed)
|
|
107
|
-
.forEach((result) => {
|
|
108
|
-
console.log(`\nโ ${result.suite}:`);
|
|
109
|
-
console.log(` Error: ${result.error}`);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async function main() {
|
|
116
|
-
console.log("๐ PluresDB Test Suite Runner");
|
|
117
|
-
console.log("===============================");
|
|
118
|
-
|
|
119
|
-
const testSuites: TestSuite[] = [
|
|
120
|
-
{
|
|
121
|
-
name: "Unit Tests",
|
|
122
|
-
command: "test -A --unstable-kv --parallel src/tests/unit/",
|
|
123
|
-
description:
|
|
124
|
-
"Core functionality tests (CRUD, subscriptions, vector search)",
|
|
125
|
-
timeout: 30000,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: "Integration Tests",
|
|
129
|
-
command: "test -A --unstable-kv --parallel src/tests/integration/",
|
|
130
|
-
description: "Mesh networking and API server tests",
|
|
131
|
-
timeout: 60000,
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: "Performance Tests",
|
|
135
|
-
command: "test -A --unstable-kv --parallel src/tests/performance/",
|
|
136
|
-
description: "Load testing and performance validation",
|
|
137
|
-
timeout: 120000,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "Security Tests",
|
|
141
|
-
command: "test -A --unstable-kv --parallel src/tests/security/",
|
|
142
|
-
description: "Input validation and security testing",
|
|
143
|
-
timeout: 30000,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "Code Quality",
|
|
147
|
-
command: "lint src/",
|
|
148
|
-
description: "Code linting and style checks",
|
|
149
|
-
timeout: 10000,
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: "Type Checking",
|
|
153
|
-
command: "check src/main.ts",
|
|
154
|
-
description: "TypeScript type checking",
|
|
155
|
-
timeout: 15000,
|
|
156
|
-
},
|
|
157
|
-
];
|
|
158
|
-
|
|
159
|
-
const runner = new TestRunner();
|
|
160
|
-
|
|
161
|
-
for (const suite of testSuites) {
|
|
162
|
-
await runner.runTestSuite(suite);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
runner.printSummary();
|
|
166
|
-
|
|
167
|
-
const failedTests = runner.results.filter((r) => !r.passed).length;
|
|
168
|
-
if (failedTests > 0) {
|
|
169
|
-
console.log(`\nโ ${failedTests} test suite(s) failed!`);
|
|
170
|
-
Deno.exit(1);
|
|
171
|
-
} else {
|
|
172
|
-
console.log("\n๐ All tests passed!");
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (import.meta.main) {
|
|
177
|
-
await main();
|
|
178
|
-
}
|