"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chalk = require("chalk");
const utils_1 = require("./utils");
function build(args) {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        const { minimistOptionsToArray } = yield Promise.resolve().then(function () { return require('../utils/command'); });
        const appScriptsArgs = minimistOptionsToArray(args.options, { useEquals: false, ignoreFalse: true, allowCamelCase: true });
        process.argv = ['node', 'appscripts'].concat(appScriptsArgs);
        const AppScripts = yield utils_1.importAppScripts(args.env);
        const context = AppScripts.generateContext();
        console.log(`Running app-scripts build: ${chalk.bold(appScriptsArgs.join(' '))}\n`);
        return yield AppScripts.build(context);
    });
}
exports.build = build;
