pgpm 5.8.0 → 5.8.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.
@@ -11,6 +11,7 @@ const core_1 = require("@pgpmjs/core");
11
11
  const env_1 = require("@pgpmjs/env");
12
12
  const types_1 = require("@pgpmjs/types");
13
13
  const inquirerer_1 = require("inquirerer");
14
+ const utils_1 = require("../../utils");
14
15
  const boilerplate_1 = require("./boilerplate");
15
16
  const DEFAULT_MOTD = `
16
17
  | _ _
@@ -80,7 +81,7 @@ async function handleInit(argv, prompter) {
80
81
  pglite: Boolean(argv.pglite),
81
82
  });
82
83
  const branch = argv.fromBranch;
83
- const noTty = Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true');
84
+ const noTty = (0, utils_1.isNoTtyRequested)(argv);
84
85
  const useBoilerplatePrompt = Boolean(argv.boilerplate);
85
86
  const createWorkspace = Boolean(argv.createWorkspace || argv['create-workspace'] || argv.w);
86
87
  const useNpxSkills = Boolean(argv.useSkills || argv['use-skills']);
@@ -437,7 +438,7 @@ async function handleModuleInit(argv, prompter, ctx, wasExplicitModuleRequest =
437
438
  workspaceTypeName = workspaceType.toUpperCase();
438
439
  }
439
440
  if (!resolvedWorkspacePath) {
440
- const noTty = Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true');
441
+ const noTty = (0, utils_1.isNoTtyRequested)(argv);
441
442
  // Handle --create-workspace flag: create workspace first, then module
442
443
  if (ctx.createWorkspace && (workspaceType === 'pgpm' || workspaceType === 'pnpm')) {
443
444
  // Resolve workspace template repo with fallback to default
@@ -8,6 +8,7 @@ const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const core_1 = require("@pgpmjs/core");
10
10
  const inquirerer_1 = require("inquirerer");
11
+ const utils_1 = require("../../utils");
11
12
  const DEFAULT_MOTD = `
12
13
  | _ _
13
14
  === |.===. '\\-//\`
@@ -48,7 +49,7 @@ async function runWorkspaceSetup(argv, prompter) {
48
49
  workspaceName: answers.name
49
50
  },
50
51
  toolName: core_1.DEFAULT_TEMPLATE_TOOL_NAME,
51
- noTty: Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true'),
52
+ noTty: (0, utils_1.isNoTtyRequested)(argv),
52
53
  cwd,
53
54
  prompter
54
55
  });
@@ -5,6 +5,7 @@ import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, inspectTemplate, Pgp
5
5
  import { resolveWorkspaceByType } from '@pgpmjs/env';
6
6
  import { errors } from '@pgpmjs/types';
7
7
  import { registerDefaultResolver } from 'inquirerer';
8
+ import { isNoTtyRequested } from '../../utils';
8
9
  import { persistBoilerplateSource, readBoilerplateSource, resolveInitTemplateRepo, } from './boilerplate';
9
10
  const DEFAULT_MOTD = `
10
11
  | _ _
@@ -73,7 +74,7 @@ async function handleInit(argv, prompter) {
73
74
  pglite: Boolean(argv.pglite),
74
75
  });
75
76
  const branch = argv.fromBranch;
76
- const noTty = Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true');
77
+ const noTty = isNoTtyRequested(argv);
77
78
  const useBoilerplatePrompt = Boolean(argv.boilerplate);
78
79
  const createWorkspace = Boolean(argv.createWorkspace || argv['create-workspace'] || argv.w);
79
80
  const useNpxSkills = Boolean(argv.useSkills || argv['use-skills']);
@@ -430,7 +431,7 @@ async function handleModuleInit(argv, prompter, ctx, wasExplicitModuleRequest =
430
431
  workspaceTypeName = workspaceType.toUpperCase();
431
432
  }
432
433
  if (!resolvedWorkspacePath) {
433
- const noTty = Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true');
434
+ const noTty = isNoTtyRequested(argv);
434
435
  // Handle --create-workspace flag: create workspace first, then module
435
436
  if (ctx.createWorkspace && (workspaceType === 'pgpm' || workspaceType === 'pnpm')) {
436
437
  // Resolve workspace template repo with fallback to default
@@ -2,6 +2,7 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, scaffoldTemplate, sluggify } from '@pgpmjs/core';
4
4
  import { registerDefaultResolver } from 'inquirerer';
5
+ import { isNoTtyRequested } from '../../utils';
5
6
  const DEFAULT_MOTD = `
6
7
  | _ _
7
8
  === |.===. '\\-//\`
@@ -42,7 +43,7 @@ export default async function runWorkspaceSetup(argv, prompter) {
42
43
  workspaceName: answers.name
43
44
  },
44
45
  toolName: DEFAULT_TEMPLATE_TOOL_NAME,
45
- noTty: Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true'),
46
+ noTty: isNoTtyRequested(argv),
46
47
  cwd,
47
48
  prompter
48
49
  });
package/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { CLI, getPackageJson } from 'inquirerer';
3
3
  import { commands, createPgpmCommandMap } from './commands';
4
+ import { detectNoTtyFromProcess } from './utils';
4
5
  export { createInitUsageText } from './commands/init';
5
6
  export { createPgpmCommandMap };
6
7
  export { default as add } from './commands/add';
@@ -49,7 +50,7 @@ if (require.main === module) {
49
50
  console.log(pkg.version);
50
51
  process.exit(0);
51
52
  }
