@berenddeboer/nx-aws-cdk
Version:
Nx self-inferring plugin for AWS CDK stacks
41 lines • 1.51 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = runExecutor;
const path = require("path");
const executor_util_1 = require("./lib/executor.util");
async function runExecutor(options, context) {
const normalizedOptions = normalizeOptions(options, context);
const result = await runCdk(normalizedOptions, context);
return {
success: result,
};
}
async function runCdk(options, context) {
const command = (0, executor_util_1.createCommand)(options.command, options);
return (0, executor_util_1.runCommandProcess)(command, path.join(context.root, options.root));
}
function normalizeOptions(options, executor_context) {
const { context, ...unknown_properties } = options;
const otherArgs = (0, executor_util_1.parseArgs)(unknown_properties);
delete otherArgs.command;
delete otherArgs.stacks;
// If context values are passed, turn them into the proper object
const context_values = {};
if (context) {
context.forEach((kv) => {
const a = kv.split("=");
context_values[a[0]] = a[1];
});
}
// eslint-disable-next-line no-unsafe-optional-chaining
const { projectName } = executor_context;
const { root, sourceRoot } = executor_context.projectsConfigurations.projects[projectName];
return {
...options,
context: context_values,
otherArgs: otherArgs,
sourceRoot,
root,
};
}
//# sourceMappingURL=executor.js.map
;