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:
User runs patch-package --partial
All patches which apply are applied as normal, without any user interaction
Any patches containing hunks which do not fully apply are presented to the user hunk by hunk to resolve conflicts
Similar to git add --patch, a conflicting hunk is shown to the user with the question "Discard?"
If the user answers "yes" to the "Discard?" question, the hunk will be removed from the patch file by patch-package
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
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.
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 innode_modules/
) with a workflow similar to:patch-package --partial
git add --patch
, a conflicting hunk is shown to the user with the question "Discard?"patch-package
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.