1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | require('source-map-support/register');
|
4 | const altt_function_1 = require("./altt/altt-function");
|
5 | const altt_options_1 = require("./altt/altt-options");
|
6 | const commander = require("commander");
|
7 | const bluebird_1 = require("bluebird");
|
8 | const altt_build_1 = require("./altt/altt-build");
|
9 | let functionNames = [];
|
10 | commander
|
11 | .option('-e', '--environment [environment]', 'Environment')
|
12 | .action(function (name, otherNames) {
|
13 | functionNames.push(name);
|
14 | functionNames.concat(otherNames);
|
15 | })
|
16 | .parse(process.argv);
|
17 | const env = commander.environment;
|
18 | const rootDir = altt_options_1.getRootDir(env);
|
19 | async function functionsRequiringBuild() {
|
20 | const allFunctions = await altt_function_1.getAllFunctions(env, rootDir);
|
21 | return await bluebird_1.Promise.filter(allFunctions, altt_build_1.requiresBuild);
|
22 | }
|
23 | async function main(functionNames) {
|
24 | const rootDir = altt_options_1.getRootDir(env);
|
25 | const functions = functionNames.length > 0
|
26 | ? functionNames.map(name => altt_function_1.alttFunction(name, env, rootDir))
|
27 | : await functionsRequiringBuild();
|
28 | return Promise.all(functions.map(altt_build_1.build));
|
29 | }
|
30 | main(functionNames).catch(err => {
|
31 | console.error(err);
|
32 | process.exit(1);
|
33 | });
|
34 |
|
\ | No newline at end of file |