udsl-sdk 1.0.2 → 1.0.4
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/cli/index.js +11 -0
- package/cli/installer.js +42 -0
- package/package.json +6 -2
package/cli/index.js
ADDED
package/cli/installer.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const { execSync } = require("child_process");
|
|
2
|
+
|
|
3
|
+
function run(cmd) {
|
|
4
|
+
return execSync(cmd, { stdio: "inherit" });
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function start() {
|
|
8
|
+
console.log("🚀 Starting UDSL...");
|
|
9
|
+
|
|
10
|
+
// STEP 1: Check Docker
|
|
11
|
+
try {
|
|
12
|
+
run("docker --version");
|
|
13
|
+
} catch (e) {
|
|
14
|
+
console.log("❌ Docker is not installed");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// STEP 2: Pull or build image
|
|
19
|
+
try {
|
|
20
|
+
console.log("📦 Pulling UDSL image...");
|
|
21
|
+
run("docker pull udsl-server");
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.log("⚠️ Image not found. Building locally...");
|
|
24
|
+
run("docker build -t udsl-server .");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// STEP 3: Stop old container if exists
|
|
28
|
+
try {
|
|
29
|
+
run("docker stop udsl-server");
|
|
30
|
+
run("docker rm udsl-server");
|
|
31
|
+
} catch (e) {}
|
|
32
|
+
|
|
33
|
+
// STEP 4: Run container
|
|
34
|
+
console.log("🔥 Starting server...");
|
|
35
|
+
run(
|
|
36
|
+
"docker run -d -p 3001:3001 --name udsl-server udsl-server"
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
console.log("✅ UDSL running at http://localhost:3001");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = { start };
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "udsl-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Crash-safe data recovery SDK (WAL + Snapshot based)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"cli"
|
|
9
10
|
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"udsl": "./cli/index.js"
|
|
13
|
+
},
|
|
10
14
|
"scripts": {
|
|
11
15
|
"build": "tsc",
|
|
12
16
|
"prepublishOnly": "npm run build"
|