Skip to content

Instantly share code, notes, and snippets.

@monolithed
Last active February 22, 2016 13:16
Show Gist options
  • Save monolithed/c2339628cd3d70a4fcac to your computer and use it in GitHub Desktop.
Save monolithed/c2339628cd3d70a4fcac to your computer and use it in GitHub Desktop.

Please do not put test harnesses or transpilers in your dependencies object

Why so adamantly? In fact, the final product we can build using CI.
And for this reason I can not agree with the fact that grunt, browserify and so on are local dependencies.
The current scheme is relevant only for the server-side development, but not for the client.

Alternative scheme:

git/hooks/pre-push

#!/bin/sh

npm run jslint
npm test

package.json

{
    "scripts": {
        "lint": "jslint '...",
        "test": "mocha  '...",
        "grunt": "grunt"
    },

    "dependencies": {
        "requirejs": "2.1.22"
    },

    "deploymentDependencies": {
        "grunt": "0.4.5",
        "mocha": "2.4.5"
    },

    "devDependencies": {
        "jslint": "0.9.6"
    }
}

Local machine:

npm install
git commit -am '...'
git push origin branch # run pre-push hook

CI

npm install --production --deployment
npm run grunt build:production
npm test
rsync ... # file transfer program

I propose to add something like deploymentDependencies as an alternative for client-side development.

So, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment