pgpm 0.4.2 → 0.5.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.
Files changed (77) hide show
  1. package/commands/add.js +2 -2
  2. package/commands/admin-users/add.js +3 -3
  3. package/commands/admin-users/bootstrap.js +3 -3
  4. package/commands/admin-users/remove.js +3 -3
  5. package/commands/analyze.js +2 -2
  6. package/commands/cache.js +1 -1
  7. package/commands/clear.js +7 -7
  8. package/commands/deploy.js +4 -4
  9. package/commands/export.js +4 -4
  10. package/commands/extension.js +3 -3
  11. package/commands/init/module.js +5 -5
  12. package/commands/init/workspace.js +2 -2
  13. package/commands/install.js +3 -3
  14. package/commands/kill.js +1 -1
  15. package/commands/migrate/deps.js +4 -4
  16. package/commands/migrate/init.js +3 -3
  17. package/commands/migrate/list.js +4 -4
  18. package/commands/migrate/status.js +5 -5
  19. package/commands/package.js +2 -2
  20. package/commands/plan.js +4 -4
  21. package/commands/remove.js +5 -5
  22. package/commands/rename.js +2 -2
  23. package/commands/revert.js +4 -4
  24. package/commands/tag.js +6 -6
  25. package/commands/update.js +3 -3
  26. package/commands/verify.js +4 -4
  27. package/commands.js +3 -3
  28. package/esm/commands/add.js +2 -2
  29. package/esm/commands/admin-users/add.js +3 -3
  30. package/esm/commands/admin-users/bootstrap.js +3 -3
  31. package/esm/commands/admin-users/remove.js +3 -3
  32. package/esm/commands/analyze.js +2 -2
  33. package/esm/commands/cache.js +1 -1
  34. package/esm/commands/clear.js +7 -7
  35. package/esm/commands/deploy.js +4 -4
  36. package/esm/commands/export.js +4 -4
  37. package/esm/commands/extension.js +3 -3
  38. package/esm/commands/init/module.js +5 -5
  39. package/esm/commands/init/workspace.js +2 -2
  40. package/esm/commands/install.js +3 -3
  41. package/esm/commands/kill.js +1 -1
  42. package/esm/commands/migrate/deps.js +4 -4
  43. package/esm/commands/migrate/init.js +3 -3
  44. package/esm/commands/migrate/list.js +4 -4
  45. package/esm/commands/migrate/status.js +5 -5
  46. package/esm/commands/package.js +2 -2
  47. package/esm/commands/plan.js +4 -4
  48. package/esm/commands/remove.js +5 -5
  49. package/esm/commands/rename.js +2 -2
  50. package/esm/commands/revert.js +4 -4
  51. package/esm/commands/tag.js +6 -6
  52. package/esm/commands/update.js +3 -3
  53. package/esm/commands/verify.js +4 -4
  54. package/esm/commands.js +3 -3
  55. package/esm/utils/argv.js +1 -1
  56. package/esm/utils/cli-error.js +4 -4
  57. package/esm/utils/deployed-changes.js +3 -3
  58. package/esm/utils/display.js +2 -2
  59. package/esm/utils/module-utils.js +3 -3
  60. package/esm/utils/update-check.js +4 -4
  61. package/esm/utils/update-config.js +1 -1
  62. package/package.json +12 -11
  63. package/utils/argv.js +1 -1
  64. package/utils/cli-error.d.ts +2 -2
  65. package/utils/cli-error.js +4 -4
  66. package/utils/deployed-changes.d.ts +1 -1
  67. package/utils/deployed-changes.js +3 -3
  68. package/utils/display.js +2 -2
  69. package/utils/module-utils.d.ts +1 -1
  70. package/utils/module-utils.js +3 -3
  71. package/utils/update-check.d.ts +1 -1
  72. package/utils/update-check.js +4 -4
  73. package/utils/update-config.d.ts +1 -1
  74. package/utils/update-config.js +1 -1
  75. package/esm/package.js +0 -26
  76. package/package.d.ts +0 -1
  77. package/package.js +0 -29
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cliExitWithError = void 0;
4
- const logger_1 = require("@launchql/logger");
5
- const types_1 = require("@launchql/types");
4
+ const logger_1 = require("@pgpmjs/logger");
5
+ const types_1 = require("@pgpmjs/types");
6
6
  const pg_cache_1 = require("pg-cache");
7
7
  const log = new logger_1.Logger('cli');
