pgpm 0.1.1 → 0.2.0
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 +16 -11
- package/commands/clear.js +1 -1
- package/commands/init/module.js +2 -2
- package/commands/migrate/deps.js +2 -2
- package/commands/migrate/list.js +2 -2
- package/commands/migrate/status.js +2 -2
- package/esm/commands/clear.js +1 -1
- package/esm/commands/init/module.js +2 -2
- package/esm/commands/migrate/deps.js +2 -2
- package/esm/commands/migrate/list.js +2 -2
- package/esm/commands/migrate/status.js +2 -2
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
# pgpm
|
|
1
|
+
# **pgpm — a Postgres Package Manager**
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**A modern CLI for modular PostgreSQL development.**
|
|
4
4
|
|
|
5
|
-
`pgpm` is a focused command-line tool for PostgreSQL database migrations and package management. It provides the core functionality for managing database schemas, migrations, and module dependencies
|
|
5
|
+
`pgpm` is a focused command-line tool for PostgreSQL database migrations and package management. It provides the core functionality for managing database schemas, migrations, and module dependencies.
|
|
6
6
|
|
|
7
7
|
## ✨ Features
|
|
8
8
|
|
|
9
|
-
- 📦 **Module System**
|
|
10
|
-
- 🔄 **
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- 📦 **Postgres Module System** — Reusable, composable database packages with dependency management, per-module plans, and versioned releases
|
|
10
|
+
- 🔄 **Deterministic Migration Engine** — Version-controlled, plan-driven deployments with rollback support and idempotent execution enforced by dependency and validation safeguards.
|
|
11
|
+
- 📊 **Recursive Module Resolution** — Recursively resolves database package dependencies (just like npm) from plan files or SQL headers, producing a reproducible cross-module migration graph.
|
|
12
|
+
- 🏷️ **Tag-Aware Versioning** - Deploy to @tags, resolve tags to changes, and reference tags across modules for coordinated releases
|
|
13
|
+
- 🐘 **Portable Postgres Development** — Rely on standard SQL migrations for a workflow that runs anywhere Postgres does.
|
|
14
|
+
- 🚀 **Turnkey Module-First Workspaces** — `pgpm init` delivers a ready-to-code Postgres workspace with CI/CD, Docker, end-to-end testing, and modern TS tooling.
|
|
15
|
+
|
|
13
16
|
|
|
14
17
|
## 🚀 Quick Start
|
|
15
18
|
|
|
@@ -37,7 +40,7 @@ pgpm deploy --createdb
|
|
|
37
40
|
|
|
38
41
|
### Getting Started
|
|
39
42
|
|
|
40
|
-
- `pgpm init` - Initialize a new
|
|
43
|
+
- `pgpm init` - Initialize a new module
|
|
41
44
|
- `pgpm init --workspace` - Initialize a new workspace
|
|
42
45
|
|
|
43
46
|
### Database Operations
|
|
@@ -89,6 +92,8 @@ cd my-app
|
|
|
89
92
|
pgpm init
|
|
90
93
|
|
|
91
94
|
# 3. Add some SQL migrations to sql/ directory
|
|
95
|
+
pgpm add some_change
|
|
96
|
+
|
|
92
97
|
# 4. Deploy to database
|
|
93
98
|
pgpm deploy --createdb
|
|
94
99
|
```
|
|
@@ -174,14 +179,14 @@ pgpm migrate deps
|
|
|
174
179
|
|
|
175
180
|
#### `pgpm install`
|
|
176
181
|
|
|
177
|
-
Install
|
|
182
|
+
Install pgpm modules as dependencies.
|
|
178
183
|
|
|
179
184
|
```bash
|
|
180
185
|
# Install single package
|
|
181
|
-
pgpm install @
|
|
186
|
+
pgpm install @pgpm/base32
|
|
182
187
|
|
|
183
188
|
# Install multiple packages
|
|
184
|
-
pgpm install @
|
|
189
|
+
pgpm install @pgpm/base32 @pgpm/faker
|
|
185
190
|
```
|
|
186
191
|
|
|
187
192
|
#### `pgpm extension`
|
package/commands/clear.js
CHANGED
|
@@ -38,7 +38,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
38
38
|
if (!modulePath) {
|
|
39
39
|
throw new Error('Could not resolve module path');
|
|
40
40
|
}
|
|
41
|
-
const planPath = path_1.default.join(modulePath, '
|
|
41
|
+
const planPath = path_1.default.join(modulePath, 'pgpm.plan');
|
|
42
42
|
const result = (0, core_2.parsePlanFile)(planPath);
|
|
43
43
|
if (result.errors.length > 0) {
|
|
44
44
|
throw types_1.errors.PLAN_PARSE_ERROR({ planPath, errors: result.errors.map(e => e.message).join(', ') });
|
package/commands/init/module.js
CHANGED
|
@@ -13,8 +13,8 @@ async function runModuleSetup(argv, prompter) {
|
|
|
13
13
|
log.error('Not inside a LaunchQL workspace.');
|
|
14
14
|
throw types_1.errors.NOT_IN_WORKSPACE({});
|
|
15
15
|
}
|
|
16
|
-
if (!project.isInsideAllowedDirs(cwd) && !project.isInWorkspace()) {
|
|
17
|
-
log.error('You must be inside
|
|
16
|
+
if (!project.isInsideAllowedDirs(cwd) && !project.isInWorkspace() && !project.isParentOfAllowedDirs(cwd)) {
|
|
17
|
+
log.error('You must be inside the workspace root or a parent directory of modules (like packages/).');
|
|
18
18
|
throw types_1.errors.NOT_IN_WORKSPACE_MODULE({});
|
|
19
19
|
}
|
|
20
20
|
const availExtensions = project.getAvailableModules();
|
package/commands/migrate/deps.js
CHANGED
|
@@ -10,9 +10,9 @@ const database_1 = require("../../utils/database");
|
|
|
10
10
|
const log = new logger_1.Logger('migrate-deps');
|
|
11
11
|
exports.default = async (argv, prompter, options) => {
|
|
12
12
|
const cwd = argv.cwd || process.cwd();
|
|
13
|
-
const planPath = (0, path_1.join)(cwd, '
|
|
13
|
+
const planPath = (0, path_1.join)(cwd, 'pgpm.plan');
|
|
14
14
|
if (!(0, fs_1.existsSync)(planPath)) {
|
|
15
|
-
log.error(`No
|
|
15
|
+
log.error(`No pgpm.plan found in ${cwd}`);
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
18
|
// Get specific change to analyze
|
package/commands/migrate/list.js
CHANGED
|
@@ -10,9 +10,9 @@ const database_1 = require("../../utils/database");
|
|
|
10
10
|
const log = new logger_1.Logger('migrate-list');
|
|
11
11
|
exports.default = async (argv, prompter, options) => {
|
|
12
12
|
const cwd = argv.cwd || process.cwd();
|
|
13
|
-
const planPath = (0, path_1.join)(cwd, '
|
|
13
|
+
const planPath = (0, path_1.join)(cwd, 'pgpm.plan');
|
|
14
14
|
if (!(0, fs_1.existsSync)(planPath)) {
|
|
15
|
-
log.error(`No
|
|
15
|
+
log.error(`No pgpm.plan found in ${cwd}`);
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
18
|
// Get database configuration
|
|
@@ -10,9 +10,9 @@ const database_1 = require("../../utils/database");
|
|
|
10
10
|
const log = new logger_1.Logger('migrate-status');
|
|
11
11
|
exports.default = async (argv, prompter, options) => {
|
|
12
12
|
const cwd = argv.cwd || process.cwd();
|
|
13
|
-
const planPath = (0, path_1.join)(cwd, '
|
|
13
|
+
const planPath = (0, path_1.join)(cwd, 'pgpm.plan');
|
|
14
14
|
if (!(0, fs_1.existsSync)(planPath)) {
|
|
15
|
-
log.error(`No
|
|
15
|
+
log.error(`No pgpm.plan found in ${cwd}`);
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
18
|
// Get database configuration
|
package/esm/commands/clear.js
CHANGED
|
@@ -33,7 +33,7 @@ export default async (argv, prompter, _options) => {
|
|
|
33
33
|
if (!modulePath) {
|
|
34
34
|
throw new Error('Could not resolve module path');
|
|
35
35
|
}
|
|
36
|
-
const planPath = path.join(modulePath, '
|
|
36
|
+
const planPath = path.join(modulePath, 'pgpm.plan');
|
|
37
37
|
const result = parsePlanFile(planPath);
|
|
38
38
|
if (result.errors.length > 0) {
|
|
39
39
|
throw errors.PLAN_PARSE_ERROR({ planPath, errors: result.errors.map(e => e.message).join(', ') });
|
|
@@ -10,8 +10,8 @@ export default async function runModuleSetup(argv, prompter) {
|
|
|
10
10
|
log.error('Not inside a LaunchQL workspace.');
|
|
11
11
|
throw errors.NOT_IN_WORKSPACE({});
|
|
12
12
|
}
|
|
13
|
-
if (!project.isInsideAllowedDirs(cwd) && !project.isInWorkspace()) {
|
|
14
|
-
log.error('You must be inside
|
|
13
|
+
if (!project.isInsideAllowedDirs(cwd) && !project.isInWorkspace() && !project.isParentOfAllowedDirs(cwd)) {
|
|
14
|
+
log.error('You must be inside the workspace root or a parent directory of modules (like packages/).');
|
|
15
15
|
throw errors.NOT_IN_WORKSPACE_MODULE({});
|
|
16
16
|
}
|
|
17
17
|
const availExtensions = project.getAvailableModules();
|
|
@@ -8,9 +8,9 @@ import { getTargetDatabase } from '../../utils/database';
|
|
|
8
8
|
const log = new Logger('migrate-deps');
|
|
9
9
|
export default async (argv, prompter, options) => {
|
|
10
10
|
const cwd = argv.cwd || process.cwd();
|
|
11
|
-
const planPath = join(cwd, '
|
|
11
|
+
const planPath = join(cwd, 'pgpm.plan');
|
|
12
12
|
if (!existsSync(planPath)) {
|
|
13
|
-
log.error(`No
|
|
13
|
+
log.error(`No pgpm.plan found in ${cwd}`);
|
|
14
14
|
process.exit(1);
|
|
15
15
|
}
|
|
16
16
|
// Get specific change to analyze
|
|
@@ -8,9 +8,9 @@ import { getTargetDatabase } from '../../utils/database';
|
|
|
8
8
|
const log = new Logger('migrate-list');
|
|
9
9
|
export default async (argv, prompter, options) => {
|
|
10
10
|
const cwd = argv.cwd || process.cwd();
|
|
11
|
-
const planPath = join(cwd, '
|
|
11
|
+
const planPath = join(cwd, 'pgpm.plan');
|
|
12
12
|
if (!existsSync(planPath)) {
|
|
13
|
-
log.error(`No
|
|
13
|
+
log.error(`No pgpm.plan found in ${cwd}`);
|
|
14
14
|
process.exit(1);
|
|
15
15
|
}
|
|
16
16
|
// Get database configuration
|
|
@@ -8,9 +8,9 @@ import { getTargetDatabase } from '../../utils/database';
|
|
|
8
8
|
const log = new Logger('migrate-status');
|
|
9
9
|
export default async (argv, prompter, options) => {
|
|
10
10
|
const cwd = argv.cwd || process.cwd();
|
|
11
|
-
const planPath = join(cwd, '
|
|
11
|
+
const planPath = join(cwd, 'pgpm.plan');
|
|
12
12
|
if (!existsSync(planPath)) {
|
|
13
|
-
log.error(`No
|
|
13
|
+
log.error(`No pgpm.plan found in ${cwd}`);
|
|
14
14
|
process.exit(1);
|
|
15
15
|
}
|
|
16
16
|
// Get database configuration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgpm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "PostgreSQL Package Manager - Database migration and package management CLI",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"copy": "copyfiles -f ../../LICENSE README.md package.json dist",
|
|
27
27
|
"clean": "rimraf dist/**",
|
|
28
|
-
"
|
|
28
|
+
"prepack": "npm run build",
|
|
29
29
|
"build": "npm run clean; tsc -p tsconfig.json; tsc -p tsconfig.esm.json; npm run copy",
|
|
30
30
|
"build:dev": "npm run clean; tsc -p tsconfig.json --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
|
|
31
31
|
"dev": "ts-node ./src/index.ts",
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"ts-node": "^10.9.2"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@launchql/core": "^2.
|
|
49
|
-
"@launchql/env": "^2.
|
|
50
|
-
"@launchql/logger": "^1.1.
|
|
51
|
-
"@launchql/templatizer": "^2.
|
|
52
|
-
"@launchql/types": "^2.
|
|
48
|
+
"@launchql/core": "^2.15.0",
|
|
49
|
+
"@launchql/env": "^2.5.0",
|
|
50
|
+
"@launchql/logger": "^1.1.4",
|
|
51
|
+
"@launchql/templatizer": "^2.5.0",
|
|
52
|
+
"@launchql/types": "^2.8.0",
|
|
53
53
|
"chalk": "^4.1.0",
|
|
54
54
|
"inquirerer": "^2.0.8",
|
|
55
55
|
"js-yaml": "^4.1.0",
|
|
56
56
|
"minimist": "^1.2.8",
|
|
57
|
-
"pg-cache": "^1.
|
|
58
|
-
"pg-env": "^1.1.
|
|
57
|
+
"pg-cache": "^1.4.0",
|
|
58
|
+
"pg-env": "^1.1.2",
|
|
59
59
|
"shelljs": "^0.9.2"
|
|
60
60
|
},
|
|
61
61
|
"keywords": [
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"pg",
|
|
71
71
|
"pgsql"
|
|
72
72
|
],
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "810621bb74659b75a5360634c9cf91bf0996ce19"
|
|
74
74
|
}
|