-
-
Notifications
You must be signed in to change notification settings - Fork 301
support changing package.json #250
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
Comments
does adding |
Could patching dependencies changes in |
I tried @hazem3500's suggestion and while it did read the file changes and created a patch, applying the patch caused the following error **ERROR** Failed to apply patch for package @cypress/webpack-preprocessor at path Patches to I think one way to achieve this is by tagging those package.json patches then apply them via a |
#237 related |
@hazem3500 I previously tried with |
@FlorianWendelborn you're welcome 😄 |
@mwmcode but during that time the package does not exist yet? So I guess if you want to patch some dependency, you have to patch in The patch I need to do in I can generate the patch just fine, but the application files, because the package.json file is different for everyone on each install as I guess instead of |
is there a workaround for this? |
edit: sorry, i skipped
for me, the patch is applied, but changes to
this should work off topic: creating patch for package.json via --exclude "" workaround
blame the buggy arg parser. fixed in my fork in milahu@bf8e1e7 npm i -D @milahu/patch-package
npx patch-package cowsay --exclude ""
cat patches/cowsay*.patch # generated by patch-package 6.4.12
#
# declared package:
# cowsay: ^1.5.0
#
diff --git a/node_modules/cowsay/package.json b/node_modules/cowsay/package.json
index 7911c63..4fed97d 100644
--- a/node_modules/cowsay/package.json
+++ b/node_modules/cowsay/package.json
@@ -1,7 +1,7 @@
{
"name": "cowsay",
"version": "1.5.0",
- "description": "cowsay is a configurable talking cow",
+ "description": "cowsay is a configurable talking cow ... and stuff",
"keywords": [
"cow",
"cowsay", problem is, npm can modify the so ideally, the patch file would be a javascript file, for example // patches/cowsay+^1.5.0.patch.js
module.exports = [
{
file: "package.json",
//file: /^package.json$/, // can be regex
patch: (content) => {
var pkg = JSON.parse(content);
pkg.description += " ... and stuff";
content = JSON.stringify(pkg, null, 2);
return content;
}
}
// can have more entries
] should be easy to implement. PRs welcome : ) |
If you need to change dependencies, you probably want to use |
I think I've been back to this page at least 10 times. |
Interestingly, the difficulty seems to have increased further, now I have to use this: |
Hi!
I make some changes in
package.json
file, add exports fieldbut
patch-package
doesn't see any changes in itThe text was updated successfully, but these errors were encountered: