Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .yarn/versions/e834d604.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
releases:
"@yarnpkg/plugin-patch": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/cli"
9 changes: 7 additions & 2 deletions packages/plugin-patch/sources/commands/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export default class PatchCommand extends BaseCommand {

package = Option.String();

tempPatchPath: string = ``;

async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project, workspace} = await Project.find(configuration, this.context.cwd);
Expand Down Expand Up @@ -76,10 +78,13 @@ export default class PatchCommand extends BaseCommand {
}, async report => {
const unpatchedLocator = patchUtils.ensureUnpatchedLocator(locator);
const temp = await patchUtils.extractPackageToDisk(locator, {cache, project});
const tempPath = npath.fromPortablePath(temp);

this.tempPatchPath = tempPath;

report.reportJson({
locator: structUtils.stringifyLocator(unpatchedLocator),
path: npath.fromPortablePath(temp),
path: tempPath,
});

const updateString = this.update
Expand All @@ -88,7 +93,7 @@ export default class PatchCommand extends BaseCommand {

report.reportInfo(MessageName.UNNAMED, `Package ${structUtils.prettyLocator(configuration, unpatchedLocator)} got extracted with success${updateString}!`);
report.reportInfo(MessageName.UNNAMED, `You can now edit the following folder: ${formatUtils.pretty(configuration, npath.fromPortablePath(temp), `magenta`)}`);
report.reportInfo(MessageName.UNNAMED, `Once you are done run ${formatUtils.pretty(configuration, `yarn patch-commit -s ${process.platform === `win32` ? `"` : ``}${npath.fromPortablePath(temp)}${process.platform === `win32` ? `"` : ``}`, `cyan`)} and Yarn will store a patchfile based on your changes.`);
report.reportInfo(MessageName.UNNAMED, `Once you are done run ${formatUtils.pretty(configuration, `yarn patch-commit -s ${process.platform === `win32` ? `"` : ``}${tempPath}${process.platform === `win32` ? `"` : ``}`, `cyan`)} and Yarn will store a patchfile based on your changes.`);
});
}
}
2 changes: 2 additions & 0 deletions packages/plugin-patch/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import * as patchUtils from './patchUtils';

export {patchUtils};

export {PatchCommit, Patch};

export interface Hooks {
/**
* Registers a builtin patch that can be referenced using the dedicated
Expand Down