patch-package
patch-package copied to clipboard
the package.json patch doesn't recover in the new package
Thanks for your work.
Here I faced two problems.
- npx patch-package
--exclude '^$' doesn't work for me. Something I got was:
patch-package 6.2.2 • Creating temporary folder • Installing [email protected] with npm • Diffing your files with clean files ⁉️ Not creating patch file for package 'ts-loader' ⁉️ There don't appear to be any changes.
- So I tried to exclude some non-existent file,e.g. npx patch-package
--exclude 'a.txt'. It got worked(I can see the updated package.json in the patch file) Then, I tried to delete the old package, and do npm install, the package doesn't contain the patch file content. Btw, the script in my root project package.json, I added {"postinstall": "patch-package"}
Is there anything I missed? Please feel free to reproduce this issue with any npm package.
It seems to be working for me, this is what I'm doing:
yarn patch-package rehype-slug --exclude '^$'
Every time that I run yarn
, it restores the patch, because of the postinstall
script in my package.json
:
"scripts": {
"postinstall": "patch-package"
}
Thank you so much @karlhorky
By the way, what does the --exclude '^s'
means?
@umarluqman careful, you have an s
there, not a dollar sign :)
As far as I can tell, the --exclude '^$'
is an option to exclude no files (the ^$
is an empty regular expression, matching no strings)
@umarluqman to elaborate on what @karlhorky said, here’s regexr’s explanation on what’s going on in that regular expression:
thank you @FlorianWendelborn and @karlhorky, that makes sense