{"action":"created","issue":{"url":"https://api.github.com/repos/npm/npm/issues/9674","labels_url":"https://api.github.com/repos/npm/npm/issues/9674/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/9674/comments","events_url":"https://api.github.com/repos/npm/npm/issues/9674/events","html_url":"https://github.com/npm/npm/issues/9674","id":107334506,"number":9674,"title":"Any way to separate production from dev dependencies in node_modules in npm 3?","user":{"login":"mhart","id":367936,"avatar_url":"https://avatars.githubusercontent.com/u/367936?v=3","gravatar_id":"","url":"https://api.github.com/users/mhart","html_url":"https://github.com/mhart","followers_url":"https://api.github.com/users/mhart/followers","following_url":"https://api.github.com/users/mhart/following{/other_user}","gists_url":"https://api.github.com/users/mhart/gists{/gist_id}","starred_url":"https://api.github.com/users/mhart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhart/subscriptions","organizations_url":"https://api.github.com/users/mhart/orgs","repos_url":"https://api.github.com/users/mhart/repos","events_url":"https://api.github.com/users/mhart/events{/privacy}","received_events_url":"https://api.github.com/users/mhart/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-19T13:51:20Z","updated_at":"2015-09-19T13:59:51Z","closed_at":null,"body":"We currently check in our production dependencies to git (which allows us to git checkout a full working version of our app on our production machines), and we don't check in our dev dependencies.\r\n\r\nUntil npm@3 we've been able to specify our dev dependency directories in our `.gitignore`:\r\n\r\n```\r\nnode_modules/**/.bin\r\nnode_modules/browserify\r\nnode_modules/watchify\r\n```\r\n\r\nThere's a duplication here with what's listed package.json and ideally there'd be a single line we could ignore (eg `node_modules_dev` or something), but up until npm@3 it wasn't too bad.\r\n\r\nThe issue under npm@3 is we have literally hundreds of packages at the top level that need to be ignored – and worse, I worry that we may ignore some only to have them needed for a production dependency down the track.\r\n\r\n```\r\nnode_modules/**/.bin\r\nnode_modules/browserify\r\nnode_modules/watchify\r\nnode_modules/acorn\r\nnode_modules/ansi-green\r\nnode_modules/ansi-wrap\r\nnode_modules/anymatch\r\nnode_modules/arr-diff\r\nnode_modules/arr-flatten\r\nnode_modules/array-filter\r\nnode_modules/array-map\r\nnode_modules/array-reduce\r\nnode_modules/array-slice\r\nnode_modules/array-unique\r\nnode_modules/arrify\r\nnode_modules/asn1.js\r\nnode_modules/assert\r\nnode_modules/astw\r\nnode_modules/async-each\r\nnode_modules/balanced-match\r\nnode_modules/base64-js\r\nnode_modules/binary-extensions\r\nnode_modules/bn.js\r\nnode_modules/brace-expansion\r\nnode_modules/braces\r\nnode_modules/brorand\r\nnode_modules/browser-pack\r\nnode_modules/browser-resolve\r\nnode_modules/browserify-aes\r\nnode_modules/browserify-rsa\r\nnode_modules/browserify-sign\r\nnode_modules/browserify-transform-tools\r\nnode_modules/browserify-zlib\r\nnode_modules/buffer-xor\r\nnode_modules/buffer\r\nnode_modules/builtin-status-codes\r\nnode_modules/builtins\r\n```\r\nEtc...\r\n\r\nIs there anything we can do about this? Any npm command that I might be missing that will help us out? Any way to separate production from dev dependencies?"},"comment":{"url":"https://api.github.com/repos/npm/npm/issues/comments/141671007","html_url":"https://github.com/npm/npm/issues/9674#issuecomment-141671007","issue_url":"https://api.github.com/repos/npm/npm/issues/9674","id":141671007,"user":{"login":"mhart","id":367936,"avatar_url":"https://avatars.githubusercontent.com/u/367936?v=3","gravatar_id":"","url":"https://api.github.com/users/mhart","html_url":"https://github.com/mhart","followers_url":"https://api.github.com/users/mhart/followers","following_url":"https://api.github.com/users/mhart/following{/other_user}","gists_url":"https://api.github.com/users/mhart/gists{/gist_id}","starred_url":"https://api.github.com/users/mhart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhart/subscriptions","organizations_url":"https://api.github.com/users/mhart/orgs","repos_url":"https://api.github.com/users/mhart/repos","events_url":"https://api.github.com/users/mhart/events{/privacy}","received_events_url":"https://api.github.com/users/mhart/received_events","type":"User","site_admin":false},"created_at":"2015-09-19T13:59:51Z","updated_at":"2015-09-19T13:59:51Z","body":"Just realised we're going to run into the same issue with our `.dockerignore` files – so even if we stop checking in deps to git and move to `npm shrinkwrap`, our Docker images are still going to explode in size because we can't specify which directories to ignore when building (well, not easily anyway)"}}