feat(core): minor cache improvements to improve dev ergonomics
This commit is contained in:
parent
33107b050c
commit
04a9c5edbb
@ -30,6 +30,12 @@ Type: `string`
|
||||
|
||||
Command to run in child process
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
Tells Nx where the files will be created
|
||||
|
||||
### parallel
|
||||
|
||||
Default: `true`
|
||||
|
||||
@ -31,6 +31,12 @@ Type: `string`
|
||||
|
||||
Command to run in child process
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
Tells Nx where the files will be created
|
||||
|
||||
### parallel
|
||||
|
||||
Default: `true`
|
||||
|
||||
@ -31,6 +31,12 @@ Type: `string`
|
||||
|
||||
Command to run in child process
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
Tells Nx where the files will be created
|
||||
|
||||
### parallel
|
||||
|
||||
Default: `true`
|
||||
|
||||
@ -5,7 +5,7 @@ import { findWorkspaceRoot } from './find-workspace-root';
|
||||
const workspace = findWorkspaceRoot(process.cwd());
|
||||
|
||||
if (process.env.NX_TERMINAL_OUTPUT_PATH) {
|
||||
setUpOutputWatching();
|
||||
setUpOutputWatching(process.env.NX_TERMINAL_CAPTURE_STDERR === 'true');
|
||||
}
|
||||
requireCli();
|
||||
|
||||
@ -40,7 +40,7 @@ function requireCli() {
|
||||
* And the cached output should be correct unless the CLI bypasses process.stdout or console.log and uses some
|
||||
* C-binary to write to stdout.
|
||||
*/
|
||||
function setUpOutputWatching() {
|
||||
function setUpOutputWatching(captureStderr: boolean) {
|
||||
const stdoutWrite = process.stdout._write;
|
||||
const stderrWrite = process.stderr._write;
|
||||
|
||||
@ -60,7 +60,9 @@ function setUpOutputWatching() {
|
||||
encoding: string,
|
||||
callback: Function
|
||||
) => {
|
||||
out.push(chunk.toString());
|
||||
if (captureStderr) {
|
||||
out.push(chunk.toString());
|
||||
}
|
||||
stderrWrite.apply(process.stderr, [chunk, encoding, callback]);
|
||||
};
|
||||
|
||||
|
||||
@ -34,6 +34,20 @@
|
||||
"type": "boolean",
|
||||
"description": "Use colors when showing output of command",
|
||||
"default": false
|
||||
},
|
||||
"outputPath": {
|
||||
"description": "Tells Nx where the files will be created",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["commands"]
|
||||
|
||||
@ -117,6 +117,9 @@ export class TaskOrchestrator {
|
||||
const env = { ...process.env };
|
||||
if (outputPath) {
|
||||
env.NX_TERMINAL_OUTPUT_PATH = outputPath;
|
||||
if (this.options.captureStderr) {
|
||||
env.NX_TERMINAL_CAPTURE_STDERR = 'true';
|
||||
}
|
||||
}
|
||||
const p = fork(this.getCommand(), this.getCommandArgs(task), {
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
||||
|
||||
@ -32,6 +32,7 @@ export interface DefaultTasksRunnerOptions {
|
||||
cacheDirectory?: string;
|
||||
remoteCache?: RemoteCache;
|
||||
lifeCycle?: LifeCycle;
|
||||
captureStderr?: boolean;
|
||||
}
|
||||
|
||||
export const tasksRunnerV2: TasksRunner<DefaultTasksRunnerOptions> = (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user