8
8
  /**
@@ -12,8 +12,8 @@ const log = new logger_1.Logger('cli');
12
12
  * IMPORTANT: This function properly cleans up PostgreSQL connections before exiting.
13
13
  */
14
14
  const cliExitWithError = async (error, context) => {
15
- if (error instanceof types_1.LaunchQLError) {
16
- // For LaunchQLError instances, use structured logging
15
+ if (error instanceof types_1.PgpmError) {
16
+ // For PgpmError instances, use structured logging
17
17
  log.error(`Error: ${error.message}`);
18
18
  // Log additional context if available
19
19
  if (error.context && Object.keys(error.context).length > 0) {
@@ -1,4 +1,4 @@
1
- import { Logger } from '@launchql/logger';
1
+ import { Logger } from '@pgpmjs/logger';
2
2
  import { Inquirerer } from 'inquirerer';
3
3
  export declare function selectDeployedChange(database: string, argv: Partial<Record<string, any>>, prompter: Inquirerer, log: Logger, action?: 'revert' | 'verify'): Promise<string | undefined>;
4
4
  export declare function selectDeployedPackage(database: string, argv: Partial<Record<string, any>>, prompter: Inquirerer, log: Logger, action?: 'revert' | 'verify'): Promise<string | undefined>;
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.selectDeployedChange = selectDeployedChange;
4
4
  exports.selectDeployedPackage = selectDeployedPackage;
5
- const core_1 = require("@launchql/core");
5
+ const core_1 = require("@pgpmjs/core");
6
6
  const pg_env_1 = require("pg-env");
7
7
  async function selectDeployedChange(database, argv, prompter, log, action = 'revert') {
8
8
  const pgEnv = (0, pg_env_1.getPgEnvOptions)({ database });
9
- const client = new core_1.LaunchQLMigrate(pgEnv);
9
+ const client = new core_1.PgpmMigrate(pgEnv);
10
10
  let selectedPackage;
11
11
  if (argv.package) {
12
12
  selectedPackage = argv.package;
@@ -52,7 +52,7 @@ async function selectDeployedPackage(database, argv, prompter, log, action = 're
52
52
  return argv.package;
53
53
  }
54
54
  const pgEnv = (0, pg_env_1.getPgEnvOptions)({ database });
55
- const client = new core_1.LaunchQLMigrate(pgEnv);
55
+ const client = new core_1.PgpmMigrate(pgEnv);
56
56
  const packageStatuses = await client.status();
57
57
  if (packageStatuses.length === 0) {
58
58
  log.warn('No deployed packages found in database');
package/utils/display.js CHANGED
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.usageText = void 0;
7
7
  exports.displayVersion = displayVersion;
8
8
  exports.displayUsage = displayUsage;
9
+ const find_and_require_package_json_1 = require("find-and-require-package-json");
9
10
  const yanse_1 = __importDefault(require("yanse"));
10
- const package_1 = require("../package");
11
11
  // Function to display the version information
12
12
  function displayVersion() {
13
- const pkg = (0, package_1.readAndParsePackageJson)();
13
+ const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
14
14
  console.log(yanse_1.default.green(`Name: ${pkg.name}`));
15
15
  console.log(yanse_1.default.blue(`Version: ${pkg.version}`));
16
16
  }
@@ -1,4 +1,4 @@
1
- import { Logger } from '@launchql/logger';
1
+ import { Logger } from '@pgpmjs/logger';
2
2
  import { Inquirerer } from 'inquirerer';
3
3
  import { ParsedArgs } from 'minimist';
4
4
  /**
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.selectPackage = selectPackage;
4
- const core_1 = require("@launchql/core");
5
- const types_1 = require("@launchql/types");
4
+ const core_1 = require("@pgpmjs/core");
5
+ const types_1 = require("@pgpmjs/types");
6
6
  /**
7
7
  * Handle package selection for operations that need a specific package
8
8
  * Returns the selected package name, or undefined if validation fails or no packages exist
9
9
  */
10
10
  async function selectPackage(argv, prompter, cwd, operationName, log) {
11
- const pkg = new core_1.LaunchQLPackage(cwd);
11
+ const pkg = new core_1.PgpmPackage(cwd);
12
12
  const modules = await pkg.getModules();
13
13
  const moduleNames = modules.map(mod => mod.getModuleName());
14
14
  // Check if any modules exist
@@ -1,4 +1,4 @@
1
- import { UpdateCheckConfig } from '@launchql/types';
1
+ import { UpdateCheckConfig } from '@pgpmjs/types';
2
2
  import { UpdateConfigOptions } from './update-config';
3
3
  export interface CheckForUpdatesOptions extends UpdateConfigOptions {
4
4
  pkgName?: string;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkForUpdates = checkForUpdates;
4
- const logger_1 = require("@launchql/logger");
5
- const types_1 = require("@launchql/types");
6
- const package_1 = require("../package");
4
+ const find_and_require_package_json_1 = require("find-and-require-package-json");
5
+ const logger_1 = require("@pgpmjs/logger");
6
+ const types_1 = require("@pgpmjs/types");
7
7
  const npm_version_1 = require("./npm-version");
8
8
  const update_config_1 = require("./update-config");
9
9
  const log = new logger_1.Logger('update-check');
@@ -17,7 +17,7 @@ const shouldSkip = (command) => {
17
17
  return false;
18
18
  };
19
19
  async function checkForUpdates(options = {}) {
20
- const { pkgName = types_1.UPDATE_PACKAGE_NAME, pkgVersion = (0, package_1.readAndParsePackageJson)().version, command, now = Date.now(), key = types_1.UPDATE_CHECK_APPSTASH_KEY, toolName, baseDir } = options;
20
+ const { pkgName = types_1.UPDATE_PACKAGE_NAME, pkgVersion = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname).version, command, now = Date.now(), key = types_1.UPDATE_CHECK_APPSTASH_KEY, toolName, baseDir } = options;
21
21
  if (shouldSkip(command)) {
22
22
  return null;
23
23
  }
@@ -1,4 +1,4 @@
1
- import { UpdateCheckConfig } from '@launchql/types';
1
+ import { UpdateCheckConfig } from '@pgpmjs/types';
2
2
  export interface UpdateConfigOptions {
3
3
  toolName?: string;
4
4
  baseDir?: string;
@@ -9,7 +9,7 @@ exports.writeUpdateConfig = writeUpdateConfig;
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const appstash_1 = require("appstash");
12
- const types_1 = require("@launchql/types");
12
+ const types_1 = require("@pgpmjs/types");
13
13
  const defaultToolName = 'pgpm';
14
14
  const getConfigPath = (options = {}) => {
15
15
  const toolName = options.toolName ?? defaultToolName;
package/esm/package.js DELETED
@@ -1,26 +0,0 @@
1
- import { existsSync, readFileSync } from 'fs';
2
- import { dirname, join } from 'path';
3
- // need to search due to the dist/ folder and src/, etc.
4
- function findPackageJson(currentDir) {
5
- const filePath = join(currentDir, 'package.json');
6
- // Check if package.json exists in the current directory
7
- if (existsSync(filePath)) {
8
- return filePath;
9
- }
10
- // Get the parent directory
11
- const parentDir = dirname(currentDir);
12
- // If reached the root directory, package.json is not found
13
- if (parentDir === currentDir) {
14
- throw new Error('package.json not found in any parent directory');
15
- }
16
- // Recursively look in the parent directory
17
- return findPackageJson(parentDir);
18
- }
19
- export function readAndParsePackageJson() {
20
- // Start searching from the current directory
21
- const pkgPath = findPackageJson(__dirname);
22
- // Read and parse the package.json
23
- const str = readFileSync(pkgPath, 'utf8');
24
- const pkg = JSON.parse(str);
25
- return pkg;
26
- }
package/package.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function readAndParsePackageJson(): any;
package/package.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readAndParsePackageJson = readAndParsePackageJson;
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
6
- // need to search due to the dist/ folder and src/, etc.
7
- function findPackageJson(currentDir) {
8
- const filePath = (0, path_1.join)(currentDir, 'package.json');
9
- // Check if package.json exists in the current directory
10
- if ((0, fs_1.existsSync)(filePath)) {
11
- return filePath;
12
- }
13
- // Get the parent directory
14
- const parentDir = (0, path_1.dirname)(currentDir);
15
- // If reached the root directory, package.json is not found
16
- if (parentDir === currentDir) {
17
- throw new Error('package.json not found in any parent directory');
18
- }
19
- // Recursively look in the parent directory
20
- return findPackageJson(parentDir);
21
- }
22
- function readAndParsePackageJson() {
23
- // Start searching from the current directory
24
- const pkgPath = findPackageJson(__dirname);
25
- // Read and parse the package.json
26
- const str = (0, fs_1.readFileSync)(pkgPath, 'utf8');
27
- const pkg = JSON.parse(str);
28
- return pkg;
29
- }