pgpm 0.4.1 → 0.4.3

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.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const find_and_require_package_json_1 = require("find-and-require-package-json");
3
4
  const logger_1 = require("@launchql/logger");
4
5
  const child_process_1 = require("child_process");
5
- const package_1 = require("../package");
6
6
  const npm_version_1 = require("../utils/npm-version");
7
7
  const cli_error_1 = require("../utils/cli-error");
8
8
  const log = new logger_1.Logger('update');
@@ -42,7 +42,7 @@ exports.default = async (argv, _prompter, _options) => {
42
42
  console.log(updateUsageText);
43
43
  process.exit(0);
44
44
  }
45
- const pkgJson = (0, package_1.readAndParsePackageJson)();
45
+ const pkgJson = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
46
46
  const pkgName = argv.package || pkgJson.name || 'pgpm';
47
47
  const registry = argv.registry;
48
48
  const dryRun = Boolean(argv['dry-run']);
package/commands.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.commands = exports.createPgpmCommandMap = void 0;
7
+ const find_and_require_package_json_1 = require("find-and-require-package-json");
7
8
  const pg_cache_1 = require("pg-cache");
8
9
  const add_1 = __importDefault(require("./commands/add"));
9
10
  const admin_users_1 = __importDefault(require("./commands/admin-users"));
@@ -27,7 +28,6 @@ const rename_1 = __importDefault(require("./commands/rename"));
27
28
  const revert_1 = __importDefault(require("./commands/revert"));
28
29
  const tag_1 = __importDefault(require("./commands/tag"));
29
30
  const verify_1 = __importDefault(require("./commands/verify"));
30
- const package_2 = require("./package");
31
31
  const utils_1 = require("./utils");
32
32
  const cli_error_1 = require("./utils/cli-error");
33
33
  const update_check_1 = require("./utils/update-check");
