@wolsok/nx-aws-cdk-v2 4.2.8 → 4.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -25
- package/README.md +6 -0
- package/package.json +1 -1
- package/src/executors/bootstrap/schema.json +1 -0
- package/src/executors/deploy/schema.json +1 -0
- package/src/executors/destroy/schema.json +1 -0
- package/src/executors/synth/schema.json +1 -0
- package/src/utils/executor.util.d.ts +6 -1
- package/src/utils/executor.util.js +41 -32
- package/src/utils/executor.util.js.map +1 -1
package/LICENSE
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
Scope
|
|
2
|
-
|
|
3
|
-
The MIT License below covers this repository except the following
|
|
4
|
-
directories, each of which holds its own proprietary LICENSE (all rights
|
|
5
|
-
reserved, use only with the owner's written permission) for every version
|
|
6
|
-
released after that LICENSE was added; earlier versions stay under MIT:
|
|
7
|
-
|
|
8
|
-
- apps/rollapolla-analog
|
|
9
|
-
- apps/korbjaeger
|
|
10
|
-
- apps/korbjaeger-functions
|
|
11
|
-
- apps/korbjaeger-cdk
|
|
12
|
-
- libs/features/basketball-data
|
|
13
|
-
- libs/features/korbjaeger-account
|
|
14
|
-
- libs/features/korbjaeger-answers
|
|
15
|
-
- libs/features/korbjaeger-selection
|
|
16
|
-
- tools/korbjaeger
|
|
17
|
-
|
|
18
|
-
The root files firebase.rollapolla-analog.json (RollaPolla) and
|
|
19
|
-
firebase.korbjaeger.json (Korbjäger) fall under the proprietary LICENSE of
|
|
20
|
-
their app.
|
|
21
|
-
|
|
22
|
-
Third-party code keeps its own licence and notices.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
1
|
MIT License
|
|
27
2
|
|
|
28
3
|
Copyright (c) 2022 Wolfram Sokollek
|
package/README.md
CHANGED
|
@@ -244,6 +244,12 @@ All four executors build the same shape of command and run it **from the workspa
|
|
|
244
244
|
|
|
245
245
|
Run any target with `--verbose` to see the exact command that is executed.
|
|
246
246
|
|
|
247
|
+
`cdk` runs in a shell that shares the task's stdin, stdout and stderr: it answers its own prompts
|
|
248
|
+
(`--require-approval`) from the terminal, and its output goes wherever the task's does. When Nx
|
|
249
|
+
stops a task (Ctrl-C, a cancelled CI job), it ends the task's whole process tree, `cdk` included. A
|
|
250
|
+
`SIGTERM` sent to the executor process alone is passed on to the command's shell; once that has
|
|
251
|
+
exited, the executor ends by the same signal rather than as a failed task.
|
|
252
|
+
|
|
247
253
|
## Upgrading
|
|
248
254
|
|
|
249
255
|
Update the plugin with `nx migrate`, so its migrations run on your workspace:
|
package/package.json
CHANGED
|
@@ -13,8 +13,13 @@ export declare function resolveProjectPaths(context: ExecutorContext): {
|
|
|
13
13
|
root: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const executorPropKeys: string[];
|
|
16
|
-
export declare const LARGE_BUFFER: number;
|
|
17
16
|
export declare function generateCommandString(command: string, appPath: string): string;
|
|
18
17
|
export declare function parseArgs(options: DeployExecutorSchema | BootstrapExecutorSchema | SynthExecutorSchema): Record<string, string | string[]>;
|
|
19
18
|
export declare function createCommand(command: string, options: ParsedExecutorInterface): string;
|
|
19
|
+
/**
|
|
20
|
+
* Runs the command in a shell that shares the task's stdin, stdout and stderr,
|
|
21
|
+
* so cdk reads its prompts' answers from the terminal itself and its output
|
|
22
|
+
* lands wherever the task's does. Resolves whether the command exited with 0,
|
|
23
|
+
* and never after a SIGTERM it passed on: the re-raised signal ends the task.
|
|
24
|
+
*/
|
|
20
25
|
export declare function runCommandProcess(command: string, cwd: string): Promise<boolean>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.executorPropKeys = void 0;
|
|
4
4
|
exports.resolveProjectPaths = resolveProjectPaths;
|
|
5
5
|
exports.generateCommandString = generateCommandString;
|
|
6
6
|
exports.parseArgs = parseArgs;
|
|
@@ -25,7 +25,6 @@ function resolveProjectPaths(context) {
|
|
|
25
25
|
return { sourceRoot: project.sourceRoot ?? project.root, root: project.root };
|
|
26
26
|
}
|
|
27
27
|
exports.executorPropKeys = ['stacks'];
|
|
28
|
-
exports.LARGE_BUFFER = 1024 * 1000000;
|
|
29
28
|
/**
|
|
30
29
|
* Root of the Nx workspace the executor runs in. Nx sets `NX_WORKSPACE_ROOT`
|
|
31
30
|
* for every task it spawns; the devkit's `workspaceRoot` is the fallback for
|
|
@@ -83,52 +82,62 @@ function createCommand(command, options) {
|
|
|
83
82
|
}
|
|
84
83
|
return commands.join(' ');
|
|
85
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Runs the command in a shell that shares the task's stdin, stdout and stderr,
|
|
87
|
+
* so cdk reads its prompts' answers from the terminal itself and its output
|
|
88
|
+
* lands wherever the task's does. Resolves whether the command exited with 0,
|
|
89
|
+
* and never after a SIGTERM it passed on: the re-raised signal ends the task.
|
|
90
|
+
*/
|
|
86
91
|
function runCommandProcess(command, cwd) {
|
|
87
92
|
return new Promise((resolve) => {
|
|
88
93
|
devkit_1.logger.debug(`Executing command: ${command}`);
|
|
89
|
-
const childProcess = (0, child_process_1.
|
|
90
|
-
|
|
94
|
+
const childProcess = (0, child_process_1.spawn)(command, {
|
|
95
|
+
shell: true,
|
|
96
|
+
stdio: 'inherit',
|
|
97
|
+
cwd,
|
|
91
98
|
env: process.env,
|
|
92
|
-
cwd: cwd,
|
|
93
|
-
});
|
|
94
|
-
const unbindFromParentProcess = bindToParentProcess(childProcess);
|
|
95
|
-
childProcess.stdout?.on('data', (data) => {
|
|
96
|
-
process.stdout.write(data);
|
|
97
99
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
const forwardedSigterm = bindToParentProcess(childProcess);
|
|
101
|
+
// A spawn that fails (a missing cwd or shell) emits `error`, and maybe
|
|
102
|
+
// no `close`: without this listener the error would crash the task.
|
|
103
|
+
childProcess.on('error', (error) => {
|
|
104
|
+
devkit_1.logger.error(`Could not run the command: ${error.message}`);
|
|
105
|
+
resolve(false);
|
|
100
106
|
});
|
|
101
107
|
childProcess.on('close', (code) => {
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
if (!forwardedSigterm()) {
|
|
109
|
+
resolve(code === 0);
|
|
110
|
+
}
|
|
104
111
|
});
|
|
105
112
|
});
|
|
106
113
|
}
|
|
107
114
|
/**
|
|
108
|
-
* Ties the child to the parent process
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
115
|
+
* Ties the child to the parent process until the child closes or fails to
|
|
116
|
+
* spawn: the child is killed when the parent exits, and a SIGTERM to the
|
|
117
|
+
* parent is passed on to it. Once a child that got the signal has closed, the
|
|
118
|
+
* parent's own SIGTERM is raised again, so Node's default ends the parent as
|
|
119
|
+
* terminated rather than as a failed task. Returns whether that happened.
|
|
113
120
|
*/
|
|
114
121
|
function bindToParentProcess(childProcess) {
|
|
122
|
+
let forwardedSigterm = false;
|
|
115
123
|
const killChild = () => childProcess.kill();
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
childProcess.
|
|
124
|
+
const forwardSigterm = () => {
|
|
125
|
+
forwardedSigterm = true;
|
|
126
|
+
childProcess.kill('SIGTERM');
|
|
119
127
|
};
|
|
120
|
-
|
|
121
|
-
process.on('SIGTERM', killChild);
|
|
122
|
-
// Resumed explicitly: a stream paused by an earlier run's cleanup stays
|
|
123
|
-
// paused when a `data` listener is added.
|
|
124
|
-
process.stdin.on('data', forwardStdin).resume();
|
|
125
|
-
return () => {
|
|
128
|
+
const unbind = () => {
|
|
126
129
|
process.removeListener('exit', killChild);
|
|
127
|
-
process.removeListener('SIGTERM',
|
|
128
|
-
process.stdin.removeListener('data', forwardStdin);
|
|
129
|
-
if (process.stdin.listenerCount('data') === 0) {
|
|
130
|
-
process.stdin.pause();
|
|
131
|
-
}
|
|
130
|
+
process.removeListener('SIGTERM', forwardSigterm);
|
|
132
131
|
};
|
|
132
|
+
process.on('exit', killChild);
|
|
133
|
+
process.on('SIGTERM', forwardSigterm);
|
|
134
|
+
childProcess.once('error', unbind);
|
|
135
|
+
childProcess.once('close', () => {
|
|
136
|
+
unbind();
|
|
137
|
+
if (forwardedSigterm) {
|
|
138
|
+
process.kill(process.pid, 'SIGTERM');
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
return () => forwardedSigterm;
|
|
133
142
|
}
|
|
134
143
|
//# sourceMappingURL=executor.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.util.js","sourceRoot":"","sources":["../../../../../../libs/public/nx-aws-cdk-v2/src/utils/executor.util.ts"],"names":[],"mappings":";;;AAmBA,kDAiBC;
|
|
1
|
+
{"version":3,"file":"executor.util.js","sourceRoot":"","sources":["../../../../../../libs/public/nx-aws-cdk-v2/src/utils/executor.util.ts"],"names":[],"mappings":";;;AAmBA,kDAiBC;AAcD,sDAgBC;AAED,8BAaC;AAED,sCA+BC;AAQD,8CA2BC;;AArJD,iDAAyD;AAIzD,uCAKoB;AAGpB,wDAAkC;AAElC;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,OAAwB;IAI1D,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW;QACjC,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,iDACE,OAAO,CAAC,WAAW,IAAI,mBACzB,IAAI,CACL,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;AAChF,CAAC;AAEY,QAAA,gBAAgB,GAAG,CAAC,QAAQ,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,SAAS,gBAAgB;IACvB,OAAO,OAAO,C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