@@ -26,28 +26,40 @@ export default async function build({ root, output, report }: Input) {
26
26
const config = JSON . parse ( await fs . readFile ( tsconfig , 'utf-8' ) ) ;
27
27
28
28
if ( config . compilerOptions ) {
29
+ const conflicts : string [ ] = [ ] ;
30
+
31
+ if ( config . compilerOptions . noEmit !== undefined ) {
32
+ conflicts . push ( 'compilerOptions.noEmit' ) ;
33
+ }
34
+
35
+ if ( config . compilerOptions . emitDeclarationOnly !== undefined ) {
36
+ conflicts . push ( 'compilerOptions.emitDeclarationOnly' ) ;
37
+ }
38
+
29
39
if ( config . compilerOptions . outDir ) {
30
- report . warn (
31
- `Found ${ chalk . blue ( 'compilerOptions.outDir' ) } in ${ chalk . blue (
32
- 'tsconfig.json'
33
- ) } which can conflict with the CLI options. It's recommended to remove it from the config file.`
34
- ) ;
40
+ conflicts . push ( 'compilerOptions.outDir' ) ;
41
+ }
42
+
43
+ if ( config . compilerOptions . declarationDir ) {
44
+ conflicts . push ( 'compilerOptions.declarationDir' ) ;
35
45
}
36
46
37
- if ( config . compilerOptions && config . compilerOptions . declarationDir ) {
47
+ if ( conflicts . length ) {
38
48
report . warn (
39
- `Found ${ chalk . blue (
40
- 'compilerOptions.declarationDir'
41
- ) } in ${ chalk . blue (
49
+ `Found following options in the config file which can conflict with the CLI options. Please remove them from ${ chalk . blue (
42
50
'tsconfig.json'
43
- ) } which can conflict with the CLI options. It's recommended to remove it from the config file.`
51
+ ) } :${ conflicts . reduce (
52
+ ( acc , curr ) => acc + `\n${ chalk . gray ( '-' ) } ${ chalk . yellow ( curr ) } ` ,
53
+ ''
54
+ ) } `
44
55
) ;
45
56
}
46
57
}
47
58
}
48
59
49
60
if ( await fs . pathExists ( tsc ) ) {
50
61
child_process . execFileSync ( tsc , [
62
+ '--pretty' ,
51
63
'--declaration' ,
52
64
'--emitDeclarationOnly' ,
53
65
'--outDir' ,
@@ -71,7 +83,7 @@ export default async function build({ root, output, report }: Input) {
71
83
} catch ( e ) {
72
84
if ( e . stdout ) {
73
85
report . error (
74
- `Errors found when building definition files. \n${ e . stdout . toString ( ) } `
86
+ `Errors found when building definition files: \n${ e . stdout . toString ( ) } `
75
87
) ;
76
88
} else {
77
89
report . error ( e . message ) ;
0 commit comments