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

the package.json patch doesn't recover in the new package #237

Open
JeanZhao opened this issue May 20, 2020 · 5 comments
Open

the package.json patch doesn't recover in the new package #237

JeanZhao opened this issue May 20, 2020 · 5 comments

Comments

@JeanZhao
Copy link

JeanZhao commented May 20, 2020

Thanks for your work.

Here I faced two problems.

  1. 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.

  1. 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.

@karlhorky
Copy link

karlhorky commented Aug 26, 2021

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"
  }

@umarluqman
Copy link

Thank you so much @karlhorky
By the way, what does the --exclude '^s' means?

@karlhorky
Copy link

@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)

@FlorianWendelborn
Copy link

@umarluqman to elaborate on what @karlhorky said, here’s regexr’s explanation on what’s going on in that regular expression:
image

@umarluqman
Copy link

thank you @FlorianWendelborn and @karlhorky, that makes sense

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

4 participants