@getcoconut/cli
Version:
A tool for locally emulating and mocking Pulumi Cloud projects.
35 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.action = exports.command = void 0;
const tslib_1 = require("tslib");
const commander_1 = require("commander");
const automation_1 = require("@pulumi/pulumi/automation");
const config = require("../config");
const utils_1 = require("../utils");
exports.command = new commander_1.Command('outputs')
.description("write a Pulumi Cloud project's outputs to outputs targets")
.requiredOption('-s, --stack <stack>', 'stack to get outputs from')
.action(action);
function action(options) {
var _a, _b;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const args = {
stackName: options.stack,
workDir: options.projectDir,
};
console.info(`processing outputs of ${options.projectDir}...`);
if (!((_b = (_a = config.get().outputs) === null || _a === void 0 ? void 0 : _a.targets) === null || _b === void 0 ? void 0 : _b.length)) {
console.warn('No outputs targets defined in config!');
return;
}
const stack = yield automation_1.LocalWorkspace.selectStack(args);
const outputs = utils_1.unmarshalOutputs(yield stack.outputs());
// write outputs to configured outputs targets
utils_1.writeOutputs(outputs, options.stack);
// write outputs to console
console.info('\noutputs:');
console.info(JSON.stringify(outputs, null, 4));
});
}
exports.action = action;
//# sourceMappingURL=outputs.js.map