NPM and peer dependencies

Nov 17, 2015  

While working on the mai-chai module I realized that I should be using peerDependencies.

The mai-chain module expects that its consumer installs chai, but it does not really depend on it. This package.json excerpt:

"devDependencies": {
},
"dependencies": {
  "chai": "^3.4.1",
  "chai-equal-jsx": "^1.0.2",
  "chai-spies": "^0.7.1",
  "chai-string": "^1.1.3",
  "dirty-chai": "^1.2.2"
}

has to be replaced with the following:

"devDependencies": {
},
"dependencies": {
  "chai-equal-jsx": "^1.0.2",
  "chai-spies": "^0.7.1",
  "chai-string": "^1.1.3",
  "dirty-chai": "^1.2.2"
},
"peerDependencies": {
  "chai": "^3.4.1"
}

Note that the reference to chai was moved from dependencies to peerDependencies.