pgpm 0.0.2 → 0.1.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/LICENSE +23 -0
- package/README.md +110 -115
- package/commands/add.js +7 -7
- package/commands/admin-users/add.js +8 -8
- package/commands/admin-users/bootstrap.js +7 -7
- package/commands/admin-users/remove.js +7 -7
- package/commands/admin-users.js +5 -5
- package/commands/analyze.js +1 -1
- package/commands/clear.js +3 -3
- package/commands/deploy.js +7 -7
- package/commands/export.js +4 -4
- package/commands/extension.js +3 -3
- package/commands/init/index.js +8 -8
- package/commands/install.js +6 -6
- package/commands/kill.js +6 -6
- package/commands/migrate/init.js +1 -1
- package/commands/migrate.js +1 -1
- package/commands/package.js +4 -4
- package/commands/plan.js +5 -5
- package/commands/remove.js +2 -2
- package/commands/rename.js +1 -1
- package/commands/revert.js +7 -7
- package/commands/tag.js +6 -6
- package/commands/verify.js +7 -7
- package/commands.d.ts +1 -0
- package/commands.js +7 -16
- package/esm/commands/add.js +7 -7
- package/esm/commands/admin-users/add.js +8 -8
- package/esm/commands/admin-users/bootstrap.js +7 -7
- package/esm/commands/admin-users/remove.js +7 -7
- package/esm/commands/admin-users.js +5 -5
- package/esm/commands/analyze.js +1 -1
- package/esm/commands/clear.js +3 -3
- package/esm/commands/deploy.js +7 -7
- package/esm/commands/export.js +4 -4
- package/esm/commands/extension.js +3 -3
- package/esm/commands/init/index.js +8 -8
- package/esm/commands/init/workspace.js +1 -1
- package/esm/commands/install.js +6 -6
- package/esm/commands/kill.js +6 -6
- package/esm/commands/migrate/init.js +1 -1
- package/esm/commands/migrate.js +1 -1
- package/esm/commands/package.js +4 -4
- package/esm/commands/plan.js +5 -5
- package/esm/commands/remove.js +2 -2
- package/esm/commands/rename.js +1 -1
- package/esm/commands/revert.js +7 -7
- package/esm/commands/tag.js +6 -6
- package/esm/commands/verify.js +7 -7
- package/esm/commands.js +5 -15
- package/esm/index.js +36 -10
- package/esm/utils/cli-error.js +1 -1
- package/esm/utils/display.js +13 -13
- package/esm/utils/index.js +3 -0
- package/index.d.ts +20 -0
- package/index.js +70 -10
- package/package.json +15 -18
- package/utils/cli-error.js +1 -1
- package/utils/display.d.ts +1 -1
- package/utils/display.js +13 -13
- package/utils/index.d.ts +3 -0
- package/utils/index.js +3 -0
- package/commands/explorer.d.ts +0 -3
- package/commands/explorer.js +0 -94
- package/commands/server.d.ts +0 -3
- package/commands/server.js +0 -187
- package/dist/README.md +0 -416
- package/dist/package.json +0 -77
- package/esm/commands/explorer.js +0 -92
- package/esm/commands/server.js +0 -185
package/commands/deploy.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
|
-
const logger_1 = require("@launchql/logger");
|
|
5
4
|
const env_1 = require("@launchql/env");
|
|
5
|
+
const logger_1 = require("@launchql/logger");
|
|
6
6
|
const child_process_1 = require("child_process");
|
|
7
7
|
const pg_env_1 = require("pg-env");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const module_utils_1 = require("../utils/module-utils");
|
|
10
10
|
const deployUsageText = `
|
|
11
|
-
|
|
11
|
+
Deploy Command:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
pgpm deploy [OPTIONS]
|
|
14
14
|
|
|
15
15
|
Deploy database changes and migrations to target database.
|
|
16
16
|
|
|
@@ -28,10 +28,10 @@ Options:
|
|
|
28
28
|
--cwd <directory> Working directory (default: current directory)
|
|
29
29
|
|
|
30
30
|
Examples:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
pgpm deploy Deploy to selected database
|
|
32
|
+
pgpm deploy --createdb Deploy with database creation
|
|
33
|
+
pgpm deploy --package mypackage --to @v1.0.0 Deploy specific package to tag
|
|
34
|
+
pgpm deploy --fast --no-tx Fast deployment without transactions
|
|
35
35
|
`;
|
|
36
36
|
exports.default = async (argv, prompter, _options) => {
|
|
37
37
|
// Show usage if explicitly requested
|
package/commands/export.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
|
-
const types_1 = require("@launchql/types");
|
|
5
4
|
const env_1 = require("@launchql/env");
|
|
5
|
+
const types_1 = require("@launchql/types");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const pg_cache_1 = require("pg-cache");
|
|
8
8
|
const exportUsageText = `
|
|
9
|
-
|
|
9
|
+
Export Command:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
pgpm export [OPTIONS]
|
|
12
12
|
|
|
13
13
|
Export database migrations from existing databases.
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ Options:
|
|
|
20
20
|
--cwd <directory> Working directory (default: current directory)
|
|
21
21
|
|
|
22
22
|
Examples:
|
|
23
|
-
|
|
23
|
+
pgpm export Export migrations from selected database
|
|
24
24
|
`;
|
|
25
25
|
exports.default = async (argv, prompter, _options) => {
|
|
26
26
|
// Show usage if explicitly requested
|
package/commands/extension.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
4
|
const extensionUsageText = `
|
|
5
|
-
|
|
5
|
+
Extension Command:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
pgpm extension [OPTIONS]
|
|
8
8
|
|
|
9
9
|
Manage module dependencies.
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ Options:
|
|
|
13
13
|
--cwd <directory> Working directory (default: current directory)
|
|
14
14
|
|
|
15
15
|
Examples:
|
|
16
|
-
|
|
16
|
+
pgpm extension Manage dependencies for current module
|
|
17
17
|
`;
|
|
18
18
|
exports.default = async (argv, prompter, _options) => {
|
|
19
19
|
// Show usage if explicitly requested
|
package/commands/init/index.js
CHANGED
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const module_1 = __importDefault(require("./module"));
|
|
7
7
|
const workspace_1 = __importDefault(require("./workspace"));
|
|
8
8
|
const initUsageText = `
|
|
9
|
-
|
|
9
|
+
Init Command:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
pgpm init [OPTIONS]
|
|
12
12
|
|
|
13
|
-
Initialize
|
|
13
|
+
Initialize pgpm workspace or module.
|
|
14
14
|
|
|
15
15
|
Options:
|
|
16
16
|
--help, -h Show this help message
|
|
@@ -21,11 +21,11 @@ Options:
|
|
|
21
21
|
--from-branch <branch> Specify branch when using --repo (default: main)
|
|
22
22
|
|
|
23
23
|
Examples:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
pgpm init Initialize new module in existing workspace
|
|
25
|
+
pgpm init --workspace Initialize new workspace
|
|
26
|
+
pgpm init --repo owner/repo Use templates from GitHub repository
|
|
27
|
+
pgpm init --template-path ./custom-templates Use templates from local path
|
|
28
|
+
pgpm init --repo owner/repo --from-branch develop Use specific branch
|
|
29
29
|
`;
|
|
30
30
|
exports.default = async (argv, prompter, _options) => {
|
|
31
31
|
// Show usage if explicitly requested
|
package/commands/install.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
4
|
const installUsageText = `
|
|
5
|
-
|
|
5
|
+
Install Command:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
pgpm install <package>...
|
|
8
8
|
|
|
9
|
-
Install
|
|
9
|
+
Install pgpm modules into current module.
|
|
10
10
|
|
|
11
11
|
Arguments:
|
|
12
12
|
package One or more package names to install
|
|
@@ -16,8 +16,8 @@ Options:
|
|
|
16
16
|
--cwd <directory> Working directory (default: current directory)
|
|
17
17
|
|
|
18
18
|
Examples:
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
pgpm install @pgpm/base32 Install single package
|
|
20
|
+
pgpm install @pgpm/base32 @pgpm/utils Install multiple packages
|
|
21
21
|
`;
|
|
22
22
|
exports.default = async (argv, prompter, _options) => {
|
|
23
23
|
// Show usage if explicitly requested
|
|
@@ -31,7 +31,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
31
31
|
throw new Error('You must run this command inside a LaunchQL module.');
|
|
32
32
|
}
|
|
33
33
|
if (argv._.length === 0) {
|
|
34
|
-
throw new Error('You must provide a package name to install, e.g. `@
|
|
34
|
+
throw new Error('You must provide a package name to install, e.g. `@pgpm/base32`');
|
|
35
35
|
}
|
|
36
36
|
await project.installModules(...argv._);
|
|
37
37
|
};
|
package/commands/kill.js
CHANGED
|
@@ -4,9 +4,9 @@ const logger_1 = require("@launchql/logger");
|
|
|
4
4
|
const pg_cache_1 = require("pg-cache");
|
|
5
5
|
const log = new logger_1.Logger('db-kill');
|
|
6
6
|
const killUsageText = `
|
|
7
|
-
|
|
7
|
+
Kill Command:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pgpm kill [OPTIONS]
|
|
10
10
|
|
|
11
11
|
Terminate database connections and optionally drop databases.
|
|
12
12
|
|
|
@@ -18,10 +18,10 @@ Options:
|
|
|
18
18
|
--cwd <directory> Working directory (default: current directory)
|
|
19
19
|
|
|
20
20
|
Examples:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
pgpm kill Kill connections and drop selected databases (interactive)
|
|
22
|
+
pgpm kill --no-drop Only kill connections, preserve databases (interactive)
|
|
23
|
+
pgpm kill --pattern test_% Kill connections to databases matching 'test_%' pattern
|
|
24
|
+
pgpm kill --pattern %dev --no-drop Kill connections to databases ending with 'dev' but don't drop
|
|
25
25
|
`;
|
|
26
26
|
exports.default = async (argv, prompter, _options) => {
|
|
27
27
|
// Show usage if explicitly requested
|
package/commands/migrate/init.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
15
15
|
{
|
|
16
16
|
name: 'yes',
|
|
17
17
|
type: 'confirm',
|
|
18
|
-
message: `Initialize
|
|
18
|
+
message: `Initialize pgpm migration schema in database "${database}"?`,
|
|
19
19
|
required: true
|
|
20
20
|
}
|
|
21
21
|
];
|
package/commands/migrate.js
CHANGED
|
@@ -16,7 +16,7 @@ const subcommandMap = {
|
|
|
16
16
|
deps: deps_1.default
|
|
17
17
|
};
|
|
18
18
|
const migrateUsageText = `
|
|
19
|
-
|
|
19
|
+
Migrate Commands:
|
|
20
20
|
|
|
21
21
|
launchql migrate init Initialize migration tracking in database
|
|
22
22
|
launchql migrate status Show current migration status
|
package/commands/package.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
4
|
const packageUsageText = `
|
|
5
|
-
|
|
5
|
+
Package Command:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
pgpm package [OPTIONS]
|
|
8
8
|
|
|
9
9
|
Package module for distribution.
|
|
10
10
|
|
|
@@ -16,8 +16,8 @@ Options:
|
|
|
16
16
|
--cwd <directory> Working directory (default: current directory)
|
|
17
17
|
|
|
18
18
|
Examples:
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
pgpm package Package with defaults
|
|
20
|
+
pgpm package --no-plan Package without plan
|
|
21
21
|
`;
|
|
22
22
|
exports.default = async (argv, prompter, _options) => {
|
|
23
23
|
// Show usage if explicitly requested
|
package/commands/plan.js
CHANGED
|
@@ -4,9 +4,9 @@ const core_1 = require("@launchql/core");
|
|
|
4
4
|
const logger_1 = require("@launchql/logger");
|
|
5
5
|
const log = new logger_1.Logger('plan');
|
|
6
6
|
const planUsageText = `
|
|
7
|
-
|
|
7
|
+
Plan Command:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pgpm plan [OPTIONS]
|
|
10
10
|
|
|
11
11
|
Generate module deployment plans.
|
|
12
12
|
|
|
@@ -17,9 +17,9 @@ Options:
|
|
|
17
17
|
--cwd <directory> Working directory (default: current directory)
|
|
18
18
|
|
|
19
19
|
Examples:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
pgpm plan Generate deployment plan for current module with defaults
|
|
21
|
+
pgpm plan --includePackages false Disable including external packages
|
|
22
|
+
pgpm plan --includeTags false Do not prefer tags for external packages
|
|
23
23
|
`;
|
|
24
24
|
exports.default = async (argv, prompter, _options) => {
|
|
25
25
|
// Show usage if explicitly requested
|
package/commands/remove.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
|
-
const logger_1 = require("@launchql/logger");
|
|
5
4
|
const env_1 = require("@launchql/env");
|
|
5
|
+
const logger_1 = require("@launchql/logger");
|
|
6
6
|
const pg_env_1 = require("pg-env");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
8
|
const cli_error_1 = require("../utils/cli-error");
|
|
9
9
|
const log = new logger_1.Logger('remove');
|
|
10
10
|
exports.default = async (argv, prompter, _options) => {
|
|
11
11
|
if (!argv.to) {
|
|
12
|
-
await (0, cli_error_1.cliExitWithError)('No change specified. Usage:
|
|
12
|
+
await (0, cli_error_1.cliExitWithError)('No change specified. Usage: pgpm remove --to <change>');
|
|
13
13
|
}
|
|
14
14
|
const database = await (0, utils_1.getTargetDatabase)(argv, prompter, {
|
|
15
15
|
message: 'Select database'
|
package/commands/rename.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
6
|
const core_1 = require("@launchql/core");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const cli_error_1 = require("../utils/cli-error");
|
|
9
9
|
exports.default = async (argv, _prompter) => {
|
|
10
10
|
const cwd = argv.cwd || process.cwd();
|
package/commands/revert.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
|
-
const logger_1 = require("@launchql/logger");
|
|
5
4
|
const env_1 = require("@launchql/env");
|
|
5
|
+
const logger_1 = require("@launchql/logger");
|
|
6
6
|
const pg_env_1 = require("pg-env");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
-
const deployed_changes_1 = require("../utils/deployed-changes");
|
|
9
8
|
const cli_error_1 = require("../utils/cli-error");
|
|
9
|
+
const deployed_changes_1 = require("../utils/deployed-changes");
|
|
10
10
|
const log = new logger_1.Logger('revert');
|
|
11
11
|
const revertUsageText = `
|
|
12
|
-
|
|
12
|
+
Revert Command:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
pgpm revert [OPTIONS]
|
|
15
15
|
|
|
16
16
|
Revert database changes and migrations.
|
|
17
17
|
|
|
@@ -25,9 +25,9 @@ Options:
|
|
|
25
25
|
--cwd <directory> Working directory (default: current directory)
|
|
26
26
|
|
|
27
27
|
Examples:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
pgpm revert Revert latest changes
|
|
29
|
+
pgpm revert --to @v1.0.0 Revert to specific tag
|
|
30
|
+
pgpm revert --to Interactive selection from deployed changes
|
|
31
31
|
`;
|
|
32
32
|
exports.default = async (argv, prompter, _options) => {
|
|
33
33
|
// Show usage if explicitly requested
|
package/commands/tag.js
CHANGED
|
@@ -36,14 +36,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const core_1 = require("@launchql/core");
|
|
37
37
|
const logger_1 = require("@launchql/logger");
|
|
38
38
|
const types_1 = require("@launchql/types");
|
|
39
|
+
const path = __importStar(require("path"));
|
|
39
40
|
const argv_1 = require("../utils/argv");
|
|
40
41
|
const module_utils_1 = require("../utils/module-utils");
|
|
41
|
-
const path = __importStar(require("path"));
|
|
42
42
|
const log = new logger_1.Logger('tag');
|
|
43
43
|
const tagUsageText = `
|
|
44
|
-
|
|
44
|
+
Tag Command:
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
pgpm tag [tag_name] [OPTIONS]
|
|
47
47
|
|
|
48
48
|
Add tags to changes for versioning.
|
|
49
49
|
|
|
@@ -58,9 +58,9 @@ Options:
|
|
|
58
58
|
--cwd <directory> Working directory (default: current directory)
|
|
59
59
|
|
|
60
60
|
Examples:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
pgpm tag v1.0.0 Add tag to latest change
|
|
62
|
+
pgpm tag v1.0.0 --comment "Initial release" Add tag with comment
|
|
63
|
+
pgpm tag v1.1.0 --package mypackage --changeName my-change Tag specific change in package
|
|
64
64
|
`;
|
|
65
65
|
exports.default = async (argv, prompter, _options) => {
|
|
66
66
|
// Show usage if explicitly requested
|
package/commands/verify.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@launchql/core");
|
|
4
|
-
const logger_1 = require("@launchql/logger");
|
|
5
4
|
const env_1 = require("@launchql/env");
|
|
5
|
+
const logger_1 = require("@launchql/logger");
|
|
6
6
|
const pg_env_1 = require("pg-env");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
-
const deployed_changes_1 = require("../utils/deployed-changes");
|
|
9
8
|
const cli_error_1 = require("../utils/cli-error");
|
|
9
|
+
const deployed_changes_1 = require("../utils/deployed-changes");
|
|
10
10
|
const log = new logger_1.Logger('verify');
|
|
11
11
|
const verifyUsageText = `
|
|
12
|
-
|
|
12
|
+
Verify Command:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
pgpm verify [OPTIONS]
|
|
15
15
|
|
|
16
16
|
Verify database state matches expected migrations.
|
|
17
17
|
|
|
@@ -24,9 +24,9 @@ Options:
|
|
|
24
24
|
--cwd <directory> Working directory (default: current directory)
|
|
25
25
|
|
|
26
26
|
Examples:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
pgpm verify Verify current database state
|
|
28
|
+
pgpm verify --package mypackage Verify specific package
|
|
29
|
+
pgpm verify --to Interactive selection from deployed changes
|
|
30
30
|
`;
|
|
31
31
|
exports.default = async (argv, prompter, _options) => {
|
|
32
32
|
// Show usage if explicitly requested
|
package/commands.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
2
2
|
import { ParsedArgs } from 'minimist';
|
|
3
|
+
export declare const createPgpmCommandMap: (skipPgTeardown?: boolean) => Record<string, Function>;
|
|
3
4
|
export declare const commands: (argv: Partial<ParsedArgs>, prompter: Inquirerer, options: CLIOptions & {
|
|
4
5
|
skipPgTeardown?: boolean;
|
|
5
6
|
}) => Promise<Partial<ParsedArgs>>;
|
package/commands.js
CHANGED
|
@@ -3,14 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.commands = void 0;
|
|
6
|
+
exports.commands = exports.createPgpmCommandMap = void 0;
|
|
7
7
|
const pg_cache_1 = require("pg-cache");
|
|
8
|
-
// Commands
|
|
9
8
|
const add_1 = __importDefault(require("./commands/add"));
|
|
10
9
|
const admin_users_1 = __importDefault(require("./commands/admin-users"));
|
|
10
|
+
const analyze_1 = __importDefault(require("./commands/analyze"));
|
|
11
11
|
const clear_1 = __importDefault(require("./commands/clear"));
|
|
12
12
|
const deploy_1 = __importDefault(require("./commands/deploy"));
|
|
13
|
-
const explorer_1 = __importDefault(require("./commands/explorer"));
|
|
14
13
|
const export_1 = __importDefault(require("./commands/export"));
|
|
15
14
|
const extension_1 = __importDefault(require("./commands/extension"));
|
|
16
15
|
const init_1 = __importDefault(require("./commands/init"));
|
|
@@ -20,12 +19,10 @@ const migrate_1 = __importDefault(require("./commands/migrate"));
|
|
|
20
19
|
const package_1 = __importDefault(require("./commands/package"));
|
|
21
20
|
const plan_1 = __importDefault(require("./commands/plan"));
|
|
22
21
|
const remove_1 = __importDefault(require("./commands/remove"));
|
|
22
|
+
const rename_1 = __importDefault(require("./commands/rename"));
|
|
23
23
|
const revert_1 = __importDefault(require("./commands/revert"));
|
|
24
|
-
const server_1 = __importDefault(require("./commands/server"));
|
|
25
24
|
const tag_1 = __importDefault(require("./commands/tag"));
|
|
26
25
|
const verify_1 = __importDefault(require("./commands/verify"));
|
|
27
|
-
const analyze_1 = __importDefault(require("./commands/analyze"));
|
|
28
|
-
const rename_1 = __importDefault(require("./commands/rename"));
|
|
29
26
|
const package_2 = require("./package");
|
|
30
27
|
const utils_1 = require("./utils");
|
|
31
28
|
const cli_error_1 = require("./utils/cli-error");
|
|
@@ -39,7 +36,7 @@ const withPgTeardown = (fn, skipTeardown = false) => async (...args) => {
|
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
};
|
|
42
|
-
const
|
|
39
|
+
const createPgpmCommandMap = (skipPgTeardown = false) => {
|
|
43
40
|
const pgt = (fn) => withPgTeardown(fn, skipPgTeardown);
|
|
44
41
|
return {
|
|
45
42
|
add: add_1.default,
|
|
@@ -59,12 +56,10 @@ const createCommandMap = (skipPgTeardown = false) => {
|
|
|
59
56
|
install: pgt(install_1.default),
|
|
60
57
|
migrate: pgt(migrate_1.default),
|
|
61
58
|
analyze: pgt(analyze_1.default),
|
|
62
|
-
rename: pgt(rename_1.default)
|
|
63
|
-
// These manage their own connection lifecycles
|
|
64
|
-
server: server_1.default,
|
|
65
|
-
explorer: explorer_1.default
|
|
59
|
+
rename: pgt(rename_1.default)
|
|
66
60
|
};
|
|
67
61
|
};
|
|
62
|
+
exports.createPgpmCommandMap = createPgpmCommandMap;
|
|
68
63
|
const commands = async (argv, prompter, options) => {
|
|
69
64
|
if (argv.version || argv.v) {
|
|
70
65
|
const pkg = (0, package_2.readAndParsePackageJson)();
|
|
@@ -72,18 +67,15 @@ const commands = async (argv, prompter, options) => {
|
|
|
72
67
|
process.exit(0);
|
|
73
68
|
}
|
|
74
69
|
let { first: command, newArgv } = (0, utils_1.extractFirst)(argv);
|
|
75
|
-
// Show usage if explicitly requested but no command specified
|
|
76
70
|
if ((argv.help || argv.h || command === 'help') && !command) {
|
|
77
71
|
console.log(utils_1.usageText);
|
|
78
72
|
process.exit(0);
|
|
79
73
|
}
|
|
80
|
-
// Show usage for help command specifically
|
|
81
74
|
if (command === 'help') {
|
|
82
75
|
console.log(utils_1.usageText);
|
|
83
76
|
process.exit(0);
|
|
84
77
|
}
|
|
85
|
-
const commandMap =
|
|
86
|
-
// Prompt if no command provided
|
|
78
|
+
const commandMap = (0, exports.createPgpmCommandMap)(options?.skipPgTeardown);
|
|
87
79
|
if (!command) {
|
|
88
80
|
const answer = await prompter.prompt(argv, [
|
|
89
81
|
{
|
|
@@ -95,7 +87,6 @@ const commands = async (argv, prompter, options) => {
|
|
|
95
87
|
]);
|
|
96
88
|
command = answer.command;
|
|
97
89
|
}
|
|
98
|
-
// Prompt for working directory
|
|
99
90
|
newArgv = await prompter.prompt(newArgv, [
|
|
100
91
|
{
|
|
101
92
|
type: 'text',
|
package/esm/commands/add.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LaunchQLPackage } from '@launchql/core';
|
|
2
|
-
import { extractFirst } from '../utils/argv';
|
|
3
2
|
import * as path from 'path';
|
|
3
|
+
import { extractFirst } from '../utils/argv';
|
|
4
4
|
const addUsageText = `
|
|
5
|
-
|
|
5
|
+
Add Command:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
pgpm add [change] [OPTIONS]
|
|
8
8
|
|
|
9
9
|
Add a database change to plans and create deploy/revert/verify SQL files.
|
|
10
10
|
|
|
@@ -18,10 +18,10 @@ Options:
|
|
|
18
18
|
--cwd <directory> Working directory (default: current directory)
|
|
19
19
|
|
|
20
20
|
Examples:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
pgpm add organizations Add change named 'organizations'
|
|
22
|
+
pgpm add brands --note "Adds the brands table" Add change with note
|
|
23
|
+
pgpm add contacts --requires users --note "Adds contacts table" Add with dependency
|
|
24
|
+
pgpm add be/a/path/like/this Add change with nested path
|
|
25
25
|
`;
|
|
26
26
|
export default async (argv, prompter, _options) => {
|
|
27
27
|
// Show usage if explicitly requested
|
|
@@ -3,12 +3,12 @@ import { Logger } from '@launchql/logger';
|
|
|
3
3
|
import { getPgEnvOptions } from 'pg-env';
|
|
4
4
|
const log = new Logger('admin-users-add');
|
|
5
5
|
const addUsageText = `
|
|
6
|
-
|
|
6
|
+
Admin Users Add Command:
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
pgpm admin-users add [OPTIONS]
|
|
9
9
|
|
|
10
|
-
Add database users with
|
|
11
|
-
Note: You must run '
|
|
10
|
+
Add database users with postgres roles.
|
|
11
|
+
Note: You must run 'pgpm admin-users bootstrap' first to initialize roles.
|
|
12
12
|
|
|
13
13
|
Options:
|
|
14
14
|
--help, -h Show this help message
|
|
@@ -18,9 +18,9 @@ Options:
|
|
|
18
18
|
--cwd <directory> Working directory (default: current directory)
|
|
19
19
|
|
|
20
20
|
Examples:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
pgpm admin-users add --username myuser --password mypass
|
|
22
|
+
pgpm admin-users add --test # Add test users (requires bootstrap first)
|
|
23
|
+
pgpm admin-users add # Will prompt for username and password
|
|
24
24
|
`;
|
|
25
25
|
export default async (argv, prompter, _options) => {
|
|
26
26
|
// Show usage if explicitly requested
|
|
@@ -37,7 +37,7 @@ export default async (argv, prompter, _options) => {
|
|
|
37
37
|
{
|
|
38
38
|
type: 'confirm',
|
|
39
39
|
name: 'yes',
|
|
40
|
-
message: 'Are you sure you want to add
|
|
40
|
+
message: 'Are you sure you want to add test users? (WARNING: Should NEVER be run on production!)',
|
|
41
41
|
default: false
|
|
42
42
|
}
|
|
43
43
|
]);
|
|
@@ -3,19 +3,19 @@ import { Logger } from '@launchql/logger';
|
|
|
3
3
|
import { getPgEnvOptions } from 'pg-env';
|
|
4
4
|
const log = new Logger('admin-users-bootstrap');
|
|
5
5
|
const bootstrapUsageText = `
|
|
6
|
-
|
|
6
|
+
Admin Users Bootstrap Command:
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
pgpm admin-users bootstrap [OPTIONS]
|
|
9
9
|
|
|
10
|
-
Initialize
|
|
11
|
-
Creates the standard
|
|
10
|
+
Initialize postgres roles and permissions. This command must be run before adding users.
|
|
11
|
+
Creates the standard postgres roles: anonymous, authenticated, administrator.
|
|
12
12
|
|
|
13
13
|
Options:
|
|
14
14
|
--help, -h Show this help message
|
|
15
15
|
--cwd <directory> Working directory (default: current directory)
|
|
16
16
|
|
|
17
17
|
Examples:
|
|
18
|
-
|
|
18
|
+
pgpm admin-users bootstrap # Initialize postgres roles
|
|
19
19
|
`;
|
|
20
20
|
export default async (argv, prompter, _options) => {
|
|
21
21
|
// Show usage if explicitly requested
|
|
@@ -28,7 +28,7 @@ export default async (argv, prompter, _options) => {
|
|
|
28
28
|
{
|
|
29
29
|
type: 'confirm',
|
|
30
30
|
name: 'yes',
|
|
31
|
-
message: 'Are you sure you want to initialize
|
|
31
|
+
message: 'Are you sure you want to initialize postgres roles and permissions?',
|
|
32
32
|
default: false
|
|
33
33
|
}
|
|
34
34
|
]);
|
|
@@ -39,7 +39,7 @@ export default async (argv, prompter, _options) => {
|
|
|
39
39
|
const init = new LaunchQLInit(pgEnv);
|
|
40
40
|
try {
|
|
41
41
|
await init.bootstrapRoles();
|
|
42
|
-
log.success('
|
|
42
|
+
log.success('postgres roles and permissions initialized successfully.');
|
|
43
43
|
}
|
|
44
44
|
finally {
|
|
45
45
|
await init.close();
|
|
@@ -3,11 +3,11 @@ import { Logger } from '@launchql/logger';
|
|
|
3
3
|
import { getPgEnvOptions } from 'pg-env';
|
|
4
4
|
const log = new Logger('admin-users-remove');
|
|
5
5
|
const removeUsageText = `
|
|
6
|
-
|
|
6
|
+
Admin Users Remove Command:
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
pgpm admin-users remove [OPTIONS]
|
|
9
9
|
|
|
10
|
-
Remove database users and revoke their
|
|
10
|
+
Remove database users and revoke their postgres roles.
|
|
11
11
|
|
|
12
12
|
Options:
|
|
13
13
|
--help, -h Show this help message
|
|
@@ -16,9 +16,9 @@ Options:
|
|
|
16
16
|
--cwd <directory> Working directory (default: current directory)
|
|
17
17
|
|
|
18
18
|
Examples:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
pgpm admin-users remove --username myuser
|
|
20
|
+
pgpm admin-users remove --test # Remove test users
|
|
21
|
+
pgpm admin-users remove # Will prompt for username
|
|
22
22
|
`;
|
|
23
23
|
export default async (argv, prompter, _options) => {
|
|
24
24
|
// Show usage if explicitly requested
|
|
@@ -35,7 +35,7 @@ export default async (argv, prompter, _options) => {
|
|
|
35
35
|
{
|
|
36
36
|
type: 'confirm',
|
|
37
37
|
name: 'yes',
|
|
38
|
-
message: 'Are you sure you want to remove
|
|
38
|
+
message: 'Are you sure you want to remove test users (app_user, app_admin)?',
|
|
39
39
|
default: false
|
|
40
40
|
}
|
|
41
41
|
]);
|
|
@@ -8,11 +8,11 @@ const subcommandMap = {
|
|
|
8
8
|
remove
|
|
9
9
|
};
|
|
10
10
|
const adminUsersUsageText = `
|
|
11
|
-
|
|
11
|
+
Admin Users Commands:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
pgpm admin-users bootstrap Initialize postgres roles and permissions (must be run first)
|
|
14
|
+
pgpm admin-users add Add database users with roles
|
|
15
|
+
pgpm admin-users remove Remove database users and revoke roles
|
|
16
16
|
|
|
17
17
|
Options:
|
|
18
18
|
--help, -h Show this help message
|
|
@@ -55,7 +55,7 @@ export default async (argv, prompter, options) => {
|
|
|
55
55
|
};
|
|
56
56
|
function getSubcommandDescription(cmd) {
|
|
57
57
|
const descriptions = {
|
|
58
|
-
bootstrap: 'Initialize
|
|
58
|
+
bootstrap: 'Initialize postgres roles and permissions (must be run first)',
|
|
59
59
|
add: 'Add database users with roles',
|
|
60
60
|
remove: 'Remove database users and revoke roles'
|
|
61
61
|
};
|
package/esm/commands/analyze.js
CHANGED