erdbpro 2.4.2 → 2.4.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/package.json +2 -2
- package/src/cli.mjs +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "erdbpro",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "ERD Builder Pro CLI — one command to start your database design workspace.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"repository": "hadziqmtqn/erd-builder-pro"
|
|
33
|
-
}
|
|
33
|
+
}
|
package/src/cli.mjs
CHANGED
|
@@ -8,16 +8,22 @@ import { spawn } from 'node:child_process';
|
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
|
|
10
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
// Dev: cli/src/cli.mjs → pkg at ../.. Prod: src/cli.mjs → pkg at ..
|
|
12
|
+
const ROOT = (() => {
|
|
13
|
+
const a = path.resolve(__dirname, '../..'); // dev (cli/)
|
|
14
|
+
const b = path.resolve(__dirname, '..'); // prod (pkg root)
|
|
15
|
+
return fs.existsSync(path.join(b, 'dist-server', 'index.js')) ? b
|
|
16
|
+
: fs.existsSync(path.join(a, 'dist-server', 'index.js')) ? a
|
|
17
|
+
: b;
|
|
18
|
+
})();
|
|
19
|
+
const PKG_ROOT = ROOT;
|
|
14
20
|
const DATA_DIR = path.join(os.homedir(), '.erdbpro');
|
|
15
21
|
const DB_PATH = path.join(DATA_DIR, 'data.db');
|
|
16
22
|
const PID_FILE = path.join(DATA_DIR, 'server.pid');
|
|
17
23
|
const DEFAULT_PORT = 3101;
|
|
18
24
|
|
|
19
25
|
// Read version from package.json
|
|
20
|
-
const pkgJson = JSON.parse(fs.readFileSync(path.join(
|
|
26
|
+
const pkgJson = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
21
27
|
const VERSION = pkgJson.version;
|
|
22
28
|
const UPDATE_URL = 'https://registry.npmjs.org/erdbpro/latest';
|
|
23
29
|
|