File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
packages/ci/src/lib/cli/commands Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,19 @@ export async function runPrintConfig({
15
15
if ( ! silent ) {
16
16
console . info ( stdout ) ;
17
17
}
18
+
19
+ // workaround for 1st lines like `> nx run utils:code-pushup -- print-config`
20
+ const lines = stdout . split ( / \r ? \n / ) ;
21
+ const jsonLines = lines . slice ( lines . indexOf ( '{' ) , lines . indexOf ( '}' ) + 1 ) ;
22
+ const stdoutSanitized = jsonLines . join ( '\n' ) ;
23
+
18
24
try {
19
- return JSON . parse ( stdout ) as unknown ;
25
+ return JSON . parse ( stdoutSanitized ) as unknown ;
20
26
} catch ( error ) {
27
+ if ( silent ) {
28
+ console . info ( 'Invalid output from print-config:' ) ;
29
+ console . info ( stdout ) ;
30
+ }
21
31
throw new Error (
22
32
`Error parsing output of print-config command - ${ stringifyError ( error ) } ` ,
23
33
) ;
You can’t perform that action at this time.
0 commit comments