@akshythere/pg-sync 1.0.0 → 1.0.1
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 +6 -6
- package/dist/commands/init.js +1 -1
- package/dist/index.js +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> PostgreSQL schema introspection that turns your database into useful code and documentation.
|
|
4
4
|
|
|
5
5
|
<p align="left">
|
|
6
|
-
<a href="https://www.npmjs.com/package/pg-sync"><img src="https://img.shields.io/npm/v/pg-sync?color=cb3837&logo=npm" alt="npm version"></a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/@akshythere/pg-sync"><img src="https://img.shields.io/npm/v/@akshythere/pg-sync?color=cb3837&logo=npm" alt="npm version"></a>
|
|
7
7
|
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0%2B-3178C6?logo=typescript&logoColor=white" alt="TypeScript 5.0+"></a>
|
|
8
8
|
<a href="https://www.postgresql.org/"><img src="https://img.shields.io/badge/PostgreSQL-12%2B-336791?logo=postgresql&logoColor=white" alt="PostgreSQL 12+"></a>
|
|
9
9
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="MIT license"></a>
|
|
@@ -50,7 +50,7 @@ flowchart LR
|
|
|
50
50
|
### Use globally
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
npm install -g pg-sync
|
|
53
|
+
npm install -g @akshythere/pg-sync
|
|
54
54
|
pgs --help
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -80,13 +80,14 @@ Example configuration:
|
|
|
80
80
|
|
|
81
81
|
```json
|
|
82
82
|
{
|
|
83
|
-
"connectionString": "postgresql://postgres:postgres@localhost:5432/mydb",
|
|
84
83
|
"schema": "public",
|
|
85
84
|
"target": "typescript",
|
|
86
85
|
"outputDir": "./src/types"
|
|
87
86
|
}
|
|
88
87
|
```
|
|
89
88
|
|
|
89
|
+
Set the connection string in `.env` as `DATABASE_URL=postgresql://user:password@localhost:5432/mydb`.
|
|
90
|
+
|
|
90
91
|
### 2. Generate files
|
|
91
92
|
|
|
92
93
|
```bash
|
|
@@ -97,8 +98,7 @@ Command-line options override values from the config file:
|
|
|
97
98
|
|
|
98
99
|
```bash
|
|
99
100
|
# TypeScript definitions
|
|
100
|
-
pgs generate -
|
|
101
|
-
-t typescript -o ./src/types
|
|
101
|
+
pgs generate -t typescript -o ./src/types
|
|
102
102
|
|
|
103
103
|
# Frappe DocTypes
|
|
104
104
|
pgs generate -t frappe -o ./doctypes
|
|
@@ -115,7 +115,7 @@ Create `pg-sync.config.json` in the project root, or pass a custom file with `-c
|
|
|
115
115
|
|
|
116
116
|
| Property | Type | Default | Description |
|
|
117
117
|
| ------------------ | -------- | ---------------- | -------------------------------- |
|
|
118
|
-
| `connectionString` | `string` |
|
|
118
|
+
| `connectionString` | `string` | `DATABASE_URL` | Optional config override |
|
|
119
119
|
| `schema` | `string` | `public` | PostgreSQL schema to inspect |
|
|
120
120
|
| `target` | `string` | `typescript` | `typescript`, `frappe`, or `erd` |
|
|
121
121
|
| `outputDir` | `string` | Target-dependent | Directory for generated files |
|
package/dist/commands/init.js
CHANGED
|
@@ -7,7 +7,7 @@ export async function runInit() {
|
|
|
7
7
|
console.log(pc.bold(pc.cyan("\n⚙️ pg-sync Initialization Wizard\n")));
|
|
8
8
|
const connectionString = await input({
|
|
9
9
|
message: "Enter PostgreSQL connection string:",
|
|
10
|
-
default:
|
|
10
|
+
default: process.env.DATABASE_URL,
|
|
11
11
|
validate: (val) => val.startsWith("postgresql://") || val.startsWith("postgres://")
|
|
12
12
|
? true
|
|
13
13
|
: "Invalid PostgreSQL URI format",
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akshythere/pg-sync",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "PostgreSQL Schema Introspector",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@inquirer/prompts": "^8.7.3",
|
|
31
31
|
"commander": "^15.0.0",
|
|
32
|
+
"dotenv": "^18.0.6",
|
|
32
33
|
"ejs": "^7.0.1",
|
|
33
34
|
"ora": "^9.4.1",
|
|
34
35
|
"pg": "^8.23.1",
|
|
@@ -44,4 +45,4 @@
|
|
|
44
45
|
"typescript": "^7.0.2",
|
|
45
46
|
"vitest": "^5.0.3"
|
|
46
47
|
}
|
|
47
|
-
}
|
|
48
|
+
}
|