nx-serverless-cdk
Version:
nx-serverless-cdk is an Nx plugin for creating AWS CDK applications and libraries inside an Nx monorepo. It offers the possibility to test and debug CDK applications as well as AWS Lambda functions locally. The plugin provides the full flexibility of the
30 lines • 1.19 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.executeCommand = void 0;
const devkit_1 = require("@nx/devkit");
const node_child_process_1 = require("node:child_process");
const is_windows_1 = require("./is-windows");
const executeCommand = (command, args, options) => {
return new Promise((resolve, reject) => {
const { cwd } = options;
const normalizedArgs = args.map((arg) => (0, is_windows_1.isWindows)() ? `"${arg}"` : `'${arg}'`);
devkit_1.logger.log('Executing command:', command, normalizedArgs.join(' '));
const commandProcess = (0, node_child_process_1.spawn)(command, normalizedArgs, {
cwd,
shell: true,
stdio: 'inherit',
});
commandProcess.on('close', (code) => {
if (code !== 0) {
reject(new Error(`Command process exited with error code '${code?.toString()}'.`));
return;
}
resolve();
});
commandProcess.on('error', (error) => {
reject(error);
});
});
};
exports.executeCommand = executeCommand;
//# sourceMappingURL=execute-command.js.map
;