jeromegn/Backbone.localStorage — pull request #160 by eush77 (2014-11-23 19:00:18+00:00)
Title: Optimize dependencies

I changed a few lines in `package.json`. The text below explains why.

---

Existing problems:

- `mocha-phantomjs` listed in both dependencies and devDependencies;

```
$ npm install
npm WARN package.json Dependency 'mocha-phantomjs' exists in both dependencies and devDependencies, using 'mocha-phantomjs@^3.5.1' from dependencies
```

- `phantomjs` and `mocha-phantomjs` are listed as dependencies, which they aren't (you don't need them in order to use the module), but loading of `phantomjs` takes quite **a lot** of time;

```
$ time -f%e npm i backbone.localstorage
134.86
```

- moreover, `phantomjs` is not even used directly, and it is a peerDependency of `mocha-phantomjs`, which means that you don't need to take care of it explicitly, npm will install the proper version automatically;

- `backbone.localstorage` is a plugin to `Backbone`, not really useful in and of itself, so it makes more sense to list `Backbone` as a peerDependency.

In some cases you might end up with two separate backbones!

```
$ npm i backbone.localstorage
$ npm i backbone
$ npm ls --depth=1
/tmp/bls1
├─┬ backbone@1.1.2
│ └── underscore@1.7.0
└─┬ backbone.localstorage@1.1.14
├── backbone@1.1.2
├── mocha-phantomjs@3.5.1
└── phantomjs@1.9.12
```

I made `mocha-phantomjs` a devDependency, removed `phantomjs` and turned `backbone` into a peerDependency.

```
$ npm i /path/to/local/backbone.localstorage
$ npm ls --depth=1
/tmp/bls2
├─┬ backbone@1.1.2
│ └── underscore@1.7.0
└── backbone.localstorage@1.1.14
```

Timewise:

```
$ time -f%e npm i /path/to/local/backbone.localstorage
1.93
```

2 minutes down to 2 seconds, now we're talking!