@@ -8,7 +8,6 @@ import { FileSystem } from '@rushstack/node-core-library';
8
8
import type { IPhasedCommandPlugin , PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks' ;
9
9
import type { IEnvironment } from '../../utilities/Utilities' ;
10
10
import type { Operation } from './Operation' ;
11
- import type { IOperationRunnerContext } from './IOperationRunner' ;
12
11
import type { IOperationExecutionResult } from './IOperationExecutionResult' ;
13
12
14
13
const PLUGIN_NAME : 'NodeDiagnosticDirPlugin' = 'NodeDiagnosticDirPlugin' ;
@@ -44,32 +43,25 @@ export class NodeDiagnosticDirPlugin implements IPhasedCommandPlugin {
44
43
return diagnosticDir ;
45
44
} ;
46
45
47
- hooks . beforeExecuteOperation . tap (
46
+ hooks . createEnvironmentForOperation . tap (
48
47
PLUGIN_NAME ,
49
- ( operation : IOperationRunnerContext & IOperationExecutionResult ) : undefined => {
50
- const diagnosticDir : string | undefined = getDiagnosticDir ( operation . operation ) ;
48
+ ( env : IEnvironment , record : IOperationExecutionResult ) => {
49
+ const diagnosticDir : string | undefined = getDiagnosticDir ( record . operation ) ;
51
50
if ( ! diagnosticDir ) {
52
- return ;
51
+ return env ;
53
52
}
54
53
55
54
// Not all versions of NodeJS create the directory, so ensure it exists:
56
55
FileSystem . ensureFolder ( diagnosticDir ) ;
57
- }
58
- ) ;
59
-
60
- hooks . createEnvironmentForOperation . tap ( PLUGIN_NAME , ( env : IEnvironment , operation : Operation ) => {
61
- const diagnosticDir : string | undefined = getDiagnosticDir ( operation ) ;
62
- if ( ! diagnosticDir ) {
63
- return env ;
64
- }
65
56
66
- const { NODE_OPTIONS } = env ;
57
+ const { NODE_OPTIONS } = env ;
67
58
68
- const diagnosticDirEnv : string = `--diagnostic-dir="${ diagnosticDir } "` ;
59
+ const diagnosticDirEnv : string = `--diagnostic-dir="${ diagnosticDir } "` ;
69
60
70
- env . NODE_OPTIONS = NODE_OPTIONS ? `${ NODE_OPTIONS } ${ diagnosticDirEnv } ` : diagnosticDirEnv ;
61
+ env . NODE_OPTIONS = NODE_OPTIONS ? `${ NODE_OPTIONS } ${ diagnosticDirEnv } ` : diagnosticDirEnv ;
71
62
72
- return env ;
73
- } ) ;
63
+ return env ;
64
+ }
65
+ ) ;
74
66
}
75
67
}
0 commit comments