-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·23 lines (19 loc) · 1014 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env node
'use strict'
const program = require('commander')
const { local } = require('./index')
function commaSeparatedList(value, dummyPrevious) {
return value.split(',');
}
program
.command('local <bucket>')
.option('-s, --source <directory>', 'Source location', process.env.PWD)
.option('-l, --layer', 'Source tree is a Lambda layer. Package the tree as-is. ' +
'Do not install it as an npm package. A package.json is required but only for the name and version.')
.option('--script-install <packages>', 'Run "npm install --only=prod" on the comma-delimited list of ' +
'packages, which runs scripts in their package.json. All scripts in all other packages are ignored.', commaSeparatedList)
.option('--always-upload', 'Always upload files even if they already exist on S3.')
.action(async (bucket, { source, layer, scriptInstall, alwaysUpload }) => {
process.stdout.write(await local(bucket, source, layer, scriptInstall, alwaysUpload))
})
program.parse(process.argv)