@cloak-db/app 0.2.1 → 0.2.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/README.md +10 -9
- package/dist/cli.js +21 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
<a href="https://www.npmjs.com/package/@cloak-db/app">
|
|
11
11
|
<img src="https://img.shields.io/npm/v/@cloak-db/app.svg" alt="npm version">
|
|
12
12
|
</a>
|
|
13
|
-
<a href="https://github.com/
|
|
13
|
+
<a href="https://github.com/Cloak-DB/cloak-monolith/blob/main/LICENSE">
|
|
14
14
|
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
|
|
15
15
|
</a>
|
|
16
|
-
<a href="https://cloak-db.com">
|
|
16
|
+
<a href="https://www.cloak-db.com">
|
|
17
17
|
<img src="https://img.shields.io/badge/website-cloak--db.com-blue" alt="Website">
|
|
18
18
|
</a>
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
[Cloak DB](https://cloak-db.com) is an open-source, local-first database studio built for development. It helps you iterate faster with features like database snapshots, resource inspection, and data anonymization.
|
|
23
|
+
[Cloak DB](https://www.cloak-db.com) is an open-source, local-first database studio built for development. It helps you iterate faster with features like database snapshots, resource inspection, and data anonymization.
|
|
24
24
|
|
|
25
25
|
## Requirements
|
|
26
26
|
|
|
@@ -39,7 +39,8 @@ This pulls and runs the Cloak DB Docker image, making it available at [http://lo
|
|
|
39
39
|
| Flag | Description | Default |
|
|
40
40
|
|------|-------------|---------|
|
|
41
41
|
| `-p, --port <port>` | Port to run on | `3000` |
|
|
42
|
-
| `-
|
|
42
|
+
| `-t, --tag <tag>` | Docker image tag | `latest` |
|
|
43
|
+
| `-v, --version` | Show CLI version | |
|
|
43
44
|
| `-h, --help` | Show help | |
|
|
44
45
|
|
|
45
46
|
### Examples
|
|
@@ -52,15 +53,15 @@ npx @cloak-db/app
|
|
|
52
53
|
npx @cloak-db/app --port 8080
|
|
53
54
|
|
|
54
55
|
# Run specific version
|
|
55
|
-
npx @cloak-db/app --
|
|
56
|
+
npx @cloak-db/app --tag 0.1.2
|
|
56
57
|
```
|
|
57
58
|
|
|
58
59
|
## Links
|
|
59
60
|
|
|
60
|
-
- [Website](https://cloak-db.com)
|
|
61
|
-
- [Documentation](https://cloak-db.com/docs)
|
|
62
|
-
- [GitHub](https://github.com/
|
|
63
|
-
- [Report Issues](https://github.com/
|
|
61
|
+
- [Website](https://www.cloak-db.com)
|
|
62
|
+
- [Documentation](https://www.cloak-db.com/docs)
|
|
63
|
+
- [GitHub](https://github.com/Cloak-DB/cloak-monolith)
|
|
64
|
+
- [Report Issues](https://github.com/Cloak-DB/cloak-monolith/issues)
|
|
64
65
|
|
|
65
66
|
## License
|
|
66
67
|
|
package/dist/cli.js
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { spawn, execSync } from "child_process";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
import { join } from "path";
|
|
5
7
|
import { parseArgs } from "util";
|
|
6
8
|
var IMAGE_NAME = "ghcr.io/cloak-db/app";
|
|
7
9
|
var DEFAULT_PORT = 3e3;
|
|
10
|
+
var CLI_VERSION = "0.2.4";
|
|
8
11
|
function printHelp() {
|
|
9
12
|
console.log(`
|
|
10
13
|
Cloak DB - Local-first database studio
|
|
@@ -13,13 +16,14 @@ Usage: cloak-app [options]
|
|
|
13
16
|
|
|
14
17
|
Options:
|
|
15
18
|
-p, --port <port> Port to run on (default: ${DEFAULT_PORT})
|
|
16
|
-
-
|
|
19
|
+
-t, --tag <tag> Docker image tag (default: latest)
|
|
20
|
+
-v, --version Show CLI version
|
|
17
21
|
-h, --help Show this help message
|
|
18
22
|
|
|
19
23
|
Examples:
|
|
20
24
|
cloak-app # Run on port ${DEFAULT_PORT}
|
|
21
25
|
cloak-app --port 8080 # Run on port 8080
|
|
22
|
-
cloak-app --
|
|
26
|
+
cloak-app --tag v0.2.0 # Run specific version
|
|
23
27
|
|
|
24
28
|
Requirements:
|
|
25
29
|
Docker must be installed and running.
|
|
@@ -31,13 +35,15 @@ function parseCliArgs() {
|
|
|
31
35
|
const { values } = parseArgs({
|
|
32
36
|
options: {
|
|
33
37
|
port: { type: "string", short: "p", default: String(DEFAULT_PORT) },
|
|
34
|
-
|
|
38
|
+
tag: { type: "string", short: "t", default: "latest" },
|
|
39
|
+
version: { type: "boolean", short: "v", default: false },
|
|
35
40
|
help: { type: "boolean", short: "h", default: false }
|
|
36
41
|
},
|
|
37
42
|
allowPositionals: false
|
|
38
43
|
});
|
|
39
44
|
return {
|
|
40
45
|
port: parseInt(values.port, 10),
|
|
46
|
+
tag: values.tag,
|
|
41
47
|
version: values.version,
|
|
42
48
|
help: values.help
|
|
43
49
|
};
|
|
@@ -63,8 +69,10 @@ function checkDockerRunning() {
|
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
function runContainer(options) {
|
|
66
|
-
const image = `${IMAGE_NAME}:${options.
|
|
72
|
+
const image = `${IMAGE_NAME}:${options.tag}`;
|
|
67
73
|
const containerName = `cloak-app-${Date.now()}`;
|
|
74
|
+
const hostConfigDir = join(homedir(), ".config", "cloak-db");
|
|
75
|
+
const containerConfigDir = "/home/nextjs/.config/cloak-db";
|
|
68
76
|
console.log(`
|
|
69
77
|
\u{1F680} Starting Cloak DB on port ${options.port}...`);
|
|
70
78
|
console.log(` Image: ${image}
|
|
@@ -74,10 +82,15 @@ function runContainer(options) {
|
|
|
74
82
|
[
|
|
75
83
|
"run",
|
|
76
84
|
"--rm",
|
|
85
|
+
"--pull",
|
|
86
|
+
"always",
|
|
77
87
|
"--name",
|
|
78
88
|
containerName,
|
|
79
89
|
"-p",
|
|
80
90
|
`${options.port}:3000`,
|
|
91
|
+
"-v",
|
|
92
|
+
`${hostConfigDir}:${containerConfigDir}`,
|
|
93
|
+
"--add-host=host.docker.internal:host-gateway",
|
|
81
94
|
image
|
|
82
95
|
],
|
|
83
96
|
{ stdio: "inherit" }
|
|
@@ -101,6 +114,10 @@ function runContainer(options) {
|
|
|
101
114
|
}
|
|
102
115
|
function main() {
|
|
103
116
|
const options = parseCliArgs();
|
|
117
|
+
if (options.version) {
|
|
118
|
+
console.log(CLI_VERSION);
|
|
119
|
+
process.exit(0);
|
|
120
|
+
}
|
|
104
121
|
if (options.help) {
|
|
105
122
|
printHelp();
|
|
106
123
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloak-db/app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Run Cloak DB locally with Docker",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/
|
|
23
|
+
"url": "https://github.com/Cloak-DB/cloak-monolith.git",
|
|
24
24
|
"directory": "packages/cli"
|
|
25
25
|
},
|
|
26
|
-
"homepage": "https://cloak-db.com",
|
|
26
|
+
"homepage": "https://www.cloak-db.com",
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
28
|
+
"node": ">=22"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.0.0",
|