@pnpm/patching.commands 1100.0.22 → 1100.1.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.
@@ -1,10 +1,10 @@
1
1
  import path from 'node:path';
2
+ import { confirm, select } from '@inquirer/prompts';
2
3
  import { PnpmError } from '@pnpm/error';
3
4
  import { isGitHostedPkgUrl } from '@pnpm/fetching.pick-fetcher';
4
5
  import { readCurrentLockfile } from '@pnpm/lockfile.fs';
5
6
  import { nameVerFromPkgSnapshot } from '@pnpm/lockfile.utils';
6
7
  import { parseWantedDependency } from '@pnpm/resolving.parse-wanted-dependency';
7
- import enquirer from 'enquirer';
8
8
  import { realpathMissing } from 'realpath-missing';
9
9
  import semver from 'semver';
10
10
  export async function getPatchedDependency(rawDependency, opts) {
@@ -15,25 +15,28 @@ export async function getPatchedDependency(rawDependency, opts) {
15
15
  }
16
16
  dep.alias = dep.alias ?? rawDependency;
17
17
  if (preferredVersions.length > 1) {
18
- const { version, applyToAll } = await enquirer.prompt([{
19
- type: 'select',
20
- name: 'version',
18
+ let version;
19
+ let applyToAll;
20
+ try {
21
+ version = await select({
21
22
  message: 'Choose which version to patch',
22
23
  choices: preferredVersions.map(preferred => ({
23
24
  name: preferred.version,
24
- message: preferred.version,
25
25
  value: preferred.gitTarballUrl ?? preferred.version,
26
- hint: preferred.gitTarballUrl ? 'Git Hosted' : undefined,
26
+ description: preferred.gitTarballUrl ? 'Git Hosted' : undefined,
27
27
  })),
28
- result(selected) {
29
- const selectedVersion = preferredVersions.find(preferred => preferred.version === selected);
30
- return selectedVersion.gitTarballUrl ?? selected;
31
- },
32
- }, {
33
- type: 'confirm',
34
- name: 'applyToAll',
28
+ theme: { keybindings: ['vim'] },
29
+ });
30
+ applyToAll = await confirm({
35
31
  message: 'Apply this patch to all versions?',
36
- }]);
32
+ });
33
+ }
34
+ catch (err) {
35
+ if (err instanceof Error && err.name === 'ExitPromptError') {
36
+ throw new PnpmError('PATCH_CANCELED', 'Canceled');
37
+ }
38
+ throw err;
39
+ }
37
40
  return {
38
41
  ...dep,
39
42
  applyToAll,
@@ -1,10 +1,10 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
+ import { checkbox } from '@inquirer/prompts';
3
4
  import { docsUrl } from '@pnpm/cli.utils';
4
5
  import { types as allTypes } from '@pnpm/config.reader';
5
6
  import { PnpmError } from '@pnpm/error';
6
7
  import { install } from '@pnpm/installing.commands';
7
- import enquirer from 'enquirer';
8
8
  import { pick } from 'ramda';
9
9
  import { renderHelp } from 'render-help';
10
10
  import { updatePatchedDependencies } from './updatePatchedDependencies.js';
@@ -29,15 +29,23 @@ export async function handler(opts, params) {
29
29
  if (!params.length) {
30
30
  const allPatches = Object.keys(patchedDependencies);
31
31
  if (allPatches.length) {
32
- ({ patches: patchesToRemove } = await enquirer.prompt({
33
- type: 'multiselect',
34
- name: 'patches',
35
- message: 'Select the patch to be removed',
36
- choices: allPatches,
37
- validate(value) {
38
- return value.length === 0 ? 'Select at least one option.' : true;
39
- },
40
- }));
32
+ try {
33
+ patchesToRemove = await checkbox({
34
+ choices: allPatches.map((name) => ({ name, value: name })),
35
+ message: 'Select the patch to be removed',
36
+ required: true,
37
+ validate: (values) => {
38
+ return values.length === 0 ? 'Select at least one option.' : true;
39
+ },
40
+ theme: { keybindings: ['vim'] },
41
+ });
42
+ }
43
+ catch (err) {
44
+ if (err instanceof Error && err.name === 'ExitPromptError') {
45
+ throw new PnpmError('PATCH_REMOVE_CANCELED', 'Canceled');
46
+ }
47
+ throw err;
48
+ }
41
49
  }
42
50
  }
43
51
  if (!patchesToRemove.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/patching.commands",
3
- "version": "1100.0.22",
3
+ "version": "1100.1.0",
4
4
  "description": "Commands for creating patches",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -25,8 +25,8 @@
25
25
  "!*.map"
26
26
  ],
27
27
  "dependencies": {
28
- "chalk": "^5.6.0",
29
- "enquirer": "^2.4.1",
28
+ "@inquirer/prompts": "^8.4.3",
29
+ "chalk": "^5.6.2",
30
30
  "escape-string-regexp": "^5.0.0",
31
31
  "is-windows": "^1.0.2",
32
32
  "make-empty-dir": "^4.0.0",
@@ -35,36 +35,35 @@
35
35
  "realpath-missing": "^2.0.0",
36
36
  "render-help": "^2.0.0",
37
37
  "safe-execa": "^0.3.0",
38
- "semver": "^7.7.2",
38
+ "semver": "^7.8.1",
39
39
  "terminal-link": "^5.0.0",
40
- "tinyglobby": "^0.2.14",
41
- "@pnpm/cli.utils": "1101.0.7",
42
- "@pnpm/config.reader": "1101.4.0",
43
- "@pnpm/config.writer": "1100.0.9",
40
+ "tinyglobby": "^0.2.16",
41
+ "@pnpm/cli.utils": "1101.0.8",
42
+ "@pnpm/config.reader": "1101.5.0",
43
+ "@pnpm/config.writer": "1100.0.10",
44
44
  "@pnpm/constants": "1100.0.0",
45
45
  "@pnpm/crypto.hash": "1100.0.1",
46
46
  "@pnpm/error": "1100.0.0",
47
- "@pnpm/fetching.pick-fetcher": "1100.0.8",
47
+ "@pnpm/fetching.pick-fetcher": "1100.0.9",
48
48
  "@pnpm/fs.packlist": "1100.0.1",
49
- "@pnpm/installing.commands": "1100.5.0",
50
- "@pnpm/installing.modules-yaml": "1100.0.5",
51
- "@pnpm/lockfile.fs": "1100.1.1",
52
- "@pnpm/lockfile.utils": "1100.0.9",
53
- "@pnpm/pkg-manifest.reader": "1100.0.4",
54
- "@pnpm/patching.apply-patch": "1100.0.0",
49
+ "@pnpm/installing.commands": "1100.7.0",
50
+ "@pnpm/lockfile.fs": "1100.1.2",
51
+ "@pnpm/installing.modules-yaml": "1100.0.6",
52
+ "@pnpm/patching.apply-patch": "1100.0.1",
53
+ "@pnpm/lockfile.utils": "1100.0.10",
54
+ "@pnpm/pkg-manifest.reader": "1100.0.5",
55
55
  "@pnpm/resolving.parse-wanted-dependency": "1100.0.1",
56
- "@pnpm/store.connection-manager": "1100.2.3",
57
56
  "@pnpm/store.path": "1100.0.1",
58
- "@pnpm/types": "1101.1.1",
59
- "@pnpm/workspace.project-manifest-reader": "1100.0.8",
60
- "@pnpm/workspace.workspace-manifest-reader": "1100.0.4"
57
+ "@pnpm/store.connection-manager": "1100.2.5",
58
+ "@pnpm/types": "1101.2.0",
59
+ "@pnpm/workspace.project-manifest-reader": "1100.0.9",
60
+ "@pnpm/workspace.workspace-manifest-reader": "1100.0.5"
61
61
  },
62
62
  "peerDependencies": {
63
- "@pnpm/logger": ">=1001.0.0 <1002.0.0"
63
+ "@pnpm/logger": "^1001.0.1"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@jest/globals": "30.3.0",
67
- "@pnpm/registry-mock": "6.0.0",
68
67
  "@types/is-windows": "^1.0.2",
69
68
  "@types/normalize-path": "^3.0.2",
70
69
  "@types/ramda": "0.31.1",
@@ -72,11 +71,12 @@
72
71
  "tempy": "3.0.0",
73
72
  "write-yaml-file": "^6.0.0",
74
73
  "@pnpm/logger": "1100.0.0",
75
- "@pnpm/patching.commands": "1100.0.22",
76
- "@pnpm/prepare": "1100.0.10",
74
+ "@pnpm/patching.commands": "1100.1.0",
75
+ "@pnpm/prepare": "1100.0.12",
77
76
  "@pnpm/test-fixtures": "1100.0.0",
78
- "@pnpm/testing.command-defaults": "1100.0.1",
79
- "@pnpm/workspace.projects-filter": "1100.0.15"
77
+ "@pnpm/testing.command-defaults": "1100.0.2",
78
+ "@pnpm/testing.registry-mock": "1100.0.2",
79
+ "@pnpm/workspace.projects-filter": "1100.0.17"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=22.13"