@pnpm/building.commands 1100.0.23 → 1100.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.
@@ -1,3 +1,4 @@
1
+ import { checkbox, confirm } from '@inquirer/prompts';
1
2
  import { writeSettings } from '@pnpm/config.writer';
2
3
  import { parse } from '@pnpm/deps.path';
3
4
  import { PnpmError } from '@pnpm/error';
@@ -6,7 +7,6 @@ import { writeModulesManifest } from '@pnpm/installing.modules-yaml';
6
7
  import { globalInfo } from '@pnpm/logger';
7
8
  import { lexCompare } from '@pnpm/util.lex-comparator';
8
9
  import chalk from 'chalk';
9
- import enquirer from 'enquirer';
10
10
  import { renderHelp } from 'render-help';
11
11
  import { rebuild } from '../build/index.js';
12
12
  import { getAutomaticallyIgnoredBuilds } from './getAutomaticallyIgnoredBuilds.js';
@@ -86,42 +86,33 @@ export async function handler(opts, params = [], commands) {
86
86
  buildPackages = sortUniqueStrings([...automaticallyIgnoredBuilds]);
87
87
  }
88
88
  else {
89
- const { result } = await enquirer.prompt({
90
- choices: sortUniqueStrings([...automaticallyIgnoredBuilds]),
91
- indicator(state, choice) {
92
- return ` ${choice.enabled ? '●' : '○'}`;
93
- },
94
- message: 'Choose which packages to build ' +
95
- `(Press ${chalk.cyan('<space>')} to select, ` +
96
- `${chalk.cyan('<a>')} to toggle all, ` +
97
- `${chalk.cyan('<i>')} to invert selection)`,
98
- name: 'result',
99
- pointer: '❯',
100
- result() {
101
- return this.selected;
102
- },
103
- styles: {
104
- dark: chalk.reset,
105
- em: chalk.bgBlack.whiteBright,
106
- success: chalk.reset,
107
- },
108
- type: 'multiselect',
109
- // For Vim users (related: https://github.com/enquirer/enquirer/pull/163)
110
- j() {
111
- return this.down();
112
- },
113
- k() {
114
- return this.up();
115
- },
116
- cancel() {
117
- // By default, canceling the prompt via Ctrl+c throws an empty string.
118
- // The custom cancel function prevents that behavior.
119
- // Otherwise, pnpm CLI would print an error and confuse users.
120
- // See related issue: https://github.com/enquirer/enquirer/issues/225
89
+ try {
90
+ const buildPackagesValues = await checkbox({
91
+ choices: sortUniqueStrings([...automaticallyIgnoredBuilds]).map((name) => ({
92
+ name,
93
+ value: name,
94
+ })),
95
+ message: 'Choose which packages to build ' +
96
+ `(Press ${chalk.cyan('<space>')} to select, ` +
97
+ `${chalk.cyan('<a>')} to toggle all, ` +
98
+ `${chalk.cyan('<i>')} to invert selection)`,
99
+ required: false,
100
+ theme: {
101
+ icon: { checked: '●', unchecked: '○', cursor: '❯' },
102
+ style: {
103
+ highlight: chalk.bgBlack.whiteBright,
104
+ },
105
+ keybindings: ['vim'],
106
+ },
107
+ });
108
+ buildPackages = buildPackagesValues;
109
+ }
110
+ catch (err) {
111
+ if (err instanceof Error && err.name === 'ExitPromptError') {
121
112
  process.exit(0);
122
- },
123
- }); // eslint-disable-line @typescript-eslint/no-explicit-any
124
- buildPackages = result.map(({ value }) => value);
113
+ }
114
+ throw err;
115
+ }
125
116
  }
126
117
  const allowBuilds = { ...opts.allowBuilds };
