@dataramen/cli 0.0.7 → 0.0.9

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 ADDED
@@ -0,0 +1,67 @@
1
+ # 🍜 Data Ramen CLI
2
+
3
+ **Your cozy corner for exploring and working with SQL databases — no query writing required (unless you want to).**
4
+
5
+ Data Ramen CLI lets you launch a powerful, local database exploration app that connects effortlessly to MySQL and PostgreSQL databases. Browse schemas, follow relationships, insert data, and even write raw SQL — all from your browser.
6
+
7
+ ## ✨ Features
8
+
9
+ - 🔌 **Connect to PostgreSQL & MySQL**
10
+ Securely plug in your credentials — you're ready to explore.
11
+
12
+ - 🧭 **Visual Schema Explorer**
13
+ Instantly browse tables, columns, types, primary/foreign keys, and relationships.
14
+
15
+ - 🧙 **No-SQL Querying**
16
+ Filter, sort, join, and summarize data using a beautiful, intuitive interface.
17
+
18
+ - 🔗 **Follow Relationships Easily**
19
+ Click to expand related records like nested tables.
20
+
21
+ - ✏️ **Insert & Update Visually**
22
+ Add or modify rows with a visual editor — no SQL errors.
23
+
24
+ - 💾 **Save Queries**
25
+ Save your favorite views for quick access later.
26
+
27
+ - ⌨️ **Raw SQL Mode Available**
28
+ Prefer typing? Drop into SQL mode anytime and run your own queries.
29
+
30
+ ## 🛠️ Installation
31
+
32
+ ### 1. Install Node.js
33
+
34
+ Data Ramen requires Node.js **v22 or above**.
35
+ 👉 [Download Node.js](https://nodejs.org/)
36
+
37
+ ### 2. Install Data Ramen CLI
38
+
39
+ Open your terminal and run:
40
+
41
+ ```bash
42
+ npm i -g @dataramen/cli
43
+ ```
44
+
45
+ ## 🖥️ Usage
46
+
47
+ ### Start the Local Server
48
+
49
+ ```bash
50
+ dataramen start
51
+ ```
52
+
53
+ ### Open the App
54
+
55
+ Go to https://app.dataramen.xyz in your browser. Your local server will connect automatically.
56
+
57
+ ## 🔧 Additional CLI Commands
58
+
59
+ | Command | Description |
60
+ | ----------------- | --------------------------------- |
61
+ | `dataramen start` | Start the local Data Ramen server |
62
+ | `dataramen stop` | Stop the local server |
63
+ | `dataramen logs` | Show logs from the running server |
64
+
65
+ ## ❤️ Made with love by [Oleksandr Demian](https://github.com/OleksandrDemian)
66
+
67
+ Visit [dataramen.xyz](https://dataramen.xyz) for more info.
package/bin/run.js CHANGED
@@ -11,7 +11,9 @@ const processName = "@dataramen/local-server";
11
11
  const homeDir = os.homedir();
12
12
  const filesPath = path.join(homeDir, ".dataramen", ".runtime", "server");
13
13
 
14
- const scriptPkg = fs.readJsonSync(path.join(__dirname, "..", "package.json"));
14
+ const scriptPkg = useJson(path.join(__dirname, "..", "package.json"));
15
+ const serverPkg = useJson(path.join(filesPath, "package.json"));
16
+
15
17
  const protocol = "dataramen://";
16
18
 
17
19
  yargs()
@@ -23,7 +25,7 @@ yargs()
23
25
 
24
26
  start();
25
27
  })
