@pnpm/patching.commands 1100.0.23 → 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.
- package/lib/getPatchedDependency.js +17 -14
- package/lib/patchRemove.js +18 -10
- package/package.json +17 -17
|
@@ -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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
26
|
+
description: preferred.gitTarballUrl ? 'Git Hosted' : undefined,
|
|
27
27
|
})),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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,
|
package/lib/patchRemove.js
CHANGED
|
@@ -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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
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
|
+
"@inquirer/prompts": "^8.4.3",
|
|
28
29
|
"chalk": "^5.6.2",
|
|
29
|
-
"enquirer": "^2.4.1",
|
|
30
30
|
"escape-string-regexp": "^5.0.0",
|
|
31
31
|
"is-windows": "^1.0.2",
|
|
32
32
|
"make-empty-dir": "^4.0.0",
|
|
@@ -38,33 +38,32 @@
|
|
|
38
38
|
"semver": "^7.8.1",
|
|
39
39
|
"terminal-link": "^5.0.0",
|
|
40
40
|
"tinyglobby": "^0.2.16",
|
|
41
|
-
"@pnpm/config.reader": "1101.4.1",
|
|
42
|
-
"@pnpm/constants": "1100.0.0",
|
|
43
41
|
"@pnpm/cli.utils": "1101.0.8",
|
|
44
|
-
"@pnpm/
|
|
42
|
+
"@pnpm/config.reader": "1101.5.0",
|
|
45
43
|
"@pnpm/config.writer": "1100.0.10",
|
|
44
|
+
"@pnpm/constants": "1100.0.0",
|
|
45
|
+
"@pnpm/crypto.hash": "1100.0.1",
|
|
46
|
+
"@pnpm/error": "1100.0.0",
|
|
46
47
|
"@pnpm/fetching.pick-fetcher": "1100.0.9",
|
|
47
48
|
"@pnpm/fs.packlist": "1100.0.1",
|
|
48
|
-
"@pnpm/
|
|
49
|
-
"@pnpm/installing.modules-yaml": "1100.0.6",
|
|
50
|
-
"@pnpm/installing.commands": "1100.6.0",
|
|
49
|
+
"@pnpm/installing.commands": "1100.7.0",
|
|
51
50
|
"@pnpm/lockfile.fs": "1100.1.2",
|
|
51
|
+
"@pnpm/installing.modules-yaml": "1100.0.6",
|
|
52
52
|
"@pnpm/patching.apply-patch": "1100.0.1",
|
|
53
|
+
"@pnpm/lockfile.utils": "1100.0.10",
|
|
53
54
|
"@pnpm/pkg-manifest.reader": "1100.0.5",
|
|
54
55
|
"@pnpm/resolving.parse-wanted-dependency": "1100.0.1",
|
|
55
56
|
"@pnpm/store.path": "1100.0.1",
|
|
56
|
-
"@pnpm/
|
|
57
|
-
"@pnpm/store.connection-manager": "1100.2.4",
|
|
58
|
-
"@pnpm/workspace.workspace-manifest-reader": "1100.0.5",
|
|
57
|
+
"@pnpm/store.connection-manager": "1100.2.5",
|
|
59
58
|
"@pnpm/types": "1101.2.0",
|
|
60
|
-
"@pnpm/workspace.project-manifest-reader": "1100.0.9"
|
|
59
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.9",
|
|
60
|
+
"@pnpm/workspace.workspace-manifest-reader": "1100.0.5"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
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
|
|
74
|
+
"@pnpm/patching.commands": "1100.1.0",
|
|
75
|
+
"@pnpm/prepare": "1100.0.12",
|
|
76
76
|
"@pnpm/test-fixtures": "1100.0.0",
|
|
77
|
-
"@pnpm/testing.command-defaults": "1100.0.
|
|
78
|
-
"@pnpm/
|
|
79
|
-
"@pnpm/workspace.projects-filter": "1100.0.
|
|
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"
|