@@ -7,7 +7,16 @@ import JSON5 from 'json5';
77import { platform } from 'os' ;
88import { Input } from '../types' ;
99
10- export default async function build ( { root, output, report } : Input ) {
10+ type Options = Input & {
11+ options ?: { project ?: string } ;
12+ } ;
13+
14+ export default async function build ( {
15+ root,
16+ output,
17+ report,
18+ options,
19+ } : Options ) {
1120 report . info (
1221 `Cleaning up previous build at ${ chalk . blue ( path . relative ( root , output ) ) } `
1322 ) ;
@@ -16,7 +25,8 @@ export default async function build({ root, output, report }: Input) {
1625
1726 report . info ( `Generating type definitions with ${ chalk . blue ( 'tsc' ) } ` ) ;
1827
19- const tsconfig = path . join ( root , 'tsconfig.json' ) ;
28+ const project = options ?. project ? options . project : 'tsconfig.json' ;
29+ const tsconfig = path . join ( root , project ) ;
2030
2131 try {
2232 if ( await fs . pathExists ( tsconfig ) ) {
@@ -48,7 +58,7 @@ export default async function build({ root, output, report }: Input) {
4858 if ( conflicts . length ) {
4959 report . warn (
5060 `Found following options in the config file which can conflict with the CLI options. Please remove them from ${ chalk . blue (
51- 'tsconfig.json'
61+ project
5262 ) } :${ conflicts . reduce (
5363 ( acc , curr ) =>
5464 acc + `\n${ chalk . gray ( '-' ) } ${ chalk . yellow ( curr ) } ` ,
@@ -59,7 +69,7 @@ export default async function build({ root, output, report }: Input) {
5969 }
6070 } catch ( e ) {
6171 report . warn (
62- `Couldn't parse 'tsconfig.json '. There might be validation errors.`
72+ `Couldn't parse '${ project } '. There might be validation errors.`
6373 ) ;
6474 }
6575 }
@@ -80,11 +90,15 @@ export default async function build({ root, output, report }: Input) {
8090 '--pretty' ,
8191 '--declaration' ,
8292 '--emitDeclarationOnly' ,
93+ '--project' ,
94+ project ,
8395 '--outDir' ,
8496 output ,
8597 ] ) ;
8698
87- await del ( [ path . join ( output , 'tsconfig.tsbuildinfo' ) ] ) ;
99+ await del ( [
100+ path . join ( output , project . replace ( / \. j s o n $ / , '.tsbuildinfo' ) ) ,
101+ ] ) ;
88102
89103 report . success (
90104 `Wrote definition files to ${ chalk . blue ( path . relative ( root , output ) ) } `
0 commit comments