We have decided to go with ng2-smart-table for table grid in our project. But it is not supporting completely what we need to do in our project.
So we have decided to change code on its package level (Files inside to the node_modules directory). So I am not sure how to do it, because if I change something on their package level and if we run npm install
command by mistakenly, it will overwrite our changes if they have any updates.
So what do we need to do if I want to made changes in the ng2-smart-table node_modules files. Simply removing entry from the package.json
for ng2-smart-table
will be good? Or is there any better way to do that?
You've got 2 choices, I expect you will like the first:
(1) use npm patch-package ... https://www.npmjs.com/package/patch-package
You generate a patch for the package in the form of a diff. The patch is saved in your repo. When you npm install, it downloads the normal package and then patches it every time with the diff during a postinstall - postinstall fires automatically AFTER the npm install is complete.
(2) npm install the module you want to change, cd to the directory within node_modules - make the changes including changing the name in package.json then npm publish (all must be done within relevant dir within node_modules) - you have just published your own version of their package. Use that now instead.
In approach (1) I'm not sure how patch package would deal with updates to the original package. In approach (2) you will never get any more updates to the main package since this is now a totally new package which you have published to npm.