26
- .command("logs", 'Listen for logs', () => {
28
+ .command(["logs"], 'Listen for logs', () => {
27
29
  execSync(`pm2 logs ${processName}`, {
28
30
  stdio: "inherit",
29
31
  });
@@ -38,10 +40,25 @@ yargs()
38
40
  require(path.join(__dirname, "..", "dist", "code", "register.windows.js")).unregister();
39
41
  }
40
42
  })
43
+ .command(["version"], 'Show version', () => {
44
+ console.log(`Data ramen CLI version: ${scriptPkg().version}`);
45
+ console.log(`Data ramen local server version: ${serverPkg().version}`);
46
+ })
41
47
  .parse(isBrowserStart() ? getBrowserArgs() : yargsHelpers.hideBin(process.argv));
42
48
 
43
- function isInstallation () {
44
- return scriptPkg.name === "@dataramen/cli";
49
+ function shouldInstall () {
50
+ try {
51
+ const installedProxyPkjJson = serverPkg();
52
+
53
+ if (!installedProxyPkjJson) {
54
+ return true;
55
+ }
56
+
57
+ const thisProxyPkgJson = fs.readJsonSync(path.join(__dirname, '..', 'dist', "package.json"));
58
+ return installedProxyPkjJson.version !== thisProxyPkgJson.version; // version are different, install new code
59
+ } catch (e) {
60
+ return true;
61
+ }
45
62
  }
46
63
 
47
64
  function isBrowserStart () {
@@ -80,17 +97,17 @@ function stopExisting () {
80
97
  } catch (e) {}
81
98
  }
82
99
 
83
- function registerServer () {
84
- try {
85
- if (os.platform() === "win32") {
86
- require(path.join(__dirname, "..", "dist", "code", "register.windows.js")).register();
87
- }
88
-
89
- console.log("Custom protocol handler registered");
90
- } catch (e) {
91
- console.log("Failed to register server", e);
92
- }
93
- }
100
+ // function registerServer () {
101
+ // try {
102
+ // if (os.platform() === "win32") {
103
+ // require(path.join(__dirname, "..", "dist", "code", "register.windows.js")).register();
104
+ // }
105
+ //
106
+ // console.log("Custom protocol handler registered");
107
+ // } catch (e) {
108
+ // console.log("Failed to register server", e);
109
+ // }
110
+ // }
94
111
 
95
112
  function installServer () {
96
113
  console.log("Installing Server");
@@ -107,16 +124,14 @@ function installServer () {
107
124
  });
108
125
  console.log("Server installed");
109
126
 
110
- registerServer();
127
+ // registerServer();
111
128
  }
112
129
 
113
130
  function start () {
114
131
  stopExisting();
115
132
 
116
133
  try {
117
- if (isInstallation()) {
118
- // only install if script is running from @dataramen/cli package
119
- // if not, it means it was already installed, and the script is running from within the server folder
134
+ if (shouldInstall()) {
120
135
  installServer();
121
136
  }
122
137
 
@@ -129,7 +144,26 @@ function start () {
129
144
 
130
145
  console.log(`Local server will be available in a couple of seconds`);
131
146
  console.log(`You can close this window`);
147
+ console.log(`Visit https://app.dataramen.xyz`);
132
148
  } catch (e) {
133
149
  console.error(`Failed to start local server`, e);
134
150
  }
135
151
  }
152
+
153
+ function useJson (path) {
154
+ let file = undefined;
155
+
156
+ function get () {
157
+ try {
158
+ if (!file) {
159
+ file = fs.readJsonSync(path);
160
+ }
161
+
162
+ return file;
163
+ } catch (e) {
164
+ return undefined;
165
+ }
166
+ }
167
+
168
+ return get;
169
+ }
package/dist/README.md ADDED
File without changes
package/dist/code/cli.js CHANGED
@@ -11,7 +11,9 @@ const processName = "@dataramen/local-server";
11
11
  const homeDir = os.homedir();
12
12
  const filesPath = path.join(homeDir, ".dataramen", ".runtime", "server");
13
13
 
14
- const scriptPkg = fs.readJsonSync(path.join(__dirname, "..", "package.json"));
14
+ const scriptPkg = useJson(path.join(__dirname, "..", "package.json"));
15
+ const serverPkg = useJson(path.join(filesPath, "package.json"));
16
+
15
17
  const protocol = "dataramen://";
16
18
 
17
19
  yargs()
@@ -23,7 +25,7 @@ yargs()
23
25
 
24
26
  start();
25
27
  })
26
- .command("logs", 'Listen for logs', () => {
28
+ .command(["logs"], 'Listen for logs', () => {
27
29
  execSync(`pm2 logs ${processName}`, {
28
30
  stdio: "inherit",
29
31
  });
@@ -38,10 +40,25 @@ yargs()
38
40
  require(path.join(__dirname, "..", "dist", "code", "register.windows.js")).unregister();
39
41
  }
40
42
  })
43
+ .command(["version"], 'Show version', () => {
44
+ console.log(`Data ramen CLI version: ${scriptPkg().version}`);
45
+ console.log(`Data ramen local server version: ${serverPkg().version}`);
46
+ })
41
47
  .parse(isBrowserStart() ? getBrowserArgs() : yargsHelpers.hideBin(process.argv));
42
48
 
43
- function isInstallation () {
44
- return scriptPkg.name === "@dataramen/cli";
49
+ function shouldInstall () {
50
+ try {
51
+ const installedProxyPkjJson = serverPkg();
52
+
53
+ if (!installedProxyPkjJson) {
54
+ return true;
55
+ }
56
+
57
+ const thisProxyPkgJson = fs.readJsonSync(path.join(__dirname, '..', 'dist', "package.json"));
58
+ return installedProxyPkjJson.version !== thisProxyPkgJson.version; // version are different, install new code
59
+ } catch (e) {
60
+ return true;
61
+ }
45
62
  }
46
63
 
47
64
  function isBrowserStart () {
@@ -80,17 +97,17 @@ function stopExisting () {
80
97
  } catch (e) {}
81
98
  }
82
99
 
83
- function registerServer () {
84
- try {
85
- if (os.platform() === "win32") {
86
- require(path.join(__dirname, "..", "dist", "code", "register.windows.js")).register();
87
- }
88
-
89
- console.log("Custom protocol handler registered");
90
- } catch (e) {
91
- console.log("Failed to register server", e);
92
- }
93
- }
100
+ // function registerServer () {
101
+ // try {
102
+ // if (os.platform() === "win32") {
103
+ // require(path.join(__dirname, "..", "dist", "code", "register.windows.js")).register();
104
+ // }
105
+ //
106
+ // console.log("Custom protocol handler registered");
107
+ // } catch (e) {
108
+ // console.log("Failed to register server", e);
109
+ // }
110
+ // }
94
111
 
95
112
  function installServer () {
96
113
  console.log("Installing Server");
@@ -107,16 +124,14 @@ function installServer () {
107
124
  });
108
125
  console.log("Server installed");
109
126
 
110
- registerServer();
127
+ // registerServer();
111
128
  }
112
129
 
113
130
  function start () {
114
131
  stopExisting();
115
132
 
116
133
  try {
117
- if (isInstallation()) {
118
- // only install if script is running from @dataramen/cli package
119
- // if not, it means it was already installed, and the script is running from within the server folder
134
+ if (shouldInstall()) {
120
135
  installServer();
121
136
  }
122
137
 
@@ -129,7 +144,26 @@ function start () {
129
144
 
130
145
  console.log(`Local server will be available in a couple of seconds`);
131
146
  console.log(`You can close this window`);
147
+ console.log(`Visit https://app.dataramen.xyz`);
132
148
  } catch (e) {
133
149
  console.error(`Failed to start local server`, e);
134
150
  }
135
151
  }
152
+
153
+ function useJson (path) {
154
+ let file = undefined;
155
+
156
+ function get () {
157
+ try {
158
+ if (!file) {
159
+ file = fs.readJsonSync(path);
160
+ }
161
+
162
+ return file;
163
+ } catch (e) {
164
+ return undefined;
165
+ }
166
+ }
167
+
168
+ return get;
169
+ }
package/dist/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@dataramen/local-server","version":"0.0.33","license":"MIT","main":"code/proxy.js","dependencies":{"@fastify/cors":"^11.0.1","dotenv":"^16.5.0","fast-glob":"^3.3.3","fastify":"^5.3.2","mysql2":"^3.14.1","pg":"^8.15.6","sqlite3":"^5.1.7","typeorm":"^0.3.23"},"devDependencies":{"yargs":"^18.0.0","fs-extra":"^11.3.0"}}
1
+ {"name":"@dataramen/local-server","version":"0.0.34","license":"MIT","main":"code/proxy.js","dependencies":{"@fastify/cors":"^11.0.1","dotenv":"^16.5.0","fast-glob":"^3.3.3","fastify":"^5.3.2","mysql2":"^3.14.1","pg":"^8.15.6","sqlite3":"^5.1.7","typeorm":"^0.3.23"},"devDependencies":{"fs-extra":"^11.3.0","yargs":"^18.0.0"}}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@dataramen/cli",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "license": "MIT",
5
5
  "bin": {
6
- "dataramen-cli": "bin/run.js"
6
+ "dataramen": "bin/run.js"
7
7
  },
8
8
  "scripts": {
9
9
  "build": "node build.js"
10
10
  },
11
11
  "dependencies": {
12
- "yargs": "^18.0.0",
13
- "fs-extra": "^11.3.0"
12
+ "fs-extra": "^11.3.0",
13
+ "yargs": "^18.0.0"
14
14
  },
15
15
  "files": [
16
16
  "dist/"