datapeek 0.1.1 → 0.1.3
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 +2 -2
- package/dist/cli/chunk-PTI2CUG6.js +119 -0
- package/dist/cli/dev.js +20 -4
- package/dist/cli/index.js +20 -5
- package/dist/cli/mssql-5VFXLOGV.js +18 -0
- package/dist/client/assets/index-C86X-JOX.css +1 -0
- package/dist/client/assets/index-KTL2mEVk.js +192 -0
- package/dist/client/index.html +2 -2
- package/dist/server/dev.js +17 -2
- package/dist/server/index.js +17 -2
- package/package.json +11 -2
- package/dist/client/assets/index-BKOeaWHM.js +0 -181
- package/dist/client/assets/index-D1Z3cvU6.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Datapeek - SQL Database Browser</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-KTL2mEVk.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C86X-JOX.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
package/dist/server/dev.js
CHANGED
|
@@ -11,6 +11,7 @@ import express from "express";
|
|
|
11
11
|
import cors from "cors";
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { fileURLToPath } from "url";
|
|
14
|
+
import { existsSync } from "fs";
|
|
14
15
|
|
|
15
16
|
// src/server/routes/connection.ts
|
|
16
17
|
import { Router } from "express";
|
|
@@ -326,8 +327,9 @@ async function startServer(port2, connectionString2) {
|
|
|
326
327
|
app.use("/api/connect", connectionRoutes);
|
|
327
328
|
app.use("/api/tables", tableRoutes);
|
|
328
329
|
app.use("/api/query", queryRoutes);
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
const clientDist = path.join(__dirname, "../client");
|
|
331
|
+
const clientExists = existsSync(clientDist) && existsSync(path.join(clientDist, "index.html"));
|
|
332
|
+
if (clientExists) {
|
|
331
333
|
app.use(express.static(clientDist));
|
|
332
334
|
app.get("*", (req, res) => {
|
|
333
335
|
if (req.path.startsWith("/api")) {
|
|
@@ -335,6 +337,19 @@ async function startServer(port2, connectionString2) {
|
|
|
335
337
|
}
|
|
336
338
|
res.sendFile(path.join(clientDist, "index.html"));
|
|
337
339
|
});
|
|
340
|
+
} else {
|
|
341
|
+
app.get("/", (req, res) => {
|
|
342
|
+
res.send(`
|
|
343
|
+
<html>
|
|
344
|
+
<head><title>Datapeek</title></head>
|
|
345
|
+
<body>
|
|
346
|
+
<h1>Datapeek Server</h1>
|
|
347
|
+
<p>Server is running. Please build the client with: npm run build:client</p>
|
|
348
|
+
<p>API available at: <a href="/api/health">/api/health</a></p>
|
|
349
|
+
</body>
|
|
350
|
+
</html>
|
|
351
|
+
`);
|
|
352
|
+
});
|
|
338
353
|
}
|
|
339
354
|
app.get("/api/health", (req, res) => {
|
|
340
355
|
res.json({ status: "ok", hasConnectionString: !!providedConnectionString });
|
package/dist/server/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import express from "express";
|
|
|
11
11
|
import cors from "cors";
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { fileURLToPath } from "url";
|
|
14
|
+
import { existsSync } from "fs";
|
|
14
15
|
|
|
15
16
|
// src/server/routes/connection.ts
|
|
16
17
|
import { Router } from "express";
|
|
@@ -326,8 +327,9 @@ async function startServer(port, connectionString) {
|
|
|
326
327
|
app.use("/api/connect", connectionRoutes);
|
|
327
328
|
app.use("/api/tables", tableRoutes);
|
|
328
329
|
app.use("/api/query", queryRoutes);
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
const clientDist = path.join(__dirname, "../client");
|
|
331
|
+
const clientExists = existsSync(clientDist) && existsSync(path.join(clientDist, "index.html"));
|
|
332
|
+
if (clientExists) {
|
|
331
333
|
app.use(express.static(clientDist));
|
|
332
334
|
app.get("*", (req, res) => {
|
|
333
335
|
if (req.path.startsWith("/api")) {
|
|
@@ -335,6 +337,19 @@ async function startServer(port, connectionString) {
|
|
|
335
337
|
}
|
|
336
338
|
res.sendFile(path.join(clientDist, "index.html"));
|
|
337
339
|
});
|
|
340
|
+
} else {
|
|
341
|
+
app.get("/", (req, res) => {
|
|
342
|
+
res.send(`
|
|
343
|
+
<html>
|
|
344
|
+
<head><title>Datapeek</title></head>
|
|
345
|
+
<body>
|
|
346
|
+
<h1>Datapeek Server</h1>
|
|
347
|
+
<p>Server is running. Please build the client with: npm run build:client</p>
|
|
348
|
+
<p>API available at: <a href="/api/health">/api/health</a></p>
|
|
349
|
+
</body>
|
|
350
|
+
</html>
|
|
351
|
+
`);
|
|
352
|
+
});
|
|
338
353
|
}
|
|
339
354
|
app.get("/api/health", (req, res) => {
|
|
340
355
|
res.json({ status: "ok", hasConnectionString: !!providedConnectionString });
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datapeek",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A local SQL database browser CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"datapeek": "./dist/cli/index.js"
|
|
8
8
|
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/server/index.js",
|
|
11
|
+
"./cli": "./dist/cli/index.js"
|
|
12
|
+
},
|
|
9
13
|
"engines": {
|
|
10
14
|
"node": ">=18.0.0"
|
|
11
15
|
},
|
|
@@ -22,7 +26,8 @@
|
|
|
22
26
|
"build": "npm run build:client && npm run build:server",
|
|
23
27
|
"build:client": "vite build",
|
|
24
28
|
"build:server": "tsup",
|
|
25
|
-
"prepublishOnly": "npm run build"
|
|
29
|
+
"prepublishOnly": "npm run build",
|
|
30
|
+
"postinstall": "chmod +x dist/cli/index.js || true"
|
|
26
31
|
},
|
|
27
32
|
"keywords": [
|
|
28
33
|
"sql",
|
|
@@ -33,6 +38,10 @@
|
|
|
33
38
|
],
|
|
34
39
|
"author": "",
|
|
35
40
|
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/bishoymly/datapeek"
|
|
44
|
+
},
|
|
36
45
|
"dependencies": {
|
|
37
46
|
"commander": "^12.1.0",
|
|
38
47
|
"cors": "^2.8.5",
|