Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple patches per package #13

Open
milahu opened this issue Apr 14, 2022 · 1 comment
Open

multiple patches per package #13

milahu opened this issue Apr 14, 2022 · 1 comment

Comments

@milahu
Copy link
Owner

milahu commented Apr 14, 2022

ds300#43

@milahu milahu changed the title multiple patches per packagex multiple patches per package Apr 14, 2022
@milahu
Copy link
Owner Author

milahu commented Oct 24, 2022

ds300#43 (comment)

a good approach to capturing the patch would be similar to git add -p, where you get an interactive prompt for staging the patch. Given that you're already using git under the hood, this actually shouldn't be too much of an undertaking.

before: create simple patch

npx patch-package some-package

this will create one patch file in patches/some-package+1.2.3.patch

after: create multi patch

npx patch-package some-package --multi

this should

init a git repo in node_modules/some-package
copy old patches from patches/some-package/*.patch into the git repo
tell the user how to use the git repo:

pushd node_modules/some-package
git log
git add -p some/file.js
git commit -m "changes 1"
git add -p some/file.js
git commit -m "changes 2"
popd

now the user can copy patches from git to patches/some-package/*.patch

npx patch-package some-package --multi-done

this uses git format-patch to generate the patch files
but ideally, replace the patch numbers with timestamps

on the next call to

npx patch-package some-package

patch-package sees that there are multiple patches in patches/some-package/*.patch
so it automatically starts the "multi" mode
except the user calls

npx patch-package some-package --simple

then the multiple patches are converted into one patch file

as this is an experimental feature, create a backup copy of the user's files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant