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.

43 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runBuilder = void 0; const architect_1 = require("@angular-devkit/architect"); const rxjs_1 = require("rxjs"); const operators_1 = require("rxjs/operators"); const child_process_1 = require("child_process"); const workspace_1 = require("../../utils/workspace"); const path_1 = require("path"); function down(cwd, options, configuration, projectName) { const args = [ 'destroy', '--cwd', cwd, '--stack', `${configuration}-${projectName}` ]; if (options.nonInteractive) { args.push('--non-interactive', '--yes'); } const up = child_process_1.spawnSync(workspace_1.getPulumiBinaryPath(), args, { env: Object.assign(Object.assign({}, process.env), { PULUMI_SKIP_UPDATE_CHECK: '1' }), stdio: 'inherit' }); if (up.error) { return rxjs_1.of({ success: false, error: up.error.message }); } return rxjs_1.of({ success: true }); } function runBuilder(options, context) { var _a; if (!((_a = context === null || context === void 0 ? void 0 : context.target) === null || _a === void 0 ? void 0 : _a.target)) { return rxjs_1.of({ success: false }); } const configuration = context.target.configuration || 'dev'; return rxjs_1.from(context.getTargetOptions(context.target)).pipe(operators_1.switchMap((targetOptions) => { const cwd = path_1.dirname(path_1.resolve(context.workspaceRoot, targetOptions.main)); return down(cwd, options, configuration, context.target.project); })); } exports.runBuilder = runBuilder; exports.default = architect_1.createBuilder(runBuilder); //# sourceMappingURL=builder.js.map