@@ -26,28 +26,40 @@ export default async function build({ root, output, report }: Input) {
2626 const config = JSON . parse ( await fs . readFile ( tsconfig , 'utf-8' ) ) ;
2727
2828 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+
2939 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' ) ;
3545 }
3646
37- if ( config . compilerOptions && config . compilerOptions . declarationDir ) {
47+ if ( conflicts . length ) {
3848 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 (
4250 '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+ ) } `
4455 ) ;
4556 }
4657 }
4758 }
4859
4960 if ( await fs . pathExists ( tsc ) ) {
5061 child_process . execFileSync ( tsc , [
62+ '--pretty' ,
5163 '--declaration' ,
5264 '--emitDeclarationOnly' ,
5365 '--outDir' ,
@@ -71,7 +83,7 @@ export default async function build({ root, output, report }: Input) {
7183 } catch ( e ) {
7284 if ( e . stdout ) {
7385 report . error (
74- `Errors found when building definition files. \n${ e . stdout . toString ( ) } `
86+ `Errors found when building definition files: \n${ e . stdout . toString ( ) } `
7587 ) ;
7688 } else {
7789 report . error ( e . message ) ;
0 commit comments