Skip to content

Commit

Permalink
feat(prod): allow for prod dependencies install
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Mar 31, 2017
1 parent 268a183 commit 1c6d1b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path')
const assert = require('assert')

module.exports = function (cwd, group) {
group = group || 'prod'
let pkg = {}

// exit early
Expand All @@ -17,7 +18,7 @@ module.exports = function (cwd, group) {
}

// set suffix
group = group + 'Dependencies'
group = ~['prod', 'production'].indexOf(group) ? 'dependencies' : group + 'Dependencies'

// exit early
assert(pkg[group], 'no matching dependencies')
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"abc": "1.2"
"abc": "1.2.3"
},

"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ tap.test('should return an empty result', (assert) => {

assert.same(packages, [])
})

tap.test('should allow for "prod" install', (assert) => {
assert.plan(1)

const packages = list(fixture, 'prod')

assert.same(packages, ['[email protected]'])
})

0 comments on commit 1c6d1b3

Please sign in to comment.