jsql-neo 3.0.0 → 3.0.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.
Binary file
Binary file
package/lib/client.js CHANGED
@@ -4,11 +4,9 @@ const path = require('path');
4
4
  const fs = require('fs');
5
5
 
6
6
  function binPath() {
7
- const platform = process.platform;
8
- const arch = process.arch;
9
7
  const dir = path.join(__dirname, '..', 'bin');
10
- const name = platform === 'win32' ? 'jsql-neo-server.exe' : 'jsql-neo-server';
11
- return path.join(dir, `${platform}-${arch}`, name);
8
+ const name = process.platform === 'win32' ? 'jsql-neo-server.exe' : 'jsql-neo-server';
9
+ return path.join(dir, name);
12
10
  }
13
11
 
14
12
  class JSQL {
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "jsql-neo",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "JSQL-NEO — Rust-powered embedded database with REST API, B-Tree indexes, WAL, crash recovery",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "index.js",
8
8
  "lib/",
9
+ "bin/",
9
10
  "postinstall.js",
10
11
  "README.md",
11
12
  "LICENSE"
package/postinstall.js CHANGED
@@ -1,50 +1,18 @@
1
1
  const { execSync } = require('child_process');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
- const https = require('https');
5
- const os = require('os');
6
4
 
7
- const pkg = require('./package.json');
8
5
  const BIN_NAME = process.platform === 'win32' ? 'jsql-neo-server.exe' : 'jsql-neo-server';
9
- const PLATFORM = `${process.platform}-${process.arch}`;
6
+ const BP = path.join(__dirname, 'bin', BIN_NAME);
10
7
 
11
- function binDir() {
12
- return path.join(__dirname, 'bin', PLATFORM);
13
- }
14
-
15
- function binPath() {
16
- return path.join(binDir(), BIN_NAME);
17
- }
18
-
19
- async function download(url, dest) {
20
- return new Promise((resolve, reject) => {
21
- const file = fs.createWriteStream(dest);
22
- https.get(url, (res) => {
23
- if (res.statusCode >= 300 && res.headers.location) {
24
- file.close();
25
- fs.unlinkSync(dest);
26
- return download(res.headers.location, dest).then(resolve).catch(reject);
27
- }
28
- if (res.statusCode !== 200) {
29
- reject(new Error(`HTTP ${res.statusCode}`));
30
- return;
31
- }
32
- res.pipe(file);
33
- file.on('finish', () => { file.close(); fs.chmodSync(dest, 0o755); resolve(); });
34
- }).on('error', (e) => { fs.unlinkSync(dest); reject(e); });
35
- });
36
- }
37
-
38
- async function main() {
39
- const bp = binPath();
40
- if (fs.existsSync(bp)) {
41
- console.log(`[jsql-neo] binary already exists at ${bp}`);
8
+ function main() {
9
+ if (fs.existsSync(BP)) {
10
+ fs.chmodSync(BP, 0o755);
11
+ console.log(`[jsql-neo] binary ready: ${BP}`);
42
12
  return;
43
13
  }
44
14
 
45
- fs.mkdirSync(binDir(), { recursive: true });
46
-
47
- // Try to build from cargo source
15
+ // Build from source
48
16
  const serverDir = path.join(__dirname, '..', 'jsql-neo-server');
49
17
  if (fs.existsSync(path.join(serverDir, 'Cargo.toml'))) {
50
18
  console.log('[jsql-neo] building Rust server from source...');
@@ -52,8 +20,10 @@ async function main() {
52
20
  execSync('cargo build --release', { cwd: serverDir, stdio: 'inherit' });
53
21
  const src = path.join(serverDir, 'target', 'release', BIN_NAME);
54
22
  if (fs.existsSync(src)) {
55
- fs.copyFileSync(src, bp);
56
- console.log(`[jsql-neo] binary built: ${bp}`);
23
+ fs.mkdirSync(path.join(__dirname, 'bin'), { recursive: true });
24
+ fs.copyFileSync(src, BP);
25
+ fs.chmodSync(BP, 0o755);
26
+ console.log(`[jsql-neo] binary built: ${BP}`);
57
27
  return;
58
28
  }
59
29
  } catch (e) {
@@ -61,23 +31,8 @@ async function main() {
61
31
  }
62
32
  }
63
33
 
64
- // Fallback: download from GitHub releases
65
- const version = pkg.version;
66
- const url = `https://github.com/vexify/jsql-neo/releases/download/v${version}/${BIN_NAME}-${PLATFORM}`;
67
- console.log(`[jsql-neo] downloading binary from ${url}...`);
68
- try {
69
- await download(url, bp);
70
- console.log(`[jsql-neo] binary downloaded: ${bp}`);
71
- } catch (e) {
72
- console.warn(`[jsql-neo] download failed: ${e.message}`);
73
- console.warn('[jsql-neo] falling back to JS-only mode');
74
- // Create a stub that errors with a helpful message
75
- fs.writeFileSync(bp, '#!/bin/sh\necho "jsql-neo-server binary not installed"\nexit 1\n');
76
- fs.chmodSync(bp, 0o755);
77
- }
34
+ console.warn(`[jsql-neo] binary not found at ${BP}`);
35
+ console.warn('[jsql-neo] install Rust from https://rustup.rs and run: npm run build');
78
36
  }
79
37
 
80
- main().catch(e => {
81
- console.error('[jsql-neo] postinstall failed:', e.message);
82
- process.exit(1);
83
- });
38
+ main();