@@ -7,7 +7,16 @@ import JSON5 from 'json5';
7
7
import { platform } from 'os' ;
8
8
import { Input } from '../types' ;
9
9
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 ) {
11
20
report . info (
12
21
`Cleaning up previous build at ${ chalk . blue ( path . relative ( root , output ) ) } `
13
22
) ;
@@ -16,7 +25,8 @@ export default async function build({ root, output, report }: Input) {
16
25
17
26
report . info ( `Generating type definitions with ${ chalk . blue ( 'tsc' ) } ` ) ;
18
27
19
- const tsconfig = path . join ( root , 'tsconfig.json' ) ;
28
+ const project = options ?. project ? options . project : 'tsconfig.json' ;
29
+ const tsconfig = path . join ( root , project ) ;
20
30
21
31
try {
22
32
if ( await fs . pathExists ( tsconfig ) ) {
@@ -48,7 +58,7 @@ export default async function build({ root, output, report }: Input) {
48
58
if ( conflicts . length ) {
49
59
report . warn (
50
60
`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
52
62
) } :${ conflicts . reduce (
53
63
( acc , curr ) =>
54
64
acc + `\n${ chalk . gray ( '-' ) } ${ chalk . yellow ( curr ) } ` ,
@@ -59,7 +69,7 @@ export default async function build({ root, output, report }: Input) {
59
69
}
60
70
} catch ( e ) {
61
71
report . warn (
62
- `Couldn't parse 'tsconfig.json '. There might be validation errors.`
72
+ `Couldn't parse '${ project } '. There might be validation errors.`
63
73
) ;
64
74
}
65
75
}
@@ -80,11 +90,15 @@ export default async function build({ root, output, report }: Input) {
80
90
'--pretty' ,
81
91
'--declaration' ,
82
92
'--emitDeclarationOnly' ,
93
+ '--project' ,
94
+ project ,
83
95
'--outDir' ,
84
96
output ,
85
97
] ) ;
86
98
87
- await del ( [ path . join ( output , 'tsconfig.tsbuildinfo' ) ] ) ;
99
+ await del ( [
100
+ path . join ( output , project . replace ( / \. j s o n $ / , '.tsbuildinfo' ) ) ,
101
+ ] ) ;
88
102
89
103
report . success (
90
104
`Wrote definition files to ${ chalk . blue ( path . relative ( root , output ) ) } `
0 commit comments