127
118
  if (params.length) {
@@ -143,14 +134,20 @@ export async function handler(opts, params = [], commands) {
143
134
  }
144
135
  if (!opts.all && !params.length) {
145
136
  if (buildPackages.length) {
146
- const confirmed = await enquirer.prompt({
147
- type: 'confirm',
148
- name: 'build',
149
- message: `The next packages will now be built: ${buildPackages.join(', ')}.
150
- Do you approve?`,
151
- initial: false,
152
- });
153
- if (!confirmed.build) {
137
+ let isConfirmed;
138
+ try {
139
+ isConfirmed = await confirm({
140
+ message: `The next packages will now be built: ${buildPackages.join(', ')}.\nDo you approve?`,
141
+ default: false,
142
+ });
143
+ }
144
+ catch (err) {
145
+ if (err instanceof Error && err.name === 'ExitPromptError') {
146
+ process.exit(0);
147
+ }
148
+ throw err;
149
+ }
150
+ if (!isConfirmed) {
154
151
  return;
155
152
  }
156
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/building.commands",
3
- "version": "1100.0.23",
3
+ "version": "1100.1.1",
4
4
  "description": "Commands for rebuilding and managing dependency builds",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -25,51 +25,51 @@
25
25
  "!*.map"
26
26
  ],
27
27
  "dependencies": {
28
+ "@inquirer/prompts": "^8.4.3",
28
29
  "@pnpm/util.lex-comparator": "^3.0.2",
29
30
  "chalk": "^5.6.2",
30
- "enquirer": "^2.4.1",
31
31
  "p-limit": "^7.3.0",
32
32
  "ramda": "npm:@pnpm/ramda@0.28.1",
33
33
  "render-help": "^2.0.0",
34
- "@pnpm/building.after-install": "1101.0.17",
35
- "@pnpm/cli.common-cli-options-help": "1100.0.1",
36
- "@pnpm/cli.command": "1100.0.1",
37
34
  "@pnpm/cli.utils": "1101.0.8",
38
- "@pnpm/config.reader": "1101.4.1",
35
+ "@pnpm/cli.command": "1100.0.1",
36
+ "@pnpm/cli.common-cli-options-help": "1100.0.1",
39
37
  "@pnpm/config.writer": "1100.0.10",
40
38
  "@pnpm/deps.path": "1100.0.5",
41
- "@pnpm/error": "1100.0.0",
42
- "@pnpm/installing.commands": "1100.6.0",
39
+ "@pnpm/config.reader": "1101.5.0",
40
+ "@pnpm/installing.commands": "1100.7.1",
43
41
  "@pnpm/installing.modules-yaml": "1100.0.6",
44
- "@pnpm/prepare-temp-dir": "1100.0.0",
45
- "@pnpm/store.connection-manager": "1100.2.4",
46
42
  "@pnpm/types": "1101.2.0",
47
- "@pnpm/workspace.projects-sorter": "1100.0.4"
43
+ "@pnpm/building.after-install": "1101.0.18",
44
+ "@pnpm/prepare-temp-dir": "1100.0.0",
45
+ "@pnpm/error": "1100.0.0",
46
+ "@pnpm/workspace.projects-sorter": "1100.0.4",
47
+ "@pnpm/store.connection-manager": "1100.2.5"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@pnpm/logger": "^1001.0.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@jest/globals": "30.3.0",
54
- "@pnpm/registry-mock": "6.0.0",
55
54
  "@types/ramda": "0.31.1",
56
55
  "execa": "npm:safe-execa@0.3.0",
57
56
  "load-json-file": "^7.0.1",
58
57
  "read-yaml-file": "^3.0.0",
59
58
  "write-package": "7.2.0",
60
59
  "write-yaml-file": "^6.0.0",
61
- "@pnpm/building.commands": "1100.0.23",
62
- "@pnpm/assert-project": "1100.0.11",
63
- "@pnpm/crypto.object-hasher": "1100.0.0",
60
+ "@pnpm/building.commands": "1100.1.1",
61
+ "@pnpm/constants": "1100.0.0",
64
62
  "@pnpm/logger": "1100.0.0",
65
- "@pnpm/prepare": "1100.0.11",
66
- "@pnpm/store.cafs": "1100.1.7",
67
- "@pnpm/store.index": "1100.1.0",
63
+ "@pnpm/assert-project": "1100.0.12",
64
+ "@pnpm/crypto.object-hasher": "1100.0.0",
65
+ "@pnpm/prepare": "1100.0.12",
68
66
  "@pnpm/test-fixtures": "1100.0.0",
69
- "@pnpm/constants": "1100.0.0",
70
67
  "@pnpm/test-ipc-server": "1100.0.0",
71
- "@pnpm/testing.command-defaults": "1100.0.1",
72
- "@pnpm/workspace.projects-filter": "1100.0.16"
68
+ "@pnpm/store.cafs": "1100.1.7",
69
+ "@pnpm/testing.registry-mock": "1100.0.2",
70
+ "@pnpm/testing.command-defaults": "1100.0.2",
71
+ "@pnpm/store.index": "1100.1.0",
72
+ "@pnpm/workspace.projects-filter": "1100.0.17"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=22.13"