npm patch package | npm version patch #npm #javascript #nodejs

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi friends welcome back to my channel my name is fura and today I'm making changes in the note modules Library you might wonder why it often happens there are some issues in the dependencies that we are using you can go to the node modules make changes but as soon as you run npm installed those changes are gone so today I'm going to create some patches to use it effectively in my code even if I push those changes in GitHub after rerunning and P stall those changes should still be there now the ideal way to do this is of course to create the pull request in that library but U we all know it might take some time for those changes to get Marsh meanwhile we want to still test those changes if you're single developer it's fine you can make changes in the node modules and then test it locally but as soon as you push your changes and gith her those changes are going to be lost I'm using npm but if you're using Yann click on the link above to watch the next video where I am using Yann and and trying to patch the package so I will just give a quick example in my project I'm using react bootstrap carousal and I'm importing carousal so let's say if you have to make some changes inside the carousal you'll go to the library and you see when you click on it it will take you the typescript file and uh then we can go to the node modules with the help of the Explorer view here you can see that on the left side k. JS is also exposed because I'm using npm and here you can see everything directly in the node modules so let's say I'm going to not not make any major change but I'll just add console. log for Simplicity and uh I'm going to log this is my pad change okay I made this change of course if I run it then this should reflect in my window after a quick npm start you see my windows loaded and you can see these changes in the console.log this is my pass change it was in use effects so it will be logged every time there's some change in the C now you know if I run npm install again these changes are of course going to go thing we have to do is install a package in our repository this package is called patch package so as usual NP install patch package once this is installed we are going to add this into a post install script this is installed go back to your package.json and add another script post install and you just have to add the command patch package save it then go back to your carousal file copy the name of this library in my case it's react bootstrap in your case it could be something else go back to your terminal and here we are going to apply that package to create a patch file we'll use npx patch package and then the library name hit enter this will create a temporary folder and we also create the patch for this Library this will look something like this you can also create a issue in that repository with this patch directly from your terminal let's go back to vs score here you see a new folder will be created called patches and when you open it there will be a new patch which is created with your latest changes here you can see one of my change is created over here and this looks good this is going to stay even if after you run npm install to confirm this let's go back and run npm install once again let's reconfirm this batch is going to be there we have this Library we go to the note modules and open the Explorer view go to cara. JS and you see that my log statement is still there similarly if you make any other change it is still going to be there after you rerun the npm stall or if you push it to your GitHub that's it for this video thanks for watching and don't forget to subscribe to my channel
Info
Channel: Poorva
Views: 31
Rating: undefined out of 5
Keywords: npm patch package, npm version patch, node js patch, node js patch request example, how to make changes in node modules, node-modules, node-modules library changes, patch package, patch package npm, patch-package, persist node modules changes, changes in node modules, changes in dependencies, library fixes, library fixes npm, patching packages, npm patching
Id: didQHkXtZ7o
Channel Id: undefined
Length: 4min 27sec (267 seconds)
Published: Thu Mar 21 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.