forked from allevo/packages-condom
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (34 loc) · 965 Bytes
/
Copy pathindex.js
File metadata and controls
41 lines (34 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env node
'use strict'
var fs = require('fs')
var path = require('path')
var argv = require('minimist')(process.argv.slice(2), {
boolean: ['only-dependency', 'no-dependency', 'peer-dependency', 'no-optional-dependency']
})
var basePath = argv._.pop() + ''
if (!fs.lstatSync(basePath).isDirectory()) {
throw new Error('First params should be a directory path')
}
var condom = require('./condom')
var globOptions = {
cwd: basePath
}
var options = {
globOptions: globOptions,
packageJson: require(path.resolve(path.join(basePath, 'package.json'))),
dependencies: true,
peerDependencies: false,
optionalDependencies: true
}
if (argv['no-dependency']) {
options.dependencies = false
}
if (argv['peer-dependency']) {
options.peerDependencies = false
}
if (argv['no-optional-dependency']) {
options.optionalDependencies = false
}
var stream = condom(options)
var output = require('./output')
output(stream, require('stdout-stream'))