Created
April 12, 2019 00:39
-
-
Save andreybleme/fad17189e1843aee05e873e014717cfe to your computer and use it in GitHub Desktop.
andreybleme.com | Criando uma CLI para fazer deploy de sites estáticos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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