-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
executable file
·32 lines (25 loc) · 910 Bytes
/
index.js
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
#!/usr/bin/env node
'use strict'
const path = require('path')
const cli = require('commander')
const install = require('./src/install')
cli
.command('install <input_strings...>')
.alias('i')
.option('-d, --clean', 'Remove node_modules first.')
.option('--npm', 'Use npm to install.')
.option('-a, --all', 'Prune dependencies as well as devDependencies.')
.description('Install a given subset or multiple subsets defined in package.json.')
.action(install)
cli.command('config').action(() => {
const config = require('./src/config')
const subsets = require(process.cwd() + '/package.json').subsets || config() || {}
console.log(subsets)
})
cli.command('*').action(() => cli.help())
cli.version(require('./package.json').version).parse(process.argv)
if (cli.args.length === 0) cli.help()
process.on('uncaughtException', (err) => {
console.error('ERROR: ' + err)
process.exit(1)
})