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.

64 lines 3.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDistributionPath = exports.getProjectConfig = exports.getApplications = exports.getAdapter = exports.getAdapterByApplicationType = exports.getPulumiBinaryPath = exports.getRealWorkspacePath = void 0; const path_1 = require("path"); const application_type_1 = require("./application-type"); const webapp_adapter_1 = require("../adapter/webapp/webapp.adapter"); const nestjs_adapter_1 = require("../adapter/nestjs/nestjs.adapter"); const express_adapter_1 = require("../adapter/express/express.adapter"); const angular_universal_adapter_1 = require("../adapter/angular-universal/angular-universal.adapter"); const workspace_1 = require("@nrwl/workspace"); function getRealWorkspacePath() { // TODO!: find a better way return process.cwd(); } exports.getRealWorkspacePath = getRealWorkspacePath; function getPulumiBinaryPath() { return path_1.resolve(getRealWorkspacePath(), 'node_modules/.bin/pulumi'); } exports.getPulumiBinaryPath = getPulumiBinaryPath; function getAdapterByApplicationType(applicationType, project, options) { switch (applicationType) { case application_type_1.ApplicationType.ANGULAR: case application_type_1.ApplicationType.REACT: return new webapp_adapter_1.WebappAdapter(project, options, applicationType); case application_type_1.ApplicationType.NESTJS: return new nestjs_adapter_1.NestJSAdapter(project, options, applicationType); case application_type_1.ApplicationType.EXPRESS: return new express_adapter_1.ExpressAdapter(project, options, applicationType); case application_type_1.ApplicationType.ANGULAR_UNIVERSAL: return new angular_universal_adapter_1.AngularUniversalAdapter(project, options, applicationType); default: } throw new Error(`Can't recognize application type. Supported list can be found here: https://github.com/Dev-Thought/nx-plugins/libs/nx-deploy-it`); } exports.getAdapterByApplicationType = getAdapterByApplicationType; function getAdapter(project, options, host) { return getAdapterByApplicationType(application_type_1.getApplicationType(project.targets, host), project, options); } exports.getAdapter = getAdapter; function getApplications(workspace, host) { const applications = []; workspace.projects.forEach((project, projectName) => { const applicationType = application_type_1.getApplicationType(project.targets, host); if (applicationType) { applications.push({ projectName, applicationType, }); } }); return applications; } exports.getApplications = getApplications; function getProjectConfig(context) { const workspaceConfig = workspace_1.readWorkspaceConfig({ format: 'angularCli' }); return workspaceConfig.projects[context.target.project]; } exports.getProjectConfig = getProjectConfig; function getDistributionPath(context) { const project = getProjectConfig(context); return path_1.resolve(context.workspaceRoot, project.architect.build.options.outputPath); } exports.getDistributionPath = getDistributionPath; //# sourceMappingURL=workspace.js.map