@@ -71,7 +71,7 @@ const createPgpmCommandMap = (skipPgTeardown = false) => {
71
71
  exports.createPgpmCommandMap = createPgpmCommandMap;
72
72
  const commands = async (argv, prompter, options) => {
73
73
  if (argv.version || argv.v) {
74
- const pkg = (0, package_2.readAndParsePackageJson)();
74
+ const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
75
75
  console.log(pkg.version);
76
76
  process.exit(0);
77
77
  }
@@ -99,7 +99,7 @@ const commands = async (argv, prompter, options) => {
99
99
  try {
100
100
  await (0, update_check_1.checkForUpdates)({
101
101
  command,
102
- pkgVersion: (0, package_2.readAndParsePackageJson)().version
102
+ pkgVersion: (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname).version
103
103
  });
104
104
  }
105
105
  catch {
@@ -1,6 +1,6 @@
1
+ import { findAndRequirePackageJson } from 'find-and-require-package-json';
1
2
  import { Logger } from '@launchql/logger';
2
3
  import { spawn } from 'child_process';
3
- import { readAndParsePackageJson } from '../package';
4
4
  import { fetchLatestVersion } from '../utils/npm-version';
5
5
  import { cliExitWithError } from '../utils/cli-error';
6
6
  const log = new Logger('update');
@@ -40,7 +40,7 @@ export default async (argv, _prompter, _options) => {
40
40
  console.log(updateUsageText);
41
41
  process.exit(0);
42
42
  }
43
- const pkgJson = readAndParsePackageJson();
43
+ const pkgJson = findAndRequirePackageJson(__dirname);
44
44
  const pkgName = argv.package || pkgJson.name || 'pgpm';
45
45
  const registry = argv.registry;
46
46
  const dryRun = Boolean(argv['dry-run']);
package/esm/commands.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { findAndRequirePackageJson } from 'find-and-require-package-json';
1
2
  import { teardownPgPools } from 'pg-cache';
2
3
  import add from './commands/add';
3
4
  import adminUsers from './commands/admin-users';
@@ -21,7 +22,6 @@ import renameCmd from './commands/rename';
21
22
  import revert from './commands/revert';
22
23
  import tag from './commands/tag';
23
24
  import verify from './commands/verify';
24
- import { readAndParsePackageJson } from './package';
25
25
  import { extractFirst, usageText } from './utils';
26
26
  import { cliExitWithError } from './utils/cli-error';
27
27
  import { checkForUpdates } from './utils/update-check';
@@ -64,7 +64,7 @@ export const createPgpmCommandMap = (skipPgTeardown = false) => {
64
64
  };
65
65
  export const commands = async (argv, prompter, options) => {
66
66
  if (argv.version || argv.v) {
67
- const pkg = readAndParsePackageJson();
67
+ const pkg = findAndRequirePackageJson(__dirname);
68
68
  console.log(pkg.version);
69
69
  process.exit(0);
70
70
  }
@@ -92,7 +92,7 @@ export const commands = async (argv, prompter, options) => {
92
92
  try {
93
93
  await checkForUpdates({
94
94
  command,
95
- pkgVersion: readAndParsePackageJson().version
95
+ pkgVersion: findAndRequirePackageJson(__dirname).version
96
96
  });
97
97
  }
98
98
  catch {
@@ -1,8 +1,8 @@
1
+ import { findAndRequirePackageJson } from 'find-and-require-package-json';
1
2
  import yanse from 'yanse';
2
- import { readAndParsePackageJson } from '../package';
3
3
  // Function to display the version information
4
4
  export function displayVersion() {
5
- const pkg = readAndParsePackageJson();
5
+ const pkg = findAndRequirePackageJson(__dirname);
6
6
  console.log(yanse.green(`Name: ${pkg.name}`));
7
7
  console.log(yanse.blue(`Version: ${pkg.version}`));
8
8
  }
@@ -1,6 +1,6 @@
1
+ import { findAndRequirePackageJson } from 'find-and-require-package-json';
1
2
  import { Logger } from '@launchql/logger';
2
3
  import { UPDATE_CHECK_APPSTASH_KEY, UPDATE_CHECK_TTL_MS, UPDATE_PACKAGE_NAME } from '@launchql/types';
3
- import { readAndParsePackageJson } from '../package';
4
4
  import { compareVersions, fetchLatestVersion } from './npm-version';
5
5
  import { readUpdateConfig, shouldCheck, writeUpdateConfig } from './update-config';
6
6
  const log = new Logger('update-check');
@@ -14,7 +14,7 @@ const shouldSkip = (command) => {
14
14
  return false;
15
15
  };
16
16
  export async function checkForUpdates(options = {}) {
17
- const { pkgName = UPDATE_PACKAGE_NAME, pkgVersion = readAndParsePackageJson().version, command, now = Date.now(), key = UPDATE_CHECK_APPSTASH_KEY, toolName, baseDir } = options;
17
+ const { pkgName = UPDATE_PACKAGE_NAME, pkgVersion = findAndRequirePackageJson(__dirname).version, command, now = Date.now(), key = UPDATE_CHECK_APPSTASH_KEY, toolName, baseDir } = options;
18
18
  if (shouldSkip(command)) {
19
19
  return null;
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgpm",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PostgreSQL Package Manager - Database migration and package management CLI",
6
6
  "main": "index.js",
@@ -36,25 +36,26 @@
36
36
  "@types/js-yaml": "^4.0.9",
37
37
  "@types/minimist": "^1.2.5",
38
38
  "@types/node": "^20.12.7",
39
- "@types/pg": "^8.15.2",
39
+ "@types/pg": "^8.16.0",
40
40
  "@types/semver": "^7.5.8",
41
41
  "@types/shelljs": "^0.8.16",
42
42
  "glob": "^13.0.0",
43
43
  "makage": "^0.1.8",
44
- "pg": "^8.16.0",
44
+ "pg": "^8.16.3",
45
45
  "ts-node": "^10.9.2"
46
46
  },
47
47
  "dependencies": {
48
- "@launchql/core": "^2.18.1",
48
+ "@launchql/core": "^2.18.3",
49
49
  "@launchql/env": "^2.6.1",
50
50
  "@launchql/logger": "^1.2.1",
51
51
  "@launchql/types": "^2.10.1",
52
52
  "appstash": "^0.2.4",
53
- "create-gen-app": "^0.3.1",
54
- "inquirerer": "^2.1.8",
53
+ "create-gen-app": "^0.3.3",
54
+ "find-and-require-package-json": "^0.8.0",
55
+ "inquirerer": "^2.1.11",
55
56
  "js-yaml": "^4.1.0",
56
57
  "minimist": "^1.2.8",
57
- "pg-cache": "^1.5.1",
58
+ "pg-cache": "^1.5.2",
58
59
  "pg-env": "^1.2.1",
59
60
  "semver": "^7.6.2",
60
61
  "shelljs": "^0.10.0",
@@ -72,5 +73,5 @@
72
73
  "pg",
73
74
  "pgsql"
74
75
  ],
75
- "gitHead": "3bfa1e2c4524664d19ebfa2baf214403821bdee9"
76
+ "gitHead": "d20ccff8c779259574a23e93abbae51234695db5"
76
77
  }
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,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkForUpdates = checkForUpdates;
4
+ const find_and_require_package_json_1 = require("find-and-require-package-json");
4
5
  const logger_1 = require("@launchql/logger");
5
6
  const types_1 = require("@launchql/types");
6
- const package_1 = require("../package");
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
  }
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
- }