Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

NPM

From MoodleDocs

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:

  1. Run $ npm outdated to check for any outdated dependencies
  2. Examine each package change and judge whether the package should be updated
  3. Update the package depdency version number in package.json
  4. Update the package: $ npm update <packagename>
  5. Update the shrinkwrap (please note the --dev!): $ npm shrinkwrap --dev
  6. Commit both the package.json and npm-shrinkwrap.json to git