@ivoryio/ivory-cli
Version:
24 lines (23 loc) • 1.57 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initAmplify = void 0;
var shelljs_1 = __importDefault(require("shelljs"));
exports.initAmplify = function (_a) {
var projectName = _a.projectName, awsProfile = _a.awsProfile, amplifyAppId = _a.amplifyAppId;
var AMPLIFY = "\"{\\\"projectName\\\":\\\"" + projectName + "\\\",\\\"envName\\\":\\\"master\\\",\\\"defaultEditor\\\":\\\"code\\\"}\"";
var AWS_CLOUD_FORMATION_CONFIG = "{\\\"configLevel\\\":\\\"project\\\",\\\"useProfile\\\":true,\\\"profileName\\\":\\\"" + awsProfile + "\\\"}";
var REACT_CONFIG = "{\\\"SourceDir\\\":\\\"src\\\",\\\"DistributionDir\\\":\\\"build\\\",\\\"BuildCommand\\\":\\\"yarn build\\\",\\\"StartCommand\\\":\\\"yarn start\\\"}";
var FRONTEND = "\"{\\\"frontend\\\":\\\"javascript\\\",\\\"framework\\\":\\\"react\\\",\\\"config\\\":" + REACT_CONFIG + "}\"";
var PROVIDERS = "\"{\\\"awscloudformation\\\":" + AWS_CLOUD_FORMATION_CONFIG + "}\"";
var command = "amplify init --appId " + amplifyAppId + " --amplify " + AMPLIFY + " --frontend " + FRONTEND + " --providers " + PROVIDERS + " --yes";
shelljs_1.default.echo(command);
var result = shelljs_1.default.exec(command);
if (result.code !== 0) {
shelljs_1.default.echo("Error: failed to run amplify init with command");
shelljs_1.default.echo(result.stderr);
shelljs_1.default.exit(result.code);
}
};