automated-deployment-aws
Version:
Library that automates the deployment of the current project into aws machine
62 lines (52 loc) • 1.7 kB
JavaScript
const chalk = require('chalk')
const config = require('./src/config.js')
const zip = require('./src/zipper.js')
const yargs = require('yargs')
const shellScript = require('./src/shellScript.js')
var fs = require("fs");
yargs.command({
command: 'config',
describe: 'Add a new note',
builder: {
pemKeyPath: {
describe: 'pem key path',
demandOption: true,
type: 'string'
},
// zipFilePath: {
// describe: 'Zip file path of your application',
// demandOption: true,
// type: 'string'
// },
userName: {
describe: 'AWS user name',
demandOption: true,
type: 'string'
},
awsIP: {
describe: 'AWS IP address',
demandOption: true,
type: 'string'
},
awsFilePath: {
describe: 'File path of your AWS',
demandOption: true,
type: 'string'
}
},
handler(argv) {
const configData = config.getConfigValue(argv)
console.log(configData)
if(!config.isDirectoryExist(configData.zipFilePath)){
console.log(chalk.red.inverse("Directory path not exists please check config.js file"))
return
}
zip.createZipFile(configData.zipFilePath).then((result)=>{
console.log(chalk.green.inverse('Zip File Created'))
shellScript.executeUploadingInAWS(configData)
}).catch((error)=>{
console.log(chalk.red.inverse(error))
})
}
})
yargs.parse()