NPM
Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.
NPM is a package manager for JavaScript. It is used by Moodle developers to install a number of cli tools, primarily those related with Grunt.
npm dependency management
Tools installed by npm include things like our css/js compressors, post-processors and integrity checks. As differences in output from these tools would cause different results for different developers working on the same code, we need to ensure installed packages are the same.
npm shrinkwrap
We use npm shrinkwrap to ensure that all versions of packages are consistent for developers when they run npm install
Updating npm dependencies
Periodically we will update our npm dependencies, the process for doing this is:
- Run
$ npm outdated
to check for any outdated dependencies - Examine each package change and judge whether the package should be updated
- Update the package depdency version number in package.json
- Update the package:
$ npm update <packagename>
- Update the shrinkwrap (please note the --dev!):
$ npm shrinkwrap --dev