mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-29 03:26:25 -04:00
59 lines
1.5 KiB
JavaScript
Executable File
59 lines
1.5 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
if (~process.argv.indexOf('--debug')) {
|
|
process.env.DEBUG = 'pnpm:*'
|
|
process.argv.push('--quiet')
|
|
}
|
|
|
|
var installCmd = require('../lib/cmd/install')
|
|
|
|
function run (argv) {
|
|
const cli = require('meow')({
|
|
argv: argv,
|
|
help: [
|
|
'Usage:',
|
|
' $ pnpm install',
|
|
' $ pnpm install <name>',
|
|
'',
|
|
'Options:',
|
|
' -S, --save save into package.json under dependencies',
|
|
' -D, --save-dev save into package.json under devDependencies',
|
|
' -O, --save-optional save into package.json under optionalDependencies',
|
|
' -E, --save-exact save exact spec',
|
|
'',
|
|
' --dry-run simulate',
|
|
' -g, --global install globally',
|
|
'',
|
|
' --production don\'t install devDependencies',
|
|
' --quiet don\'t print progress'
|
|
].join('\n')
|
|
}, {
|
|
boolean: [
|
|
'save-dev', 'save', 'save-exact', 'save-optional', 'dry-run', 'global', 'quiet', 'debug'
|
|
],
|
|
alias: {
|
|
'no-progress': 'quiet',
|
|
D: 'save-dev',
|
|
S: 'save',
|
|
E: 'save-exact',
|
|
O: 'save-optional',
|
|
g: 'global'
|
|
}
|
|
})
|
|
|
|
if (cli.flags.debug) {
|
|
cli.flags.quiet = true
|
|
}
|
|
|
|
['dryRun', 'global', 'production'].forEach(function (flag) {
|
|
if (cli.flags[flag]) {
|
|
console.error("Error: '" + flag + "' is not supported yet, sorry!")
|
|
process.exit(1)
|
|
}
|
|
})
|
|
|
|
return installCmd(cli.input, cli.flags).catch(require('../lib/err'))
|
|
}
|
|
|
|
module.exports = run
|
|
if (!module.parent) run(process.argv.slice(2))
|