@pnpm/plugin-commands-patching 3.0.9 → 3.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/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/patchRemove.d.ts +8 -0
- package/lib/patchRemove.js +74 -0
- package/lib/patchRemove.js.map +1 -0
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -23,9 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.patchCommit = exports.patch = void 0;
|
|
26
|
+
exports.patchRemove = exports.patchCommit = exports.patch = void 0;
|
|
27
27
|
const patch = __importStar(require("./patch"));
|
|
28
28
|
exports.patch = patch;
|
|
29
29
|
const patchCommit = __importStar(require("./patchCommit"));
|
|
30
30
|
exports.patchCommit = patchCommit;
|
|
31
|
+
const patchRemove = __importStar(require("./patchRemove"));
|
|
32
|
+
exports.patchRemove = patchRemove;
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAIvB,sBAAK;AAHd,2DAA4C;AAG5B,kCAAW;AAF3B,2DAA4C;AAEf,kCAAW"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { install } from '@pnpm/plugin-commands-installation';
|
|
2
|
+
import { type Config } from '@pnpm/config';
|
|
3
|
+
export declare function rcOptionsTypes(): Pick<any, never>;
|
|
4
|
+
export declare function cliOptionsTypes(): {};
|
|
5
|
+
export declare const commandNames: string[];
|
|
6
|
+
export declare function help(): string;
|
|
7
|
+
export type PatchRemoveCommandOptions = install.InstallCommandOptions & Pick<Config, 'dir' | 'lockfileDir' | 'patchesDir' | 'rootProjectManifest'>;
|
|
8
|
+
export declare function handler(opts: PatchRemoveCommandOptions, params: string[]): Promise<void>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.handler = exports.help = exports.commandNames = exports.cliOptionsTypes = exports.rcOptionsTypes = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
+
const cli_utils_1 = require("@pnpm/cli-utils");
|
|
10
|
+
const plugin_commands_installation_1 = require("@pnpm/plugin-commands-installation");
|
|
11
|
+
const config_1 = require("@pnpm/config");
|
|
12
|
+
const read_project_manifest_1 = require("@pnpm/read-project-manifest");
|
|
13
|
+
const error_1 = require("@pnpm/error");
|
|
14
|
+
const render_help_1 = __importDefault(require("render-help"));
|
|
15
|
+
const enquirer_1 = require("enquirer");
|
|
16
|
+
const pick_1 = __importDefault(require("ramda/src/pick"));
|
|
17
|
+
function rcOptionsTypes() {
|
|
18
|
+
return (0, pick_1.default)([], config_1.types);
|
|
19
|
+
}
|
|
20
|
+
exports.rcOptionsTypes = rcOptionsTypes;
|
|
21
|
+
function cliOptionsTypes() {
|
|
22
|
+
return { ...rcOptionsTypes() };
|
|
23
|
+
}
|
|
24
|
+
exports.cliOptionsTypes = cliOptionsTypes;
|
|
25
|
+
exports.commandNames = ['patch-remove'];
|
|
26
|
+
function help() {
|
|
27
|
+
return (0, render_help_1.default)({
|
|
28
|
+
description: 'Remove existing patch files',
|
|
29
|
+
url: (0, cli_utils_1.docsUrl)('patch-remove'),
|
|
30
|
+
usages: ['pnpm patch-remove [pkg...]'],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.help = help;
|
|
34
|
+
async function handler(opts, params) {
|
|
35
|
+
let patchesToRemove = params;
|
|
36
|
+
const lockfileDir = opts.lockfileDir ?? opts.dir ?? process.cwd();
|
|
37
|
+
const { writeProjectManifest, manifest } = await (0, read_project_manifest_1.tryReadProjectManifest)(lockfileDir);
|
|
38
|
+
const rootProjectManifest = opts.rootProjectManifest ?? manifest ?? {};
|
|
39
|
+
const patchedDependencies = rootProjectManifest.pnpm?.patchedDependencies ?? {};
|
|
40
|
+
if (!params.length) {
|
|
41
|
+
const allPatches = Object.keys(patchedDependencies);
|
|
42
|
+
if (allPatches.length) {
|
|
43
|
+
({ patches: patchesToRemove } = await (0, enquirer_1.prompt)({
|
|
44
|
+
type: 'multiselect',
|
|
45
|
+
name: 'patches',
|
|
46
|
+
message: 'Select the patch to be removed',
|
|
47
|
+
choices: allPatches,
|
|
48
|
+
validate(value) {
|
|
49
|
+
return value.length === 0 ? 'Select at least one option.' : true;
|
|
50
|
+
},
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (!patchesToRemove.length) {
|
|
55
|
+
throw new error_1.PnpmError('NO_PATCHES_TO_REMOVE', 'There are no patches that need to be removed');
|
|
56
|
+
}
|
|
57
|
+
for (const patch of patchesToRemove) {
|
|
58
|
+
if (Object.prototype.hasOwnProperty.call(patchedDependencies, patch)) {
|
|
59
|
+
const patchFile = path_1.default.join(lockfileDir, patchedDependencies[patch]);
|
|
60
|
+
await promises_1.default.rm(patchFile, { force: true });
|
|
61
|
+
delete rootProjectManifest.pnpm.patchedDependencies[patch];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
await writeProjectManifest(rootProjectManifest);
|
|
65
|
+
if (opts?.selectedProjectsGraph?.[lockfileDir]) {
|
|
66
|
+
opts.selectedProjectsGraph[lockfileDir].package.manifest = rootProjectManifest;
|
|
67
|
+
}
|
|
68
|
+
if (opts?.allProjectsGraph?.[lockfileDir].package.manifest) {
|
|
69
|
+
opts.allProjectsGraph[lockfileDir].package.manifest = rootProjectManifest;
|
|
70
|
+
}
|
|
71
|
+
return plugin_commands_installation_1.install.handler(opts);
|
|
72
|
+
}
|
|
73
|
+
exports.handler = handler;
|
|
74
|
+
//# sourceMappingURL=patchRemove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patchRemove.js","sourceRoot":"","sources":["../src/patchRemove.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,2DAA4B;AAC5B,+CAAyC;AACzC,qFAA4D;AAC5D,yCAA6D;AAC7D,uEAAoE;AACpE,uCAAuC;AACvC,8DAAoC;AACpC,uCAAiC;AACjC,0DAAiC;AAEjC,SAAgB,cAAc;IAC5B,OAAO,IAAA,cAAI,EAAC,EAAE,EAAE,cAAQ,CAAC,CAAA;AAC3B,CAAC;AAFD,wCAEC;AAED,SAAgB,eAAe;IAC7B,OAAO,EAAE,GAAG,cAAc,EAAE,EAAE,CAAA;AAChC,CAAC;AAFD,0CAEC;AAEY,QAAA,YAAY,GAAG,CAAC,cAAc,CAAC,CAAA;AAE5C,SAAgB,IAAI;IAClB,OAAO,IAAA,qBAAU,EAAC;QAChB,WAAW,EAAE,6BAA6B;QAC1C,GAAG,EAAE,IAAA,mBAAO,EAAC,cAAc,CAAC;QAC5B,MAAM,EAAE,CAAC,4BAA4B,CAAC;KACvC,CAAC,CAAA;AACJ,CAAC;AAND,oBAMC;AAIM,KAAK,UAAU,OAAO,CAAE,IAA+B,EAAE,MAAgB;IAC9E,IAAI,eAAe,GAAG,MAAM,CAAA;IAC5B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;IACjE,MAAM,EAAE,oB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,CAAA;SAC7D;KACF;IAED,MAAM,oBAAoB,CAAC,mBAAmB,CAAC,CAAA;IAE/C,IAAI,IAAI,EAAE,qBAAqB,EAAE,CAAC,WAAW,CAAC,EAAE;QAC9C,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,QAAQ,GAAG,mBAAmB,CAAA;KAC/E;IAED,IAAI,IAAI,EAAE,gBAAgB,EAAE,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE;QAC1D,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,QAAQ,GAAG,mBAAmB,CAAA;KAC1E;IAED,OAAO,sCAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC;AA/CD,0BA+CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/plugin-commands-patching",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Commands for creating patches",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@types/semver": "7.3.13",
|
|
30
30
|
"write-yaml-file": "^5.0.0",
|
|
31
31
|
"@pnpm/filter-workspace-packages": "7.0.7",
|
|
32
|
-
"@pnpm/plugin-commands-patching": "3.0
|
|
32
|
+
"@pnpm/plugin-commands-patching": "3.1.0",
|
|
33
33
|
"@pnpm/prepare": "0.0.66",
|
|
34
34
|
"@pnpm/test-fixtures": "0.0.35"
|
|
35
35
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@pnpm/parse-wanted-dependency": "5.0.0",
|
|
54
54
|
"@pnpm/patching.apply-patch": "2.0.0",
|
|
55
55
|
"@pnpm/pick-registry-for-package": "5.0.0",
|
|
56
|
-
"@pnpm/plugin-commands-installation": "13.0.
|
|
56
|
+
"@pnpm/plugin-commands-installation": "13.0.5",
|
|
57
57
|
"@pnpm/read-package-json": "8.0.0",
|
|
58
58
|
"@pnpm/read-project-manifest": "5.0.0",
|
|
59
59
|
"@pnpm/store-connection-manager": "6.0.8"
|