@ttoss/postgresdb-cli 0.1.14 → 0.1.15

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 CHANGED
@@ -10,7 +10,7 @@ pnpm add -D @ttoss/postgresdb-cli
10
10
 
11
11
  ## Usage
12
12
 
13
- First, you need to create define the `db` object in your project using the `@ttoss/postgresdb` package. Check [@ttoss/postgresdb documentation](../postgresdb/) for more information. The CLI will use this object to load the models and interact with the database.
13
+ First, you need to create define the `db` object in your project using the `@ttoss/postgresdb` package. Check [@ttoss/postgresdb documentation](https://ttoss.dev/docs/modules/packages/postgresdb/) for more information. The CLI will use this object to load the models and interact with the database.
14
14
 
15
15
  Second, you need to define the following environment variables to connect to the database:
16
16
 
@@ -28,6 +28,16 @@ To [sync](https://sequelize.org/docs/v6/core-concepts/model-basics/#model-synchr
28
28
  pnpm dlx @ttoss/postgresdb-cli sync
29
29
  ```
30
30
 
31
+ Or you can add the command to your `package.json` scripts for easier access:
32
+
33
+ ```json
34
+ {
35
+ "scripts": {
36
+ "sync": "ttoss-postgresdb sync"
37
+ }
38
+ }
39
+ ```
40
+
31
41
  #### Options
32
42
 
33
43
  - `--db-path` or `-d`: Path to the file where the `db` object is defined. Default: `./src/db.js`.
@@ -41,6 +51,17 @@ To generate an [ERD](https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_m
41
51
  pnpm dlx @ttoss/postgresdb-cli erd
42
52
  ```
43
53
 
54
+ Or you can add the command to your `package.json` scripts for easier access:
55
+
56
+ ```json
57
+ {
58
+ "scripts": {
59
+ "erd": "ttoss-postgresdb erd"
60
+ }
61
+ }
62
+ ```
63
+
44
64
  #### Options
45
65
 
46
66
  - `--db-path` or `-d`: Path to the file where the `db` object is defined. Default: `./src/db.js`.
67
+ - `--engine`: Layout engine to use, options are "circo", "dot", "fdp", "neato", "osage", "twopi". Default to "circo"
package/dist/esm/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@ttoss/postgresdb-cli",
9
- version: "0.1.13",
9
+ version: "0.1.14",
10
10
  description: "A library to handle PostgreSQL database actions through the command line",
11
11
  license: "MIT",
12
12
  author: "ttoss",
@@ -26,14 +26,14 @@ var package_default = {
26
26
  },
27
27
  sideEffects: false,
28
28
  dependencies: {
29
- commander: "^12.1.0",
30
- dotenv: "^16.4.5",
29
+ commander: "^14.0.0",
30
+ dotenv: "^17.0.1",
31
31
  esbuild: "^0.25.5",
32
32
  "sequelize-erd": "^1.3.1"
33
33
  },
34
34
  devDependencies: {
35
35
  "@ttoss/config": "workspace:^",
36
- jest: "^30.0.2",
36
+ jest: "^30.0.4",
37
37
  tsup: "^8.5.0"
38
38
  },
39
39
  keywords: ["database", "postgres", "postgresql"],
@@ -82,14 +82,16 @@ var getDbDynamically = async ({
82
82
 
83
83
  // src/erd.ts
84
84
  var erd = async ({
85
- dbPath
85
+ dbPath,
86
+ engine
86
87
  }) => {
87
88
  console.info("Generating ERD...", dbPath);
88
89
  const db = await getDbDynamically({
89
90
  dbPath
90
91
  });
91
92
  const svg = await sequelizeErd({
92
- source: db.sequelize
93
+ source: db.sequelize,
94
+ engine
93
95
  });
94
96
  await fs.promises.writeFile("erd.svg", svg);
95
97
  console.info("ERD generated at erd.svg");
@@ -119,5 +121,5 @@ var sync = async ({
119
121
  var program = new Command();
120
122
  program.name("ttoss-postgresdb").version(package_default.version).description("ttoss postgresdb CLI");
121
123
  program.command("sync").description("Sync database").action(sync).option("--alter", "Alter sync", false).option("-d, --db-path <dbPath>", "db initialization file path", "src/db.ts");
122
- program.command("erd").description("Generate ERD").action(erd).option("-d, --db-path <dbPath>", "db initialization file path", "src/db.ts");
124
+ program.command("erd").description("Generate ERD").action(erd).option("-d, --db-path <dbPath>", "db initialization file path", "src/db.ts").option("--engine <engine>", "Layout engine to use", "circo");
123
125
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/postgresdb-cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "A library to handle PostgreSQL database actions through the command line",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -22,15 +22,15 @@
22
22
  ],
23
23
  "sideEffects": false,
24
24
  "dependencies": {
25
- "commander": "^12.1.0",
26
- "dotenv": "^16.4.5",
25
+ "commander": "^14.0.0",
26
+ "dotenv": "^17.0.1",
27
27
  "esbuild": "^0.25.5",
28
28
  "sequelize-erd": "^1.3.1"
29
29
  },
30
30
  "devDependencies": {
31
- "jest": "^30.0.2",
31
+ "jest": "^30.0.4",
32
32
  "tsup": "^8.5.0",
33
- "@ttoss/config": "^1.35.4"
33
+ "@ttoss/config": "^1.35.5"
34
34
  },
35
35
  "keywords": [
36
36
  "database",