ds300 / ds300/patch-package

Improved DX for `patch-package --partial`

Open
#486 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

As a user of `patch-package --partial`, I would love if this mode would evolve into an interactive mode which allows for discarding conflicting hunks of the patch (to allow editing of the patch without users editing files in `node_modules/`) with a workflow similar to:

1. User runs `patch-package --partial`
2. All patches which apply are applied as normal, without any user interaction
3. Any patches containing hunks which do not fully apply are presented to the user hunk by hunk to resolve conflicts
1. Similar to `git add --patch`, a conflicting hunk is shown to the user with the question "Discard?"
2. If the user answers "yes" to the "Discard?" question, the hunk will be removed from the patch file by `patch-package`
3. Possible additional improvement: if the user answers "yes" to all "Discard?" questions for a patch, the patch file will be updated with the current version number of the package
4. If the user answers "no" to any of the "Discard?" questions, the patch process is aborted with exit code 1

**Making it default:** This new interactive mode could arguably also become the default for `patch-package`, and the `--partial` option dropped - falling back to the previous (non-partial) default mode if the terminal is non-TTY.

## Alternatives considered

A (simpler) alternative would be a new flag `--discard-conflicts` or similar, which would be a non-interactive command that would act as if the user answered "yes" to all of the "Discard?" questions mentioned above.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.