@constructive-io/cli 0.0.3 → 5.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.
Files changed (130) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +346 -153
  3. package/commands/{analyze.d.ts → codegen.d.ts} +2 -2
  4. package/commands/codegen.js +131 -0
  5. package/commands/explorer.js +94 -0
  6. package/commands/get-graphql-schema.js +73 -0
  7. package/commands/server.js +187 -0
  8. package/commands.d.ts +0 -1
  9. package/commands.js +42 -61
  10. package/esm/commands/codegen.js +126 -0
  11. package/esm/commands/explorer.js +92 -0
  12. package/esm/commands/get-graphql-schema.js +71 -0
  13. package/esm/commands/server.js +185 -0
  14. package/esm/commands.js +41 -59
  15. package/esm/index.js +16 -36
  16. package/esm/utils/display.js +26 -23
  17. package/esm/utils/index.js +3 -6
  18. package/index.d.ts +0 -22
  19. package/index.js +16 -72
  20. package/package.json +50 -25
  21. package/utils/display.d.ts +1 -1
  22. package/utils/display.js +26 -23
  23. package/utils/index.d.ts +3 -6
  24. package/utils/index.js +7 -20
  25. package/commands/add.d.ts +0 -7
  26. package/commands/add.js +0 -86
  27. package/commands/admin-users/add.d.ts +0 -4
  28. package/commands/admin-users/add.js +0 -89
  29. package/commands/admin-users/bootstrap.d.ts +0 -4
  30. package/commands/admin-users/bootstrap.js +0 -50
  31. package/commands/admin-users/remove.d.ts +0 -4
  32. package/commands/admin-users/remove.js +0 -82
  33. package/commands/admin-users.d.ts +0 -4
  34. package/commands/admin-users.js +0 -68
  35. package/commands/analyze.js +0 -21
  36. package/commands/clear.d.ts +0 -3
  37. package/commands/clear.js +0 -59
  38. package/commands/deploy.d.ts +0 -4
  39. package/commands/deploy.js +0 -146
  40. package/commands/docker.d.ts +0 -3
  41. package/commands/docker.js +0 -194
  42. package/commands/env.d.ts +0 -4
  43. package/commands/env.js +0 -124
  44. package/commands/export.js +0 -129
  45. package/commands/extension.js +0 -48
  46. package/commands/init/index.d.ts +0 -7
  47. package/commands/init/index.js +0 -47
  48. package/commands/init/module.d.ts +0 -4
  49. package/commands/init/module.js +0 -71
  50. package/commands/init/workspace.d.ts +0 -4
  51. package/commands/init/workspace.js +0 -52
  52. package/commands/install.d.ts +0 -4
  53. package/commands/install.js +0 -37
  54. package/commands/kill.js +0 -107
  55. package/commands/migrate/deps.d.ts +0 -4
  56. package/commands/migrate/deps.js +0 -186
  57. package/commands/migrate/init.d.ts +0 -4
  58. package/commands/migrate/init.js +0 -65
  59. package/commands/migrate/list.d.ts +0 -4
  60. package/commands/migrate/list.js +0 -85
  61. package/commands/migrate/status.d.ts +0 -4
  62. package/commands/migrate/status.js +0 -94
  63. package/commands/migrate.d.ts +0 -4
  64. package/commands/migrate.js +0 -69
  65. package/commands/package.d.ts +0 -3
  66. package/commands/package.js +0 -65
  67. package/commands/plan.d.ts +0 -3
  68. package/commands/plan.js +0 -62
  69. package/commands/remove.d.ts +0 -3
  70. package/commands/remove.js +0 -42
  71. package/commands/rename.d.ts +0 -4
  72. package/commands/rename.js +0 -35
  73. package/commands/revert.d.ts +0 -3
  74. package/commands/revert.js +0 -107
  75. package/commands/tag.d.ts +0 -6
  76. package/commands/tag.js +0 -168
  77. package/commands/verify.d.ts +0 -3
  78. package/commands/verify.js +0 -85
  79. package/dist/README.md +0 -412
  80. package/dist/package.json +0 -64
  81. package/esm/commands/add.js +0 -51
  82. package/esm/commands/admin-users/add.js +0 -87
  83. package/esm/commands/admin-users/bootstrap.js +0 -48
  84. package/esm/commands/admin-users/remove.js +0 -80
  85. package/esm/commands/admin-users.js +0 -63
  86. package/esm/commands/analyze.js +0 -16
  87. package/esm/commands/clear.js +0 -54
  88. package/esm/commands/deploy.js +0 -144
  89. package/esm/commands/docker.js +0 -192
  90. package/esm/commands/env.js +0 -122
  91. package/esm/commands/export.js +0 -127
  92. package/esm/commands/extension.js +0 -46
  93. package/esm/commands/init/index.js +0 -42
  94. package/esm/commands/init/module.js +0 -68
  95. package/esm/commands/init/workspace.js +0 -46
  96. package/esm/commands/install.js +0 -35
  97. package/esm/commands/kill.js +0 -105
  98. package/esm/commands/migrate/deps.js +0 -184
  99. package/esm/commands/migrate/init.js +0 -63
  100. package/esm/commands/migrate/list.js +0 -83
  101. package/esm/commands/migrate/status.js +0 -92
  102. package/esm/commands/migrate.js +0 -64
  103. package/esm/commands/package.js +0 -63
  104. package/esm/commands/plan.js +0 -60
  105. package/esm/commands/remove.js +0 -40
  106. package/esm/commands/rename.js +0 -30
  107. package/esm/commands/revert.js +0 -105
  108. package/esm/commands/tag.js +0 -133
  109. package/esm/commands/verify.js +0 -83
  110. package/esm/package.js +0 -26
  111. package/esm/utils/argv.js +0 -92
  112. package/esm/utils/cli-error.js +0 -48
  113. package/esm/utils/database.js +0 -78
  114. package/esm/utils/deployed-changes.js +0 -68
  115. package/esm/utils/module-utils.js +0 -51
  116. package/package.d.ts +0 -1
  117. package/package.js +0 -29
  118. package/utils/argv.d.ts +0 -46
  119. package/utils/argv.js +0 -100
  120. package/utils/cli-error.d.ts +0 -8
  121. package/utils/cli-error.js +0 -52
  122. package/utils/database.d.ts +0 -21
  123. package/utils/database.js +0 -83
  124. package/utils/deployed-changes.d.ts +0 -4
  125. package/utils/deployed-changes.js +0 -72
  126. package/utils/module-utils.d.ts +0 -8
  127. package/utils/module-utils.js +0 -54
  128. /package/commands/{export.d.ts → explorer.d.ts} +0 -0
  129. /package/commands/{extension.d.ts → get-graphql-schema.d.ts} +0 -0
  130. /package/commands/{kill.d.ts → server.d.ts} +0 -0
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@launchql/core");
4
- const logger_1 = require("@launchql/logger");
5
- const pg_env_1 = require("pg-env");
6
- const log = new logger_1.Logger('admin-users-add');
7
- const addUsageText = `
8
- Admin Users Add Command:
9
-
10
- constructive admin-users add [OPTIONS]
11
-
12
- Add database users with postgres roles.
13
- Note: You must run 'constructive admin-users bootstrap' first to initialize roles.
14
-
15
- Options:
16
- --help, -h Show this help message
17
- --username <username> Username for the database user
18
- --password <password> Password for the database user
19
- --test Add test users (app_user, app_admin) with default passwords
20
- --cwd <directory> Working directory (default: current directory)
21
-
22
- Examples:
23
- constructive admin-users add --username myuser --password mypass
24
- constructive admin-users add --test # Add test users (requires bootstrap first)
25
- constructive admin-users add # Will prompt for username and password
26
- `;
27
- exports.default = async (argv, prompter, _options) => {
28
- // Show usage if explicitly requested
29
- if (argv.help || argv.h) {
30
- console.log(addUsageText);
31
- process.exit(0);
32
- }
33
- const pgEnv = (0, pg_env_1.getPgEnvOptions)();
34
- const isTest = argv.test;
35
- const init = new core_1.LaunchQLInit(pgEnv);
36
- try {
37
- if (isTest) {
38
- const { yes: confirmTest } = await prompter.prompt(argv, [
39
- {
40
- type: 'confirm',
41
- name: 'yes',
42
- message: 'Are you sure you want to add test users? (WARNING: Should NEVER be run on production!)',
43
- default: false
44
- }
45
- ]);
46
- if (!confirmTest) {
47
- log.info('Operation cancelled.');
48
- return;
49
- }
50
- await init.bootstrapTestRoles();
51
- log.success('Test users added successfully.');
52
- }
53
- else {
54
- const prompts = [
55
- {
56
- type: 'text',
57
- name: 'username',
58
- message: 'Enter username for database user:',
59
- validate: (input) => input && input.trim().length > 0
60
- },
61
- {
62
- type: 'text',
63
- name: 'password',
64
- message: 'Enter password for database user:',
65
- validate: (input) => input && input.trim().length > 0
66
- }
67
- ];
68
- const { username, password } = await prompter.prompt(argv, prompts);
69
- const { yes } = await prompter.prompt(argv, [
70
- {
71
- type: 'confirm',
72
- name: 'yes',
73
- message: `Are you sure you want to add database user "${username}"?`,
74
- default: false
75
- }
76
- ]);
77
- if (!yes) {
78
- log.info('Operation cancelled.');
79
- return;
80
- }
81
- await init.bootstrapDbRoles(username, password);
82
- log.success(`Database user "${username}" added successfully.`);
83
- }
84
- }
85
- finally {
86
- await init.close();
87
- }
88
- return argv;
89
- };
@@ -1,4 +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<Partial<ParsedArgs>>;
4
- export default _default;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@launchql/core");
4
- const logger_1 = require("@launchql/logger");
5
- const pg_env_1 = require("pg-env");
6
- const log = new logger_1.Logger('admin-users-bootstrap');
7
- const bootstrapUsageText = `
8
- Admin Users Bootstrap Command:
9
-
10
- constructive admin-users bootstrap [OPTIONS]
11
-
12
- Initialize postgres roles and permissions. This command must be run before adding users.
13
- Creates the standard postgres roles: anonymous, authenticated, administrator.
14
-
15
- Options:
16
- --help, -h Show this help message
17
- --cwd <directory> Working directory (default: current directory)
18
-
19
- Examples:
20
- constructive admin-users bootstrap # Initialize postgres roles
21
- `;
22
- exports.default = async (argv, prompter, _options) => {
23
- // Show usage if explicitly requested
24
- if (argv.help || argv.h) {
25
- console.log(bootstrapUsageText);
26
- process.exit(0);
27
- }
28
- const pgEnv = (0, pg_env_1.getPgEnvOptions)();
29
- const { yes } = await prompter.prompt(argv, [
30
- {
31
- type: 'confirm',
32
- name: 'yes',
33
- message: 'Are you sure you want to initialize postgres roles and permissions?',
34
- default: false
35
- }
36
- ]);
37
- if (!yes) {
38
- log.info('Operation cancelled.');
39
- return;
40
- }
41
- const init = new core_1.LaunchQLInit(pgEnv);
42
- try {
43
- await init.bootstrapRoles();
44
- log.success('postgres roles and permissions initialized successfully.');
45
- }
46
- finally {
47
- await init.close();
48
- }
49
- return argv;
50
- };
@@ -1,4 +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<Partial<ParsedArgs>>;
4
- export default _default;
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@launchql/core");
4
- const logger_1 = require("@launchql/logger");
5
- const pg_env_1 = require("pg-env");
6
- const log = new logger_1.Logger('admin-users-remove');
7
- const removeUsageText = `
8
- Admin Users Remove Command:
9
-
10
- constructive admin-users remove [OPTIONS]
11
-
12
- Remove database users and revoke their postgres roles.
13
-
14
- Options:
15
- --help, -h Show this help message
16
- --username <username> Username for the database user to remove
17
- --test Remove test users (app_user, app_admin)
18
- --cwd <directory> Working directory (default: current directory)
19
-
20
- Examples:
21
- constructive admin-users remove --username myuser
22
- constructive admin-users remove --test # Remove test users
23
- constructive admin-users remove # Will prompt for username
24
- `;
25
- exports.default = async (argv, prompter, _options) => {
26
- // Show usage if explicitly requested
27
- if (argv.help || argv.h) {
28
- console.log(removeUsageText);
29
- process.exit(0);
30
- }
31
- const pgEnv = (0, pg_env_1.getPgEnvOptions)();
32
- const isTest = argv.test;
33
- const init = new core_1.LaunchQLInit(pgEnv);
34
- try {
35
- if (isTest) {
36
- const { yes: confirmTest } = await prompter.prompt(argv, [
37
- {
38
- type: 'confirm',
39
- name: 'yes',
40
- message: 'Are you sure you want to remove test users (app_user, app_admin)?',
41
- default: false
42
- }
43
- ]);
44
- if (!confirmTest) {
45
- log.info('Operation cancelled.');
46
- return;
47
- }
48
- await init.removeDbRoles('app_user');
49
- await init.removeDbRoles('app_admin');
50
- log.success('Test users removed successfully.');
51
- }
52
- else {
53
- const prompts = [
54
- {
55
- type: 'text',
56
- name: 'username',
57
- message: 'Enter username for database user to remove:',
58
- validate: (input) => input && input.trim().length > 0
59
- }
60
- ];
61
- const { username } = await prompter.prompt(argv, prompts);
62
- const { yes } = await prompter.prompt(argv, [
63
- {
64
- type: 'confirm',
65
- name: 'yes',
66
- message: `Are you sure you want to remove database user "${username}"?`,
67
- default: false
68
- }
69
- ]);
70
- if (!yes) {
71
- log.info('Operation cancelled.');
72
- return;
73
- }
74
- await init.removeDbRoles(username);
75
- log.success(`Database user "${username}" removed successfully.`);
76
- }
77
- }
78
- finally {
79
- await init.close();
80
- }
81
- return argv;
82
- };
@@ -1,4 +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<void>;
4
- export default _default;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const utils_1 = require("../utils");
7
- const add_1 = __importDefault(require("./admin-users/add"));
8
- const bootstrap_1 = __importDefault(require("./admin-users/bootstrap"));
9
- const remove_1 = __importDefault(require("./admin-users/remove"));
10
- const subcommandMap = {
11
- add: add_1.default,
12
- bootstrap: bootstrap_1.default,
13
- remove: remove_1.default
14
- };
15
- const adminUsersUsageText = `
16
- Admin Users Commands:
17
-
18
- constructive admin-users bootstrap Initialize postgres roles and permissions (must be run first)
19
- constructive admin-users add Add database users with roles
20
- constructive admin-users remove Remove database users and revoke roles
21
-
22
- Options:
23
- --help, -h Show this help message
24
- --cwd Working directory (default: current directory)
25
- `;
26
- exports.default = async (argv, prompter, options) => {
27
- let { first: subcommand, newArgv } = (0, utils_1.extractFirst)(argv);
28
- // Prompt if no subcommand provided
29
- if (!subcommand) {
30
- // Show usage if explicitly requested and no subcommand provided
31
- if (argv.help || argv.h) {
32
- console.log(adminUsersUsageText);
33
- process.exit(0);
34
- }
35
- const answer = await prompter.prompt(argv, [
36
- {
37
- type: 'autocomplete',
38
- name: 'subcommand',
39
- message: 'What admin users operation do you want to perform?',
40
- options: Object.keys(subcommandMap).map(cmd => ({
41
- name: cmd,
42
- value: cmd,
43
- description: getSubcommandDescription(cmd)
44
- }))
45
- }
46
- ]);
47
- subcommand = answer.subcommand;
48
- }
49
- if (subcommand === 'help') {
50
- console.log(adminUsersUsageText);
51
- process.exit(0);
52
- }
53
- const subcommandFn = subcommandMap[subcommand];
54
- if (!subcommandFn) {
55
- console.error(`Unknown admin-users subcommand: ${subcommand}`);
56
- console.log(adminUsersUsageText);
57
- process.exit(1);
58
- }
59
- await subcommandFn(newArgv, prompter, options);
60
- };
61
- function getSubcommandDescription(cmd) {
62
- const descriptions = {
63
- bootstrap: 'Initialize postgres roles and permissions (must be run first)',
64
- add: 'Add database users with roles',
65
- remove: 'Remove database users and revoke roles'
66
- };
67
- return descriptions[cmd] || '';
68
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const core_1 = require("@launchql/core");
7
- const path_1 = __importDefault(require("path"));
8
- exports.default = async (argv, _prompter) => {
9
- const cwd = argv.cwd || process.cwd();
10
- const proj = new core_1.LaunchQLPackage(path_1.default.resolve(cwd));
11
- const result = proj.analyzeModule();
12
- if (result.ok) {
13
- console.log(`OK ${result.name}`);
14
- return;
15
- }
16
- console.log(`NOT OK ${result.name}`);
17
- for (const issue of result.issues) {
18
- const loc = issue.file ? ` (${issue.file})` : '';
19
- console.log(`- [${issue.code}] ${issue.message}${loc}`);
20
- }
21
- };
@@ -1,3 +0,0 @@
1
- import { CLIOptions, Inquirerer } from 'inquirerer';
2
- declare const _default: (argv: Partial<Record<string, any>>, prompter: Inquirerer, _options: CLIOptions) => Promise<Partial<Record<string, any>>>;
3
- export default _default;
package/commands/clear.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const core_1 = require("@launchql/core");
7
- const core_2 = require("@launchql/core");
8
- const env_1 = require("@launchql/env");
9
- const logger_1 = require("@launchql/logger");
10
- const types_1 = require("@launchql/types");
11
- const path_1 = __importDefault(require("path"));
12
- const pg_env_1 = require("pg-env");
13
- const utils_1 = require("../utils");
14
- const log = new logger_1.Logger('clear');
15
- exports.default = async (argv, prompter, _options) => {
16
- const database = await (0, utils_1.getTargetDatabase)(argv, prompter, {
17
- message: 'Select database'
18
- });
19
- const questions = [
20
- {
21
- name: 'yes',
22
- type: 'confirm',
23
- message: 'Are you sure you want to clear ALL changes from the plan? This will remove all changes and their associated files.',
24
- required: true
25
- }
26
- ];
27
- let { yes, cwd } = await prompter.prompt(argv, questions);
28
- if (!yes) {
29
- log.info('Operation cancelled.');
30
- return;
31
- }
32
- log.debug(`Using current directory: ${cwd}`);
33
- const pkg = new core_1.LaunchQLPackage(cwd);
34
- if (!pkg.isInModule()) {
35
- throw new Error('Not in a LaunchQL module directory. Please run this command from within a module.');
36
- }
37
- const modulePath = pkg.getModulePath();
38
- if (!modulePath) {
39
- throw new Error('Could not resolve module path');
40
- }
41
- const planPath = path_1.default.join(modulePath, 'pgpm.plan');
42
- const result = (0, core_2.parsePlanFile)(planPath);
43
- if (result.errors.length > 0) {
44
- throw types_1.errors.PLAN_PARSE_ERROR({ planPath, errors: result.errors.map(e => e.message).join(', ') });
45
- }
46
- const plan = result.data;
47
- if (plan.changes.length === 0) {
48
- log.info('Plan is already empty - nothing to clear.');
49
- return;
50
- }
51
- const firstChange = plan.changes[0].name;
52
- log.info(`Found ${plan.changes.length} changes in plan. Clearing from first change: ${firstChange}`);
53
- const opts = (0, env_1.getEnvOptions)({
54
- pg: (0, pg_env_1.getPgEnvOptions)({ database })
55
- });
56
- await pkg.removeFromPlan(firstChange);
57
- log.success(`✅ Successfully cleared all changes from the plan.`);
58
- return argv;
59
- };
@@ -1,4 +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<Partial<ParsedArgs>>;
4
- export default _default;
@@ -1,146 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@launchql/core");
4
- const env_1 = require("@launchql/env");
5
- const logger_1 = require("@launchql/logger");
6
- const child_process_1 = require("child_process");
7
- const pg_env_1 = require("pg-env");
8
- const utils_1 = require("../utils");
9
- const module_utils_1 = require("../utils/module-utils");
10
- const deployUsageText = `
11
- Deploy Command:
12
-
13
- constructive deploy [OPTIONS]
14
-
15
- Deploy database changes and migrations to target database.
16
-
17
- Options:
18
- --help, -h Show this help message
19
- --createdb Create database if it doesn't exist
20
- --recursive Deploy recursively through dependencies
21
- --package <name> Target specific package
22
- --to <target> Deploy to specific change or tag
23
- --tx Use transactions (default: true)
24
- --fast Use fast deployment strategy
25
- --logOnly Log-only mode, skip script execution
26
- --usePlan Use deployment plan
27
- --cache Enable caching
28
- --cwd <directory> Working directory (default: current directory)
29
-
30
- Examples:
31
- constructive deploy Deploy to selected database
32
- constructive deploy --createdb Deploy with database creation
33
- constructive deploy --package mypackage --to @v1.0.0 Deploy specific package to tag
34
- constructive deploy --fast --no-tx Fast deployment without transactions
35
- `;
36
- exports.default = async (argv, prompter, _options) => {
37
- // Show usage if explicitly requested
38
- if (argv.help || argv.h) {
39
- console.log(deployUsageText);
40
- process.exit(0);
41
- }
42
- const pgEnv = (0, pg_env_1.getPgEnvOptions)();
43
- const log = new logger_1.Logger('cli');
44
- // Get target database
45
- let database;
46
- if (argv.createdb) {
47
- // Prompt for selection
48
- ({ database } = await prompter.prompt(argv, [
49
- {
50
- type: 'text',
51
- name: 'database',
52
- message: 'Database name',
53
- required: true
54
- }
55
- ]));
56
- }
57
- else {
58
- database = await (0, utils_1.getTargetDatabase)(argv, prompter, {
59
- message: 'Select database'
60
- });
61
- }
62
- const questions = [
63
- {
64
- name: 'yes',
65
- type: 'confirm',
66
- message: 'Are you sure you want to proceed?',
67
- required: true
68
- },
69
- {
70
- name: 'recursive',
71
- type: 'confirm',
72
- message: 'Deploy recursively through dependencies?',
73
- useDefault: true,
74
- default: true,
75
- required: false
76
- },
77
- {
78
- name: 'tx',
79
- type: 'confirm',
80
- message: 'Use Transaction?',
81
- useDefault: true,
82
- default: true,
83
- required: false
84
- },
85
- {
86
- name: 'fast',
87
- type: 'confirm',
88
- message: 'Use Fast Deployment?',
89
- useDefault: true,
90
- default: false,
91
- required: false
92
- },
93
- {
94
- name: 'logOnly',
95
- type: 'confirm',
96
- message: 'Log-only mode (skip script execution)?',
97
- useDefault: true,
98
- default: false,
99
- required: false
100
- }
101
- ];
102
- let { yes, recursive, createdb, cwd, tx, fast, logOnly } = await prompter.prompt(argv, questions);
103
- if (!yes) {
104
- log.info('Operation cancelled.');
105
- return;
106
- }
107
- log.debug(`Using current directory: ${cwd}`);
108
- if (createdb) {
109
- log.info(`Creating database ${database}...`);
110
- (0, child_process_1.execSync)(`createdb ${database}`, {
111
- env: (0, pg_env_1.getSpawnEnvWithPg)(pgEnv)
112
- });
113
- }
114
- let packageName;
115
- if (recursive) {
116
- packageName = await (0, module_utils_1.selectPackage)(argv, prompter, cwd, 'deploy', log);
117
- }
118
- const cliOverrides = {
119
- pg: (0, pg_env_1.getPgEnvOptions)({ database }),
120
- deployment: {
121
- useTx: tx !== false,
122
- fast: fast !== false,
123
- usePlan: argv.usePlan !== false,
124
- cache: argv.cache !== false,
125
- logOnly: argv.logOnly !== false,
126
- }
127
- };
128
- const opts = (0, env_1.getEnvOptions)(cliOverrides);
129
- const project = new core_1.LaunchQLPackage(cwd);
130
- let target;
131
- if (packageName && argv.to) {
132
- target = `${packageName}:${argv.to}`;
133
- }
134
- else if (packageName) {
135
- target = packageName;
136
- }
137
- else if (argv.package && argv.to) {
138
- target = `${argv.package}:${argv.to}`;
139
- }
140
- else if (argv.package) {
141
- target = argv.package;
142
- }
143
- await project.deploy(opts, target, recursive);
144
- log.success('Deployment complete.');
145
- return argv;
146
- };
@@ -1,3 +0,0 @@
1
- import { CLIOptions, Inquirerer } from 'inquirerer';
2
- declare const _default: (argv: Partial<Record<string, any>>, _prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
3
- export default _default;