@goldstack/template-lambda-express
Version:
Building blocks for packages deployed as Express.js server on AWS Lambda
56 lines • 2.49 kB
JavaScript
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
const utils_package_1 = require("@goldstack/utils-package");
const utils_cli_1 = require("@goldstack/utils-cli");
const utils_terraform_1 = require("@goldstack/utils-terraform");
const templateLambdaExpressDeploy_1 = require("./templateLambdaExpressDeploy");
const utils_terraform_aws_1 = require("@goldstack/utils-terraform-aws");
const utils_package_config_1 = require("@goldstack/utils-package-config");
__exportStar(require("./types/LambdaExpressPackage"), exports);
const yargs_1 = __importDefault(require("yargs"));
const run = async (args) => {
await (0, utils_cli_1.wrapCli)(async () => {
const argv = await (0, utils_package_1.buildCli)({
yargs: yargs_1.default,
deployCommands: (0, utils_package_1.buildDeployCommands)(),
infraCommands: (0, utils_terraform_1.infraCommands)(),
})
.help()
.parse();
const packageConfig = new utils_package_config_1.PackageConfig({
packagePath: './',
});
const config = packageConfig.getConfig();
const command = argv._[0];
const [, , , ...opArgs] = args;
if (command === 'infra') {
await (0, utils_terraform_aws_1.terraformAwsCli)(opArgs);
return;
}
if (command === 'deploy') {
await (0, templateLambdaExpressDeploy_1.deployCli)(packageConfig.getDeployment(opArgs[0]));
return;
}
throw new Error('Unknown command: ' + command);
});
};
exports.run = run;
//# sourceMappingURL=templateLambdaExpress.js.map
;