@farhan0431/db-snap 0.3.7 → 0.3.8
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/bin/dbsnap.js +22 -45
- package/binaries/aarch64-apple-darwin/dbsnap +0 -0
- package/binaries/aarch64-unknown-linux-gnu/dbsnap +0 -0
- package/binaries/x86_64-apple-darwin/dbsnap +0 -0
- package/binaries/x86_64-pc-windows-msvc/dbsnap.exe +0 -0
- package/binaries/x86_64-unknown-linux-gnu/dbsnap +0 -0
- package/binaries/x86_64-unknown-linux-musl/dbsnap +0 -0
- package/package.json +3 -10
package/bin/dbsnap.js
CHANGED
|
@@ -1,57 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
// declares per-platform packages (db-snap-<platform>-<arch>) as
|
|
6
|
-
// optionalDependencies; npm installs only the matching one and this script
|
|
7
|
-
// finds and execs it, passing stdin/stdout through untouched (required for
|
|
8
|
-
// MCP mode).
|
|
9
|
-
|
|
4
|
+
// Run the binary bundled for this operating system and architecture.
|
|
10
5
|
const { spawn } = require("child_process");
|
|
11
6
|
const path = require("path");
|
|
12
7
|
const fs = require("fs");
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"darwin-arm64": ["db-snap-darwin-arm64"],
|
|
17
|
-
"darwin-x64": ["db-snap-darwin-x64"],
|
|
18
|
-
"linux-x64": ["db-snap-linux-x64-gnu", "db-snap-linux-x64-musl"],
|
|
19
|
-
"linux-arm64": ["db-snap-linux-arm64"],
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
function fail(msg) {
|
|
23
|
-
console.error("dbsnap: " + msg);
|
|
9
|
+
function fail(message) {
|
|
10
|
+
console.error("dbsnap: " + message);
|
|
24
11
|
process.exit(1);
|
|
25
12
|
}
|
|
26
13
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
const dir = path.dirname(pkgJson);
|
|
42
|
-
const bin = path.join(dir, "bin", process.platform === "win32" ? "dbsnap.exe" : "dbsnap");
|
|
43
|
-
if (fs.existsSync(bin)) return bin;
|
|
44
|
-
} catch {
|
|
45
|
-
// try the next candidate (e.g. musl fallback)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
fail(
|
|
49
|
-
`binary for ${target} is not installed. Reinstall with: npm i -g @farhan0431/db-snap ` +
|
|
50
|
-
`(if you installed with --no-optional / --ignore-scripts the platform package was skipped)`
|
|
51
|
-
);
|
|
14
|
+
const targets = {
|
|
15
|
+
"win32-x64": "x86_64-pc-windows-msvc",
|
|
16
|
+
"darwin-arm64": "aarch64-apple-darwin",
|
|
17
|
+
"darwin-x64": "x86_64-apple-darwin",
|
|
18
|
+
"linux-arm64": "aarch64-unknown-linux-gnu",
|
|
19
|
+
};
|
|
20
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
21
|
+
let target = targets[platform];
|
|
22
|
+
if (platform === "linux-x64") {
|
|
23
|
+
const report = process.report && process.report.getReport();
|
|
24
|
+
target = report && report.header.glibcVersionRuntime
|
|
25
|
+
? "x86_64-unknown-linux-gnu"
|
|
26
|
+
: "x86_64-unknown-linux-musl";
|
|
52
27
|
}
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
28
|
+
if (!target) fail(`no bundled binary for ${platform}`);
|
|
29
|
+
const binary = path.join(__dirname, "..", "binaries", target,
|
|
30
|
+
process.platform === "win32" ? "dbsnap.exe" : "dbsnap");
|
|
31
|
+
if (!fs.existsSync(binary)) fail(`bundled binary is missing for ${target}; reinstall @farhan0431/db-snap`);
|
|
32
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
33
|
+
child.on("error", (err) => fail(`failed to launch ${binary}: ${err.message}`));
|
|
57
34
|
child.on("close", (code) => process.exit(code ?? 1));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farhan0431/db-snap",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "Instant physical database time-machine and MCP server for AI coding agents — git commit/checkout for your local database, powered by Rust.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
7
|
"dbsnap": "bin/dbsnap.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"bin"
|
|
10
|
+
"bin",
|
|
11
|
+
"binaries"
|
|
11
12
|
],
|
|
12
13
|
"engines": {
|
|
13
14
|
"node": ">=16"
|
|
@@ -27,13 +28,5 @@
|
|
|
27
28
|
"repository": {
|
|
28
29
|
"type": "git",
|
|
29
30
|
"url": "git+https://github.com/farhan0431/db-snap.git"
|
|
30
|
-
},
|
|
31
|
-
"optionalDependencies": {
|
|
32
|
-
"@farhan0431/db-snap-win32-x64": "0.3.7",
|
|
33
|
-
"db-snap-darwin-arm64": "0.3.7",
|
|
34
|
-
"db-snap-darwin-x64": "0.3.7",
|
|
35
|
-
"db-snap-linux-x64-gnu": "0.3.7",
|
|
36
|
-
"db-snap-linux-x64-musl": "0.3.7",
|
|
37
|
-
"db-snap-linux-arm64": "0.3.7"
|
|
38
31
|
}
|
|
39
32
|
}
|