@constructive-io/cli 0.0.2 → 5.1.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/LICENSE +1 -1
- package/README.md +320 -189
- package/commands/{analyze.d.ts → codegen.d.ts} +2 -2
- package/commands/codegen.js +131 -0
- package/commands/explorer.js +94 -0
- package/commands/get-graphql-schema.js +73 -0
- package/commands/server.js +187 -0
- package/commands.d.ts +0 -1
- package/commands.js +42 -61
- package/esm/commands/codegen.js +126 -0
- package/esm/commands/explorer.js +92 -0
- package/esm/commands/get-graphql-schema.js +71 -0
- package/esm/commands/server.js +185 -0
- package/esm/commands.js +41 -59
- package/esm/index.js +16 -36
- package/esm/utils/display.js +26 -23
- package/esm/utils/index.js +3 -6
- package/index.d.ts +0 -22
- package/index.js +16 -72
- package/package.json +44 -29
- package/utils/display.d.ts +1 -1
- package/utils/display.js +26 -23
- package/utils/index.d.ts +3 -6
- package/utils/index.js +7 -20
- package/commands/add.d.ts +0 -7
- package/commands/add.js +0 -86
- package/commands/admin-users/add.d.ts +0 -4
- package/commands/admin-users/add.js +0 -89
- package/commands/admin-users/bootstrap.d.ts +0 -4
- package/commands/admin-users/bootstrap.js +0 -50
- package/commands/admin-users/remove.d.ts +0 -4
- package/commands/admin-users/remove.js +0 -82
- package/commands/admin-users.d.ts +0 -4
- package/commands/admin-users.js +0 -68
- package/commands/analyze.js +0 -21
- package/commands/clear.d.ts +0 -3
- package/commands/clear.js +0 -59
- package/commands/deploy.d.ts +0 -4
- package/commands/deploy.js +0 -146
- package/commands/docker.d.ts +0 -3
- package/commands/docker.js +0 -194
- package/commands/env.d.ts +0 -4
- package/commands/env.js +0 -124
- package/commands/export.js +0 -129
- package/commands/extension.js +0 -48
- package/commands/init/index.d.ts +0 -7
- package/commands/init/index.js +0 -47
- package/commands/init/module.d.ts +0 -4
- package/commands/init/module.js +0 -71
- package/commands/init/workspace.d.ts +0 -4
- package/commands/init/workspace.js +0 -52
- package/commands/install.d.ts +0 -4
- package/commands/install.js +0 -37
- package/commands/kill.js +0 -107
- package/commands/migrate/deps.d.ts +0 -4
- package/commands/migrate/deps.js +0 -186
- package/commands/migrate/init.d.ts +0 -4
- package/commands/migrate/init.js +0 -65
- package/commands/migrate/list.d.ts +0 -4
- package/commands/migrate/list.js +0 -85
- package/commands/migrate/status.d.ts +0 -4
- package/commands/migrate/status.js +0 -94
- package/commands/migrate.d.ts +0 -4
- package/commands/migrate.js +0 -69
- package/commands/package.d.ts +0 -3
- package/commands/package.js +0 -65
- package/commands/plan.d.ts +0 -3
- package/commands/plan.js +0 -62
- package/commands/remove.d.ts +0 -3
- package/commands/remove.js +0 -42
- package/commands/rename.d.ts +0 -4
- package/commands/rename.js +0 -35
- package/commands/revert.d.ts +0 -3
- package/commands/revert.js +0 -107
- package/commands/tag.d.ts +0 -6
- package/commands/tag.js +0 -168
- package/commands/verify.d.ts +0 -3
- package/commands/verify.js +0 -85
- package/dist/README.md +0 -412
- package/dist/package.json +0 -64
- package/esm/commands/add.js +0 -51
- package/esm/commands/admin-users/add.js +0 -87
- package/esm/commands/admin-users/bootstrap.js +0 -48
- package/esm/commands/admin-users/remove.js +0 -80
- package/esm/commands/admin-users.js +0 -63
- package/esm/commands/analyze.js +0 -16
- package/esm/commands/clear.js +0 -54
- package/esm/commands/deploy.js +0 -144
- package/esm/commands/docker.js +0 -192
- package/esm/commands/env.js +0 -122
- package/esm/commands/export.js +0 -127
- package/esm/commands/extension.js +0 -46
- package/esm/commands/init/index.js +0 -42
- package/esm/commands/init/module.js +0 -68
- package/esm/commands/init/workspace.js +0 -46
- package/esm/commands/install.js +0 -35
- package/esm/commands/kill.js +0 -105
- package/esm/commands/migrate/deps.js +0 -184
- package/esm/commands/migrate/init.js +0 -63
- package/esm/commands/migrate/list.js +0 -83
- package/esm/commands/migrate/status.js +0 -92
- package/esm/commands/migrate.js +0 -64
- package/esm/commands/package.js +0 -63
- package/esm/commands/plan.js +0 -60
- package/esm/commands/remove.js +0 -40
- package/esm/commands/rename.js +0 -30
- package/esm/commands/revert.js +0 -105
- package/esm/commands/tag.js +0 -133
- package/esm/commands/verify.js +0 -83
- package/esm/package.js +0 -26
- package/esm/utils/argv.js +0 -92
- package/esm/utils/cli-error.js +0 -48
- package/esm/utils/database.js +0 -78
- package/esm/utils/deployed-changes.js +0 -68
- package/esm/utils/module-utils.js +0 -51
- package/package.d.ts +0 -1
- package/package.js +0 -29
- package/utils/argv.d.ts +0 -46
- package/utils/argv.js +0 -100
- package/utils/cli-error.d.ts +0 -8
- package/utils/cli-error.js +0 -52
- package/utils/database.d.ts +0 -21
- package/utils/database.js +0 -83
- package/utils/deployed-changes.d.ts +0 -4
- package/utils/deployed-changes.js +0 -72
- package/utils/module-utils.d.ts +0 -8
- package/utils/module-utils.js +0 -54
- /package/commands/{export.d.ts → explorer.d.ts} +0 -0
- /package/commands/{extension.d.ts → get-graphql-schema.d.ts} +0 -0
- /package/commands/{kill.d.ts → server.d.ts} +0 -0
package/esm/utils/display.js
CHANGED
|
@@ -1,57 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { findAndRequirePackageJson } from 'find-and-require-package-json';
|
|
2
|
+
import yanse from 'yanse';
|
|
3
3
|
// Function to display the version information
|
|
4
4
|
export function displayVersion() {
|
|
5
|
-
const pkg =
|
|
6
|
-
console.log(
|
|
7
|
-
console.log(
|
|
5
|
+
const pkg = findAndRequirePackageJson(__dirname);
|
|
6
|
+
console.log(yanse.green(`Name: ${pkg.name}`));
|
|
7
|
+
console.log(yanse.blue(`Version: ${pkg.version}`));
|
|
8
8
|
}
|
|
9
9
|
export const usageText = `
|
|
10
|
-
Usage:
|
|
11
|
-
|
|
10
|
+
Usage: cnc <command> [options]
|
|
11
|
+
constructive <command> [options]
|
|
12
|
+
|
|
12
13
|
Core Database Operations:
|
|
13
14
|
add Add database changes to plans and create SQL files
|
|
14
15
|
deploy Deploy database changes and migrations
|
|
15
16
|
verify Verify database state and migrations
|
|
16
17
|
revert Revert database changes and migrations
|
|
17
|
-
|
|
18
|
+
|
|
18
19
|
Project Management:
|
|
19
|
-
init Initialize workspace or module
|
|
20
|
+
init Initialize pgpm workspace or module
|
|
20
21
|
extension Manage module dependencies
|
|
21
22
|
plan Generate module deployment plans
|
|
22
23
|
package Package module for distribution
|
|
24
|
+
update Update CLI/pgpm (installs pgpm by default)
|
|
25
|
+
cache Manage cached templates (clean)
|
|
26
|
+
|
|
27
|
+
Development Tools:
|
|
28
|
+
server Start a GraphQL server
|
|
29
|
+
explorer Launch GraphiQL explorer interface
|
|
30
|
+
docker Manage PostgreSQL Docker containers (start/stop)
|
|
23
31
|
export Export database migrations from existing databases
|
|
24
|
-
|
|
32
|
+
|
|
25
33
|
Database Administration:
|
|
26
34
|
kill Terminate database connections and optionally drop databases
|
|
27
|
-
install Install
|
|
35
|
+
install Install pgpm modules
|
|
28
36
|
tag Add tags to changes for versioning
|
|
29
|
-
|
|
30
|
-
remove Remove database changes
|
|
31
|
-
analyze Analyze database structure
|
|
32
|
-
rename Rename database changes
|
|
33
|
-
admin-users Manage admin users
|
|
34
|
-
|
|
37
|
+
|
|
35
38
|
Migration Tools:
|
|
36
39
|
migrate Migration management subcommands
|
|
37
40
|
init Initialize migration tracking
|
|
38
41
|
status Show migration status
|
|
39
42
|
list List all changes
|
|
40
43
|
deps Show change dependencies
|
|
41
|
-
|
|
44
|
+
|
|
42
45
|
Global Options:
|
|
43
46
|
-h, --help Display this help information
|
|
44
47
|
-v, --version Display version information
|
|
45
48
|
--cwd <directory> Working directory (default: current directory)
|
|
46
|
-
|
|
49
|
+
|
|
47
50
|
Individual Command Help:
|
|
48
51
|
constructive <command> --help Display detailed help for specific command
|
|
49
52
|
constructive <command> -h Display detailed help for specific command
|
|
50
|
-
|
|
53
|
+
|
|
51
54
|
Examples:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
cnc deploy --help Show deploy command options
|
|
56
|
+
cnc server --port 8080 Start server on port 8080
|
|
57
|
+
cnc init workspace Initialize new workspace
|
|
55
58
|
`;
|
|
56
59
|
export function displayUsage() {
|
|
57
60
|
console.log(usageText);
|
package/esm/utils/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export * from './cli-error';
|
|
5
|
-
export * from './deployed-changes';
|
|
6
|
-
export * from './module-utils';
|
|
1
|
+
export { extractFirst } from 'pgpm';
|
|
2
|
+
export { cliExitWithError } from 'pgpm';
|
|
3
|
+
export { usageText } from './display';
|
package/index.d.ts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { CLIOptions } from 'inquirerer';
|
|
3
|
-
import { createConstructiveCommandMap } from './commands';
|
|
4
|
-
export { createConstructiveCommandMap };
|
|
5
|
-
export { default as add } from './commands/add';
|
|
6
|
-
export { default as adminUsers } from './commands/admin-users';
|
|
7
|
-
export { default as analyze } from './commands/analyze';
|
|
8
|
-
export { default as clear } from './commands/clear';
|
|
9
|
-
export { default as deploy } from './commands/deploy';
|
|
10
|
-
export { default as docker } from './commands/docker';
|
|
11
|
-
export { default as env } from './commands/env';
|
|
12
|
-
export { default as _export } from './commands/export';
|
|
13
|
-
export { default as extension } from './commands/extension';
|
|
14
|
-
export { default as install } from './commands/install';
|
|
15
|
-
export { default as kill } from './commands/kill';
|
|
16
|
-
export { default as migrate } from './commands/migrate';
|
|
17
|
-
export { default as _package } from './commands/package';
|
|
18
|
-
export { default as plan } from './commands/plan';
|
|
19
|
-
export { default as remove } from './commands/remove';
|
|
20
|
-
export { default as renameCmd } from './commands/rename';
|
|
21
|
-
export { default as revert } from './commands/revert';
|
|
22
|
-
export { default as tag } from './commands/tag';
|
|
23
|
-
export { default as verify } from './commands/verify';
|
|
24
|
-
export * from './utils';
|
|
25
3
|
export declare const options: Partial<CLIOptions>;
|
package/index.js
CHANGED
|
@@ -1,68 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.options =
|
|
4
|
+
exports.options = void 0;
|
|
22
5
|
const fs_1 = require("fs");
|
|
23
6
|
const inquirerer_1 = require("inquirerer");
|
|
24
7
|
const path_1 = require("path");
|
|
25
8
|
const commands_1 = require("./commands");
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Object.defineProperty(exports, "analyze", { enumerable: true, get: function () { return __importDefault(analyze_1).default; } });
|
|
33
|
-
var clear_1 = require("./commands/clear");
|
|
34
|
-
Object.defineProperty(exports, "clear", { enumerable: true, get: function () { return __importDefault(clear_1).default; } });
|
|
35
|
-
var deploy_1 = require("./commands/deploy");
|
|
36
|
-
Object.defineProperty(exports, "deploy", { enumerable: true, get: function () { return __importDefault(deploy_1).default; } });
|
|
37
|
-
var docker_1 = require("./commands/docker");
|
|
38
|
-
Object.defineProperty(exports, "docker", { enumerable: true, get: function () { return __importDefault(docker_1).default; } });
|
|
39
|
-
var env_1 = require("./commands/env");
|
|
40
|
-
Object.defineProperty(exports, "env", { enumerable: true, get: function () { return __importDefault(env_1).default; } });
|
|
41
|
-
var export_1 = require("./commands/export");
|
|
42
|
-
Object.defineProperty(exports, "_export", { enumerable: true, get: function () { return __importDefault(export_1).default; } });
|
|
43
|
-
var extension_1 = require("./commands/extension");
|
|
44
|
-
Object.defineProperty(exports, "extension", { enumerable: true, get: function () { return __importDefault(extension_1).default; } });
|
|
45
|
-
var install_1 = require("./commands/install");
|
|
46
|
-
Object.defineProperty(exports, "install", { enumerable: true, get: function () { return __importDefault(install_1).default; } });
|
|
47
|
-
var kill_1 = require("./commands/kill");
|
|
48
|
-
Object.defineProperty(exports, "kill", { enumerable: true, get: function () { return __importDefault(kill_1).default; } });
|
|
49
|
-
var migrate_1 = require("./commands/migrate");
|
|
50
|
-
Object.defineProperty(exports, "migrate", { enumerable: true, get: function () { return __importDefault(migrate_1).default; } });
|
|
51
|
-
var package_1 = require("./commands/package");
|
|
52
|
-
Object.defineProperty(exports, "_package", { enumerable: true, get: function () { return __importDefault(package_1).default; } });
|
|
53
|
-
var plan_1 = require("./commands/plan");
|
|
54
|
-
Object.defineProperty(exports, "plan", { enumerable: true, get: function () { return __importDefault(plan_1).default; } });
|
|
55
|
-
var remove_1 = require("./commands/remove");
|
|
56
|
-
Object.defineProperty(exports, "remove", { enumerable: true, get: function () { return __importDefault(remove_1).default; } });
|
|
57
|
-
var rename_1 = require("./commands/rename");
|
|
58
|
-
Object.defineProperty(exports, "renameCmd", { enumerable: true, get: function () { return __importDefault(rename_1).default; } });
|
|
59
|
-
var revert_1 = require("./commands/revert");
|
|
60
|
-
Object.defineProperty(exports, "revert", { enumerable: true, get: function () { return __importDefault(revert_1).default; } });
|
|
61
|
-
var tag_1 = require("./commands/tag");
|
|
62
|
-
Object.defineProperty(exports, "tag", { enumerable: true, get: function () { return __importDefault(tag_1).default; } });
|
|
63
|
-
var verify_1 = require("./commands/verify");
|
|
64
|
-
Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return __importDefault(verify_1).default; } });
|
|
65
|
-
__exportStar(require("./utils"), exports);
|
|
9
|
+
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
10
|
+
const pkgPath = (0, path_1.join)(__dirname, 'package.json');
|
|
11
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf8'));
|
|
12
|
+
console.log(pkg.version);
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
66
15
|
exports.options = {
|
|
67
16
|
minimistOpts: {
|
|
68
17
|
alias: {
|
|
@@ -71,17 +20,12 @@ exports.options = {
|
|
|
71
20
|
}
|
|
72
21
|
}
|
|
73
22
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}).catch(error => {
|
|
84
|
-
console.error('Unexpected error:', error);
|
|
85
|
-
process.exit(1);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
23
|
+
const app = new inquirerer_1.CLI(commands_1.commands, exports.options);
|
|
24
|
+
app.run().then(() => {
|
|
25
|
+
// all done!
|
|
26
|
+
}).catch(error => {
|
|
27
|
+
// Should not reach here with the new CLI error handling pattern
|
|
28
|
+
// But keep as fallback for unexpected errors
|
|
29
|
+
console.error('Unexpected error:', error);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
});
|
package/package.json
CHANGED
|
@@ -1,64 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "5.1.0",
|
|
4
|
+
"author": "Constructive <developers@constructive.io>",
|
|
5
|
+
"description": "Constructive CLI",
|
|
5
6
|
"main": "index.js",
|
|
6
7
|
"module": "esm/index.js",
|
|
7
8
|
"types": "index.d.ts",
|
|
8
|
-
"
|
|
9
|
+
"homepage": "https://github.com/constructive-io/constructive",
|
|
10
|
+
"license": "MIT",
|
|
9
11
|
"publishConfig": {
|
|
10
12
|
"access": "public",
|
|
11
13
|
"directory": "dist"
|
|
12
14
|
},
|
|
13
15
|
"bin": {
|
|
16
|
+
"cnc": "index.js",
|
|
14
17
|
"constructive": "index.js"
|
|
15
18
|
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/constructive-io/constructive"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/constructive-io/constructive/issues"
|
|
25
|
+
},
|
|
16
26
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"clean": "rimraf dist/**",
|
|
27
|
+
"clean": "makage clean",
|
|
19
28
|
"prepack": "npm run build",
|
|
20
|
-
"build": "
|
|
21
|
-
"build:dev": "
|
|
29
|
+
"build": "makage build",
|
|
30
|
+
"build:dev": "makage build --dev",
|
|
22
31
|
"dev": "ts-node ./src/index.ts",
|
|
23
32
|
"lint": "eslint . --fix",
|
|
24
|
-
"test": "jest",
|
|
33
|
+
"test": "jest --passWithNoTests",
|
|
25
34
|
"test:watch": "jest --watch"
|
|
26
35
|
},
|
|
27
36
|
"devDependencies": {
|
|
28
|
-
"@types/glob": "^8.1.0",
|
|
29
37
|
"@types/js-yaml": "^4.0.9",
|
|
30
38
|
"@types/minimist": "^1.2.5",
|
|
31
39
|
"@types/node": "^20.12.7",
|
|
32
|
-
"@types/pg": "^8.
|
|
40
|
+
"@types/pg": "^8.16.0",
|
|
33
41
|
"@types/shelljs": "^0.8.16",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
42
|
+
"clean-ansi": "0.1.4",
|
|
43
|
+
"glob": "^13.0.0",
|
|
44
|
+
"makage": "^0.1.8",
|
|
45
|
+
"pg": "^8.16.3",
|
|
36
46
|
"ts-node": "^10.9.2"
|
|
37
47
|
},
|
|
38
48
|
"dependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"
|
|
45
|
-
"
|
|
49
|
+
"@constructive-io/graphql-codegen": "^2.17.11",
|
|
50
|
+
"@constructive-io/graphql-env": "^2.8.4",
|
|
51
|
+
"@constructive-io/graphql-explorer": "^2.10.5",
|
|
52
|
+
"@constructive-io/graphql-server": "^2.10.5",
|
|
53
|
+
"@pgpmjs/core": "^3.0.6",
|
|
54
|
+
"@pgpmjs/logger": "^1.3.4",
|
|
55
|
+
"@pgpmjs/server-utils": "^2.8.6",
|
|
56
|
+
"@pgpmjs/types": "^2.12.4",
|
|
57
|
+
"find-and-require-package-json": "^0.8.2",
|
|
58
|
+
"inquirerer": "^2.1.14",
|
|
46
59
|
"js-yaml": "^4.1.0",
|
|
47
60
|
"minimist": "^1.2.8",
|
|
48
|
-
"pg-cache": "1.
|
|
49
|
-
"pg-env": "1.
|
|
50
|
-
"
|
|
61
|
+
"pg-cache": "^1.6.6",
|
|
62
|
+
"pg-env": "^1.2.3",
|
|
63
|
+
"pgpm": "^1.0.4",
|
|
64
|
+
"shelljs": "^0.10.0",
|
|
65
|
+
"yanse": "^0.1.8"
|
|
51
66
|
},
|
|
52
67
|
"keywords": [
|
|
53
68
|
"cli",
|
|
54
69
|
"command-line",
|
|
55
70
|
"tool",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"migration",
|
|
59
|
-
"package-manager",
|
|
60
|
-
"database",
|
|
71
|
+
"constructive",
|
|
72
|
+
"utilities",
|
|
61
73
|
"pg",
|
|
62
|
-
"pgsql"
|
|
63
|
-
|
|
74
|
+
"pgsql",
|
|
75
|
+
"postgres",
|
|
76
|
+
"graphile"
|
|
77
|
+
],
|
|
78
|
+
"gitHead": "22cfe32e994e26a6490e04e28bab26d1e7e6345c"
|
|
64
79
|
}
|
package/utils/display.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function displayVersion(): void;
|
|
2
|
-
export declare const usageText = "\n Usage: constructive <command> [options]\n\n Core Database Operations:\n add Add database changes to plans and create SQL files\n deploy Deploy database changes and migrations\n verify Verify database state and migrations\n revert Revert database changes and migrations\n\n Project Management:\n init Initialize workspace or module\n extension Manage module dependencies\n plan Generate module deployment plans\n package Package module for distribution\n export Export database migrations from existing databases\n\n Database Administration:\n kill Terminate database connections and optionally drop databases\n install Install
|
|
2
|
+
export declare const usageText = "\n Usage: cnc <command> [options]\n constructive <command> [options]\n \n Core Database Operations:\n add Add database changes to plans and create SQL files\n deploy Deploy database changes and migrations\n verify Verify database state and migrations\n revert Revert database changes and migrations\n \n Project Management:\n init Initialize pgpm workspace or module\n extension Manage module dependencies\n plan Generate module deployment plans\n package Package module for distribution\n update Update CLI/pgpm (installs pgpm by default)\n cache Manage cached templates (clean)\n \n Development Tools:\n server Start a GraphQL server\n explorer Launch GraphiQL explorer interface\n docker Manage PostgreSQL Docker containers (start/stop)\n export Export database migrations from existing databases\n \n Database Administration:\n kill Terminate database connections and optionally drop databases\n install Install pgpm modules\n tag Add tags to changes for versioning\n \n Migration Tools:\n migrate Migration management subcommands\n init Initialize migration tracking\n status Show migration status\n list List all changes\n deps Show change dependencies\n \n Global Options:\n -h, --help Display this help information\n -v, --version Display version information\n --cwd <directory> Working directory (default: current directory)\n \n Individual Command Help:\n constructive <command> --help Display detailed help for specific command\n constructive <command> -h Display detailed help for specific command\n \n Examples:\n cnc deploy --help Show deploy command options\n cnc server --port 8080 Start server on port 8080\n cnc init workspace Initialize new workspace\n ";
|
|
3
3
|
export declare function displayUsage(): void;
|
package/utils/display.js
CHANGED
|
@@ -6,60 +6,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.usageText = void 0;
|
|
7
7
|
exports.displayVersion = displayVersion;
|
|
8
8
|
exports.displayUsage = displayUsage;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const find_and_require_package_json_1 = require("find-and-require-package-json");
|
|
10
|
+
const yanse_1 = __importDefault(require("yanse"));
|
|
11
11
|
// Function to display the version information
|
|
12
12
|
function displayVersion() {
|
|
13
|
-
const pkg = (0,
|
|
14
|
-
console.log(
|
|
15
|
-
console.log(
|
|
13
|
+
const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
|
|
14
|
+
console.log(yanse_1.default.green(`Name: ${pkg.name}`));
|
|
15
|
+
console.log(yanse_1.default.blue(`Version: ${pkg.version}`));
|
|
16
16
|
}
|
|
17
17
|
exports.usageText = `
|
|
18
|
-
Usage:
|
|
19
|
-
|
|
18
|
+
Usage: cnc <command> [options]
|
|
19
|
+
constructive <command> [options]
|
|
20
|
+
|
|
20
21
|
Core Database Operations:
|
|
21
22
|
add Add database changes to plans and create SQL files
|
|
22
23
|
deploy Deploy database changes and migrations
|
|
23
24
|
verify Verify database state and migrations
|
|
24
25
|
revert Revert database changes and migrations
|
|
25
|
-
|
|
26
|
+
|
|
26
27
|
Project Management:
|
|
27
|
-
init Initialize workspace or module
|
|
28
|
+
init Initialize pgpm workspace or module
|
|
28
29
|
extension Manage module dependencies
|
|
29
30
|
plan Generate module deployment plans
|
|
30
31
|
package Package module for distribution
|
|
32
|
+
update Update CLI/pgpm (installs pgpm by default)
|
|
33
|
+
cache Manage cached templates (clean)
|
|
34
|
+
|
|
35
|
+
Development Tools:
|
|
36
|
+
server Start a GraphQL server
|
|
37
|
+
explorer Launch GraphiQL explorer interface
|
|
38
|
+
docker Manage PostgreSQL Docker containers (start/stop)
|
|
31
39
|
export Export database migrations from existing databases
|
|
32
|
-
|
|
40
|
+
|
|
33
41
|
Database Administration:
|
|
34
42
|
kill Terminate database connections and optionally drop databases
|
|
35
|
-
install Install
|
|
43
|
+
install Install pgpm modules
|
|
36
44
|
tag Add tags to changes for versioning
|
|
37
|
-
|
|
38
|
-
remove Remove database changes
|
|
39
|
-
analyze Analyze database structure
|
|
40
|
-
rename Rename database changes
|
|
41
|
-
admin-users Manage admin users
|
|
42
|
-
|
|
45
|
+
|
|
43
46
|
Migration Tools:
|
|
44
47
|
migrate Migration management subcommands
|
|
45
48
|
init Initialize migration tracking
|
|
46
49
|
status Show migration status
|
|
47
50
|
list List all changes
|
|
48
51
|
deps Show change dependencies
|
|
49
|
-
|
|
52
|
+
|
|
50
53
|
Global Options:
|
|
51
54
|
-h, --help Display this help information
|
|
52
55
|
-v, --version Display version information
|
|
53
56
|
--cwd <directory> Working directory (default: current directory)
|
|
54
|
-
|
|
57
|
+
|
|
55
58
|
Individual Command Help:
|
|
56
59
|
constructive <command> --help Display detailed help for specific command
|
|
57
60
|
constructive <command> -h Display detailed help for specific command
|
|
58
|
-
|
|
61
|
+
|
|
59
62
|
Examples:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
cnc deploy --help Show deploy command options
|
|
64
|
+
cnc server --port 8080 Start server on port 8080
|
|
65
|
+
cnc init workspace Initialize new workspace
|
|
63
66
|
`;
|
|
64
67
|
function displayUsage() {
|
|
65
68
|
console.log(exports.usageText);
|
package/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export * from './cli-error';
|
|
5
|
-
export * from './deployed-changes';
|
|
6
|
-
export * from './module-utils';
|
|
1
|
+
export { extractFirst } from 'pgpm';
|
|
2
|
+
export { cliExitWithError } from 'pgpm';
|
|
3
|
+
export { usageText } from './display';
|
package/utils/index.js
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
exports.usageText = exports.cliExitWithError = exports.extractFirst = void 0;
|
|
4
|
+
var pgpm_1 = require("pgpm");
|
|
5
|
+
Object.defineProperty(exports, "extractFirst", { enumerable: true, get: function () { return pgpm_1.extractFirst; } });
|
|
6
|
+
var pgpm_2 = require("pgpm");
|
|
7
|
+
Object.defineProperty(exports, "cliExitWithError", { enumerable: true, get: function () { return pgpm_2.cliExitWithError; } });
|
|
8
|
+
var display_1 = require("./display");
|
|
9
|
+
Object.defineProperty(exports, "usageText", { enumerable: true, get: function () { return display_1.usageText; } });
|
package/commands/add.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
2
|
-
import { ParsedArgs } from 'minimist';
|
|
3
|
-
declare const _default: (argv: Partial<ParsedArgs>, prompter: Inquirerer, _options: CLIOptions) => Promise<{
|
|
4
|
-
_: string[];
|
|
5
|
-
"--"?: string[] | undefined;
|
|
6
|
-
}>;
|
|
7
|
-
export default _default;
|
package/commands/add.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const core_1 = require("@launchql/core");
|
|
37
|
-
const path = __importStar(require("path"));
|
|
38
|
-
const argv_1 = require("../utils/argv");
|
|
39
|
-
const addUsageText = `
|
|
40
|
-
Add Command:
|
|
41
|
-
|
|
42
|
-
constructive add [change] [OPTIONS]
|
|
43
|
-
|
|
44
|
-
Add a database change to plans and create deploy/revert/verify SQL files.
|
|
45
|
-
|
|
46
|
-
Arguments:
|
|
47
|
-
change Name of the change to create
|
|
48
|
-
|
|
49
|
-
Options:
|
|
50
|
-
--help, -h Show this help message
|
|
51
|
-
--requires <dependency> Required change (can be used multiple times)
|
|
52
|
-
--note <text> Brief note describing the purpose of the change
|
|
53
|
-
--cwd <directory> Working directory (default: current directory)
|
|
54
|
-
|
|
55
|
-
Examples:
|
|
56
|
-
constructive add organizations Add change named 'organizations'
|
|
57
|
-
constructive add brands --note "Adds the brands table" Add change with note
|
|
58
|
-
constructive add contacts --requires users --note "Adds contacts table" Add with dependency
|
|
59
|
-
constructive add be/a/path/like/this Add change with nested path
|
|
60
|
-
`;
|
|
61
|
-
exports.default = async (argv, prompter, _options) => {
|
|
62
|
-
// Show usage if explicitly requested
|
|
63
|
-
if (argv.help || argv.h) {
|
|
64
|
-
console.log(addUsageText);
|
|
65
|
-
process.exit(0);
|
|
66
|
-
}
|
|
67
|
-
const cwd = argv.cwd || process.cwd();
|
|
68
|
-
const { first: change, newArgv } = (0, argv_1.extractFirst)(argv);
|
|
69
|
-
let finalChange = change;
|
|
70
|
-
if (!change) {
|
|
71
|
-
const answers = await prompter.prompt(newArgv, [{
|
|
72
|
-
type: 'text',
|
|
73
|
-
name: 'change',
|
|
74
|
-
message: 'Change name',
|
|
75
|
-
required: true
|
|
76
|
-
}]);
|
|
77
|
-
finalChange = answers.change;
|
|
78
|
-
}
|
|
79
|
-
let dependencies = [];
|
|
80
|
-
if (argv.requires) {
|
|
81
|
-
dependencies = Array.isArray(argv.requires) ? argv.requires : [argv.requires];
|
|
82
|
-
}
|
|
83
|
-
const pkg = new core_1.LaunchQLPackage(path.resolve(cwd));
|
|
84
|
-
pkg.addChange(finalChange, dependencies.length > 0 ? dependencies : undefined, argv.note);
|
|
85
|
-
return newArgv;
|
|
86
|
-
};
|