Note:

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

NPM

From MoodleDocs
Revision as of 09:23, 31 May 2017 by Dan Poltawski (talk | contribs) (Updated npm section for npm version 5 changes (much simpler))

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. Ensure you use npm >= 5 - node version 8 (see MDL-59094 for details of why we require this version)
  2. Run
    npm install packages-name@version
    (e.g.
    npm install eslint@3.8.0
    )
  3. Verify that both the package.json and npm-shrinkwrap.json have been updated
  4. Commit to source control