@pnpm/plugin-commands-patching 1.2.2 → 1.3.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.
- package/lib/patch.d.ts +8 -2
- package/lib/patch.js +29 -6
- package/lib/patch.js.map +1 -1
- package/package.json +7 -6
package/lib/patch.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Config } from '@pnpm/config';
|
|
2
2
|
import { LogBase } from '@pnpm/logger';
|
|
3
3
|
import { CreateStoreControllerOptions } from '@pnpm/store-connection-manager';
|
|
4
|
-
export declare
|
|
5
|
-
export declare function cliOptionsTypes():
|
|
4
|
+
export declare function rcOptionsTypes(): Pick<any, never>;
|
|
5
|
+
export declare function cliOptionsTypes(): {
|
|
6
|
+
'edit-dir': StringConstructor;
|
|
7
|
+
};
|
|
8
|
+
export declare const shorthands: {
|
|
9
|
+
d: string;
|
|
10
|
+
};
|
|
6
11
|
export declare const commandNames: string[];
|
|
7
12
|
export declare function help(): string;
|
|
8
13
|
export declare type PatchCommandOptions = Pick<Config, 'dir' | 'registries' | 'tag' | 'storeDir'> & CreateStoreControllerOptions & {
|
|
14
|
+
editDir?: string;
|
|
9
15
|
reporter?: (logObj: LogBase) => void;
|
|
10
16
|
};
|
|
11
17
|
export declare function handler(opts: PatchCommandOptions, params: string[]): Promise<string>;
|
package/lib/patch.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handler = exports.help = exports.commandNames = exports.cliOptionsTypes = exports.rcOptionsTypes = void 0;
|
|
6
|
+
exports.handler = exports.help = exports.commandNames = exports.shorthands = exports.cliOptionsTypes = exports.rcOptionsTypes = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const cli_utils_1 = require("@pnpm/cli-utils");
|
|
9
10
|
const config_1 = require("@pnpm/config");
|
|
@@ -13,18 +14,33 @@ const pick_1 = __importDefault(require("ramda/src/pick"));
|
|
|
13
14
|
const pick_registry_for_package_1 = __importDefault(require("@pnpm/pick-registry-for-package"));
|
|
14
15
|
const render_help_1 = __importDefault(require("render-help"));
|
|
15
16
|
const tempy_1 = __importDefault(require("tempy"));
|
|
16
|
-
|
|
17
|
-
function
|
|
17
|
+
const error_1 = __importDefault(require("@pnpm/error"));
|
|
18
|
+
function rcOptionsTypes() {
|
|
18
19
|
return (0, pick_1.default)([], config_1.types);
|
|
19
20
|
}
|
|
21
|
+
exports.rcOptionsTypes = rcOptionsTypes;
|
|
22
|
+
function cliOptionsTypes() {
|
|
23
|
+
return { ...rcOptionsTypes(), 'edit-dir': String };
|
|
24
|
+
}
|
|
20
25
|
exports.cliOptionsTypes = cliOptionsTypes;
|
|
26
|
+
exports.shorthands = {
|
|
27
|
+
d: '--edit-dir',
|
|
28
|
+
};
|
|
21
29
|
exports.commandNames = ['patch'];
|
|
22
30
|
function help() {
|
|
23
31
|
return (0, render_help_1.default)({
|
|
24
32
|
description: 'Prepare a package for patching',
|
|
25
|
-
descriptionLists: [
|
|
33
|
+
descriptionLists: [{
|
|
34
|
+
title: 'Options',
|
|
35
|
+
list: [
|
|
36
|
+
{
|
|
37
|
+
description: 'The package that needs to be modified will be extracted to this directory',
|
|
38
|
+
name: '--edit-dir',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
}],
|
|
26
42
|
url: (0, cli_utils_1.docsUrl)('patch'),
|
|
27
|
-
usages: ['pnpm patch'],
|
|
43
|
+
usages: ['pnpm patch <pkg name>@<version>'],
|
|
28
44
|
});
|
|
29
45
|
}
|
|
30
46
|
exports.help = help;
|
|
@@ -43,7 +59,7 @@ async function handler(opts, params) {
|
|
|
43
59
|
});
|
|
44
60
|
const filesResponse = await pkgResponse.files();
|
|
45
61
|
const tempDir = tempy_1.default.directory();
|
|
46
|
-
const userChangesDir = path_1.default.join(tempDir, 'user');
|
|
62
|
+
const userChangesDir = opts.editDir ? createPackageDirectory(opts.editDir) : path_1.default.join(tempDir, 'user');
|
|
47
63
|
await Promise.all([
|
|
48
64
|
store.ctrl.importPackage(path_1.default.join(tempDir, 'source'), {
|
|
49
65
|
filesResponse,
|
|
@@ -57,4 +73,11 @@ async function handler(opts, params) {
|
|
|
57
73
|
return `You can now edit the following folder: ${userChangesDir}`;
|
|
58
74
|
}
|
|
59
75
|
exports.handler = handler;
|
|
76
|
+
function createPackageDirectory(editDir) {
|
|
77
|
+
if (fs_1.default.existsSync(editDir)) {
|
|
78
|
+
throw new error_1.default('PATCH_EDIT_DIR_EXISTS', `The target directory already exists: '${editDir}'`);
|
|
79
|
+
}
|
|
80
|
+
fs_1.default.mkdirSync(editDir, { recursive: true });
|
|
81
|
+
return editDir;
|
|
82
|
+
}
|
|
60
83
|
//# sourceMappingURL=patch.js.map
|
package/lib/patch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../src/patch.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,+CAAyC;AACzC,yCAAwD;AAExD,
|
|
1
|
+
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../src/patch.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,gDAAuB;AACvB,+CAAyC;AACzC,yCAAwD;AAExD,6EAGuC;AACvC,4FAAiE;AACjE,0DAAiC;AACjC,gGAAoE;AACpE,8DAAoC;AACpC,kDAAyB;AACzB,wDAAmC;AAEnC,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,UAAU,EAAE,MAAM,EAAE,CAAA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AA;IACjC,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;YACrD,aAAa;YACb,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;YACvC,aAAa;YACb,KAAK,EAAE,IAAI;SACZ,CAAC;KACH,CAAC,CAAA;IACF,OAAO,0CAA0C,cAAc,EAAE,CAAA;AACnE,CAAC;AA3BD,0BA2BC;AAED,SAAS,sBAAsB,CAAE,OAAe;IAC9C,IAAI,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC1B,MAAM,IAAI,eAAS,CAAC,uBAAuB,EAAE,yCAAyC,OAAO,GAAG,CAAC,CAAA;KAClG;IACD,YAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1C,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/plugin-commands-patching",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Commands for creating patches",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,20 +24,21 @@
|
|
|
24
24
|
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/plugin-commands-patching#readme",
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@pnpm/logger": "^4.0.0",
|
|
27
|
-
"@pnpm/plugin-commands-patching": "1.
|
|
27
|
+
"@pnpm/plugin-commands-patching": "1.3.1",
|
|
28
28
|
"@pnpm/prepare": "0.0.52",
|
|
29
29
|
"@pnpm/registry-mock": "3.0.0-3",
|
|
30
30
|
"@types/ramda": "0.28.15"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@pnpm/cli-utils": "0.7.
|
|
34
|
-
"@pnpm/config": "15.10.
|
|
33
|
+
"@pnpm/cli-utils": "0.7.36",
|
|
34
|
+
"@pnpm/config": "15.10.5",
|
|
35
|
+
"@pnpm/error": "3.0.1",
|
|
35
36
|
"@pnpm/parse-wanted-dependency": "3.0.2",
|
|
36
37
|
"@pnpm/pick-registry-for-package": "3.0.6",
|
|
37
|
-
"@pnpm/plugin-commands-installation": "10.6.
|
|
38
|
+
"@pnpm/plugin-commands-installation": "10.6.5",
|
|
38
39
|
"@pnpm/read-package-json": "6.0.8",
|
|
39
40
|
"@pnpm/read-project-manifest": "3.0.9",
|
|
40
|
-
"@pnpm/store-connection-manager": "4.3.
|
|
41
|
+
"@pnpm/store-connection-manager": "4.3.9",
|
|
41
42
|
"escape-string-regexp": "^4.0.0",
|
|
42
43
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
43
44
|
"render-help": "^1.0.2",
|