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?

asked Sep 15, 2013 at 0:00

2 Answers 2

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.

answered Sep 15, 2013 at 1:28
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.

answered Aug 21, 2017 at 20:38

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.