UNPKG

@dev-thought/nx-deploy-it

Version:

[![npm version](https://badge.fury.io/js/%40dev-thought%2Fnx-deploy-it.svg)](https://www.npmjs.com/package/@dev-thought/nx-deploy-it) [![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg?color=blue&style=flat-square)](http://opensource.

53 lines 2.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const schematics_1 = require("@angular-devkit/schematics"); const workspace_1 = require("@nrwl/workspace"); const workspace_2 = require("../../utils/workspace"); const enquirer_1 = require("enquirer"); const questions_1 = require("../../utils/questions"); const provider_1 = require("../../utils/provider"); function default_1() { return (host, context) => tslib_1.__awaiter(this, void 0, void 0, function* () { const workspace = yield workspace_1.getWorkspace(host); const applications = workspace_2.getApplications(workspace, host); const questions = []; if (applications.length === 0) { context.logger.log('info', 'no applications found'); return schematics_1.chain([]); } context.logger.log('info', `We found ${applications.length} supported applications.`); const choosenApplications = yield enquirer_1.prompt(Object.assign(Object.assign({}, questions_1.QUESTIONS.setupApplications), { choices: applications.map((app) => ({ name: `${app.projectName} (${app.applicationType})`, value: app, })), result: function (result) { return Object.values(this.map(result)); } })); if (choosenApplications.setupApplications.length === 0) { context.logger.log('info', 'No applications selected. Skipping setup'); return schematics_1.chain([]); } const { provider } = yield enquirer_1.prompt([ questions_1.QUESTIONS.whichProvider, ]); switch (provider) { case provider_1.PROVIDER.AWS: questions.push(questions_1.QUESTIONS.awsProfile, questions_1.QUESTIONS.awsRegion); break; case provider_1.PROVIDER.AZURE: questions.push(questions_1.QUESTIONS.azureLocation); break; case provider_1.PROVIDER.GOOGLE_CLOUD_PLATFORM: questions.push(questions_1.QUESTIONS.gcpProjectId); break; default: break; } const options = yield enquirer_1.prompt(questions); return schematics_1.chain(choosenApplications.setupApplications.map((application) => { return schematics_1.externalSchematic('@dev-thought/nx-deploy-it', 'init', Object.assign(Object.assign({}, options), { provider, project: application.projectName })); })); }); } exports.default = default_1; //# sourceMappingURL=schematic.js.map