I have a node package react-native-push-notification
for which i have made some changes in the packages to fulfil my requirement. But every time i do a npm install
the new (original package without my changes) package overlaps with my current package.
Is there any way i can restrict npm install
to ignore my modified package? And also i want to push this package to git.
Any lead will be highly appreciated.
If I understand you correctly you have made some changes to the already existing node package
react-native-push-notification
and you would rather use your own version of it than the original.You have a couple of options:
package.json
changereact-native-push-notification
to point to your git repo (e.g. your fork on github). This is not ideal since it makes semver problematic. But it works.react-native-push-notification2
or even better, use a scoped package name e.g.@yournick/react-native-push-notification
and publish that to npm. Change yourpackage.json
to use this package instead.The best way to handle this would be to fork the repo https://help.github.com/articles/fork-a-repo/.
This way, you have control of the contents of the package.
Then update your
package.json
with your repo address.I also would recommend not pushing your packages to Git. Packages are already under version control (in their own repo) and pushing to Git just bloats your repo for no reason.
patch-package
is exactly what you're looking for: https://github.com/ds300/patch-packageIt will preserve your changes even after running
npm install
.