Throughout the last few months, I’ve began helping out the Cordova team with a few bug fixes that I come across and want to contribute back.
Cordova is a host of different components, many of which rely on node.js modules from npm.
When I first started wantint go help, I didnt know how to make changes to the cordova code to use globally, and I didnt want to just go modify the code in the global node_modules/cordova-cli folder. This post covers on how to get started modifying existing node modules you may use from npm.
Recently, I came across a small bug in Cordova CLI 3.4. To begin to poke around the code to find a fix in the cordova-cli project.
When I first started, I had to figure out how to get access to the verion pulled from the repo on Github to use my code instead of the globally installed cordova.
How I use npm-link
- Uninstalled the currently used cordova cli,
npm uninstall -g cordova
- Forked the cordova-cli repo from github
git clone firstname.lastname@example.org:jbavari/cordova-cli.git
- Changed directory to the repo I just cloned
After running npm link, I can now run
cordova create HelloWorld from any directory, and it will use the code that I just
Now, when I make changes to that repo that I cloned on my machine, I can run it immediately instead of having to push or update the package in npm.
Hope this helps others in trying to get started contributing to any projects that they might use from npm! (Or contributing to the Cordova project!)