2

My module has no dependency on its own but for running tests you need to install jasmine-node module. Should I include that module as a dependency?

Mohsen
  • 1,970
  • 3
  • 22
  • 32

2 Answers2

5

Most package management systems have a special way of specifying dependencies that are needed only for the development. Python's setuptools has extras_require, Clojure's leiningen has profiles, and npm has devDependencies: see docs.

fjarri
  • 436
  • 3
  • 7
0

devDependencies is exactly what you are looking for. However, if this is a package that you only occasionally need, you can use something else.

My npm package is install-subset, and can be installed globally with npm install -g install-subset

https://www.npmjs.com/package/install-subset

First, you build whitelists and blacklists for named install subsets in your package.json like this:

"subsets": { "build": { "whitelist": [ "babel-cli", "dotenv" ] }, "test": { "blacklist": [ "eslint", "lint-rules", "prettier" ] } }

Then call it with, for example, install-subset test

This will temporarily rewrite your package.json to not install those packages blacklisted, then restore it, which depending on the packages can save a lot of time and bandwidth.

tabrindle
  • 121
  • 1