UNPKG

@storm-software/pulumi-tools

Version:

Tools for managing Pulumi infrastructure within a Nx workspace.

43 lines (40 loc) 1.33 kB
import { run, withRunExecutor } from "./chunk-NCKIEHQG.mjs"; // src/base/base-executor.ts import { join } from "node:path"; import { which } from "shelljs"; var withPulumiExecutor = (command, argsMapper, executorOptions = {}) => async (_options, context) => { return withRunExecutor( `Pulumi \`${command}\` Command Executor`, async (options, context2, config) => { if (!which("pulumi")) { throw new Error( "Pulumi is not installed. Please install it before running this executor." ); } if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) { throw new Error( "The Build process failed because the context is not valid. Please run this command from a workspace." ); } const { sourceRoot } = context2.projectsConfigurations.projects[context2.projectName]; run( config, ["pulumi", command, ...argsMapper(options)].filter(Boolean).join(" "), join(config.workspaceRoot, options.root || sourceRoot), "inherit", { ...process.env, PULUMI_EXPERIMENTAL: "true" } ); return null; }, executorOptions )(_options, context); }; export { withPulumiExecutor };