duckerd 0.1.0 → 0.1.2
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 +3 -1
- package/dist/index.js +5 -4
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Generate an ERD diagram of the database schemas.
|
|
|
26
26
|
|
|
27
27
|
- `-d, --database <path>`: Path to the database file
|
|
28
28
|
- `-t, --theme [theme]`: Theme of the chart (choices: `default`, `forest`, `dark`, `neutral`, default: `default`)
|
|
29
|
-
- `-o, --output
|
|
29
|
+
- `-o, --output <path>`: Path to the output file
|
|
30
30
|
- `-w, --width [width]`: Width of the page (default: `1024`)
|
|
31
31
|
- `-H, --height [height]`: Height of the page (default: `768`)
|
|
32
32
|
- `-f, --outputFormat [format]`: Output format for the generated image (choices: `svg`, `png`, `pdf`, default: `png`)
|
|
@@ -36,3 +36,5 @@ Generate an ERD diagram of the database schemas.
|
|
|
36
36
|
```bash
|
|
37
37
|
duckerd -d ./mydb.duckdb -o ./erd.png -f png -t neutral -w 1600
|
|
38
38
|
```
|
|
39
|
+
|
|
40
|
+
**It's possible that you need to re-run the command after the first execution, because the DuckERD CLI automatically installs the `@mermaid-js/mermaid-cli` package globally when it's missing on your system.**
|
package/dist/index.js
CHANGED
|
@@ -47,9 +47,9 @@ program
|
|
|
47
47
|
console.error(`Error: Database file not found at ${dbPath}`);
|
|
48
48
|
process.exit(1);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
run(dbPath, options);
|
|
51
51
|
});
|
|
52
|
-
const
|
|
52
|
+
const run = async (dbPath, options) => {
|
|
53
53
|
const mermaidDiagram = await (0, erd_1.createERD)(dbPath);
|
|
54
54
|
const mermaidFile = path.resolve('schema_erd.mmd');
|
|
55
55
|
if (mermaidDiagram) {
|
|
@@ -60,14 +60,15 @@ const runErd = async (dbPath, options) => {
|
|
|
60
60
|
const width = options.width || 1024;
|
|
61
61
|
const height = options.height || 768;
|
|
62
62
|
const theme = options.theme || 'default';
|
|
63
|
-
const command = `
|
|
63
|
+
const command = `npm exec --package=@mermaid-js/mermaid-cli mmdc -- -i ${mermaidFile} -o ${outputFile} -t ${theme} -w ${width} -H ${height}`;
|
|
64
64
|
(0, child_process_1.exec)(command, (error, stdout, stderr) => {
|
|
65
65
|
if (error) {
|
|
66
66
|
console.error(`Error generating ERD: ${error.message}`);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
if (stderr) {
|
|
70
|
-
console.error(`ERD generation
|
|
70
|
+
console.error(`ERD generation: ${stderr}`);
|
|
71
|
+
console.error(`Please re-run the command!`);
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
74
|
console.log(`ERD diagram generated: ${outputFile}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "duckerd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A CLI tool for generating ERD diagrams from DuckDB databases",
|
|
5
5
|
"author": "TobiLG <tobilg@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"duckerd": "dist/index.js"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "tsc",
|
|
19
|
+
"build": "rm -rf dist && tsc",
|
|
20
20
|
"start": "ts-node src/index.ts"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
},
|
|
25
25
|
"keywords": ["duckdb", "erd", "diagram", "cli"],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@mermaid-js/mermaid-cli": "^11.1.1",
|
|
28
27
|
"commander": "^12.1.0",
|
|
29
28
|
"duckdb-async": "^1.0.0"
|
|
30
29
|
},
|