52
- const app = new CLI(commands, options);
53
+ const app = new CLI(commands, { ...options, noTty: detectNoTtyFromProcess() });
53
54
  app.run().then(() => {
54
55
  }).catch(error => {
55
56
  console.error('Unexpected error:', error);
@@ -6,3 +6,4 @@ export * from './driver';
6
6
  export * from './module-utils';
7
7
  export * from './npm-version';
8
8
  export * from './package-alias';
9
+ export * from './tty';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Determine whether the CLI should run in non-interactive (noTty) mode from
3
+ * parsed argv and the environment. Minimist parses `--no-tty` as `tty: false`.
4
+ */
5
+ export const isNoTtyRequested = (argv) => Boolean(argv.noTty ||
6
+ argv['no-tty'] ||
7
+ argv.tty === false ||
8
+ process.env.CI === 'true');
9
+ /**
10
+ * Detect noTty mode from raw process argv, before minimist parsing. Used at
11
+ * CLI construction time so the shared prompter itself is non-interactive.
12
+ */
13
+ export const detectNoTtyFromProcess = (argv = process.argv) => argv.includes('--no-tty') ||
14
+ argv.includes('--noTty') ||
15
+ process.env.CI === 'true';
package/index.js CHANGED
@@ -22,6 +22,7 @@ exports.options = exports.verify = exports.testPackages = exports.tag = exports.
22
22
  const inquirerer_1 = require("inquirerer");
23
23
  const commands_1 = require("./commands");
24
24
  Object.defineProperty(exports, "createPgpmCommandMap", { enumerable: true, get: function () { return commands_1.createPgpmCommandMap; } });
25
+ const utils_1 = require("./utils");
25
26
  var init_1 = require("./commands/init");
26
27
  Object.defineProperty(exports, "createInitUsageText", { enumerable: true, get: function () { return init_1.createInitUsageText; } });
27
28
  var add_1 = require("./commands/add");
@@ -92,7 +93,7 @@ if (require.main === module) {
92
93
  console.log(pkg.version);
93
94
  process.exit(0);
94
95
  }
95
- const app = new inquirerer_1.CLI(commands_1.commands, exports.options);
96
+ const app = new inquirerer_1.CLI(commands_1.commands, { ...exports.options, noTty: (0, utils_1.detectNoTtyFromProcess)() });
96
97
  app.run().then(() => {
97
98
  }).catch(error => {
98
99
  console.error('Unexpected error:', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgpm",
3
- "version": "5.8.0",
3
+ "version": "5.8.1",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PostgreSQL Package Manager - Database migration and package management CLI",
6
6
  "main": "index.js",
@@ -46,9 +46,9 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@inquirerer/utils": "^3.3.9",
49
- "@pgpmjs/core": "^7.9.0",
49
+ "@pgpmjs/core": "^7.9.1",
50
50
  "@pgpmjs/env": "^2.33.0",
51
- "@pgpmjs/export": "^1.8.1",
51
+ "@pgpmjs/export": "^1.8.2",
52
52
  "@pgpmjs/logger": "^2.18.0",
53
53
  "@pgpmjs/slice": "^0.5.0",
54
54
  "@pgpmjs/types": "^2.40.0",
@@ -77,5 +77,5 @@
77
77
  "pg",
78
78
  "pgsql"
79
79
  ],
80
- "gitHead": "f36bcdd2b5dada626955e9e05b19c80ca9f92ed5"
80
+ "gitHead": "dd16395013ff8c9d5e4cd2f5f5bec72c46f4099b"
81
81
  }
package/utils/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from './driver';
6
6
  export * from './module-utils';
7
7
  export * from './npm-version';
8
8
  export * from './package-alias';
9
+ export * from './tty';
package/utils/index.js CHANGED
@@ -22,3 +22,4 @@ __exportStar(require("./driver"), exports);
22
22
  __exportStar(require("./module-utils"), exports);
23
23
  __exportStar(require("./npm-version"), exports);
24
24
  __exportStar(require("./package-alias"), exports);
25
+ __exportStar(require("./tty"), exports);
package/utils/tty.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Determine whether the CLI should run in non-interactive (noTty) mode from
3
+ * parsed argv and the environment. Minimist parses `--no-tty` as `tty: false`.
4
+ */
5
+ export declare const isNoTtyRequested: (argv: Partial<Record<string, any>>) => boolean;
6
+ /**
7
+ * Detect noTty mode from raw process argv, before minimist parsing. Used at
8
+ * CLI construction time so the shared prompter itself is non-interactive.
9
+ */
10
+ export declare const detectNoTtyFromProcess: (argv?: string[]) => boolean;
package/utils/tty.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectNoTtyFromProcess = exports.isNoTtyRequested = void 0;
4
+ /**
5
+ * Determine whether the CLI should run in non-interactive (noTty) mode from
6
+ * parsed argv and the environment. Minimist parses `--no-tty` as `tty: false`.
7
+ */
8
+ const isNoTtyRequested = (argv) => Boolean(argv.noTty ||
9
+ argv['no-tty'] ||
10
+ argv.tty === false ||
11
+ process.env.CI === 'true');
12
+ exports.isNoTtyRequested = isNoTtyRequested;
13
+ /**
14
+ * Detect noTty mode from raw process argv, before minimist parsing. Used at
15
+ * CLI construction time so the shared prompter itself is non-interactive.
16
+ */
17
+ const detectNoTtyFromProcess = (argv = process.argv) => argv.includes('--no-tty') ||
18
+ argv.includes('--noTty') ||
19
+ process.env.CI === 'true';
20
+ exports.detectNoTtyFromProcess = detectNoTtyFromProcess;