Opened 3 years ago

Last modified 3 years ago

#5559 closed change

Have ensure_dependencies.py install (production) Node.js dependencies when updating a dependency — at Version 6

Reported by: kzar Assignee:
Priority: P2 Milestone:
Module: Unknown Keywords:
Cc: trev, sebastian, tlucas Blocked By:
Blocking: #5535 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29526588/

Description (last modified by kzar)

Background

We use JSDoc for document generation already, with #5535 we will use webpack for builds too. Unfortunately our dependency management system does not allow for Node.js npm dependencies to be specified and so the user has to manually install them globally instead.

We would like the ensure_dependencies.py script to call npm install --only=production after a dependency is updated which contains a packages.json file. The --only=production argument avoids us installing development dependencies, for example adblockpluscore uses nodeunit for its tests which we don't want ensure_dependencies.py to install.

What to change

  • Change the ensure_dependencies.py script so that it calls npm install --only=production after a dependency is cloned or updated if the dependency contains the packages.json file in its root. The command should be called from the dependency's path.
  • If the SKIP_DEPENDENCY_UPDATES environment variable is set npm install shouldn't be called.
  • If the npm command doesn't exist a warning should be displayed 'Failed to install Node.js dependencies for DEPENDENCY_NAME, please ensure Node.js is installed.'
  • Add a packages.json file with the following contents:
{
  "name": "buildtools",
  "repository": "https://hg.adblockplus.org/buildtools",
  "license": "GPL-3.0",
  "dependencies": {
    "jsdoc": "3.5.4"
  }
}

Change History (6)

comment:1 Changed 3 years ago by kzar

  • Description modified (diff)

comment:2 Changed 3 years ago by kzar

  • Ready set

comment:3 Changed 3 years ago by tlucas

What should happen in case npm is not available?

comment:4 Changed 3 years ago by trev

A warning I guess, same as when hg isn't available for example.

comment:5 Changed 3 years ago by kzar

  • Description modified (diff)

comment:6 Changed 3 years ago by kzar

  • Description modified (diff)
Note: See TracTickets for help on using tickets.