Skip to content

Instantly share code, notes, and snippets.

@andreybleme
Created April 12, 2019 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreybleme/fad17189e1843aee05e873e014717cfe to your computer and use it in GitHub Desktop.
Save andreybleme/fad17189e1843aee05e873e014717cfe to your computer and use it in GitHub Desktop.
andreybleme.com | Criando uma CLI para fazer deploy de sites estáticos
let ignored = []
program
.command('deploy')
.option('-b, --bucket <s>', 'Bucket name', setBucket)
.option('-k, --key <s>', 'AWS Key', setKey)
.option('-s, --secret <s>', 'AWS Secret', setSecret)
.option('-e, --ignore <items>', 'Ignore files', setIgnore)
.action(function () {
s3Services.setAwsCredentials(awsCredentials)
filesystem.getAllFilesFrom(rootFolder, function (filePath, data) {
if(!ignored.includes(filePath)) {
s3Services.uploadObject(bucketParams.Bucket, filePath, data)
}
})
})
function setIgnore(val) {
ignored = val.split(',')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment