File tree Expand file tree Collapse file tree 3 files changed +30
-10
lines changed Expand file tree Collapse file tree 3 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,13 @@ if (!existsSync('temp/packages')) {
1212 process . exit ( 1 )
1313}
1414
15- export default readdirSync ( 'temp/packages' ) . map ( pkg => {
15+ const packages = readdirSync ( 'temp/packages' )
16+ const targets = process . env . TARGETS ? process . env . TARGETS . split ( ',' ) : null
17+ const targetPackages = targets
18+ ? packages . filter ( pkg => targets . includes ( pkg ) )
19+ : packages
20+
21+ export default targetPackages . map ( pkg => {
1622 return {
1723 input : `./temp/packages/${ pkg } /src/index.d.ts` ,
1824 output : {
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ const targets = args._
3434const formats = args . formats || args . f
3535const devOnly = args . devOnly || args . d
3636const prodOnly = ! devOnly && ( args . prodOnly || args . p )
37+ const buildTypes = args . withTypes || args . t
3738const sourceMap = args . sourcemap || args . s
3839const isRelease = args . release
3940const buildAllMatching = args . all || args . a
@@ -44,12 +45,25 @@ run()
4445async function run ( ) {
4546 const removeCache = scanEnums ( )
4647 try {
47- if ( ! targets . length ) {
48- await buildAll ( allTargets )
49- checkAllSizes ( allTargets )
50- } else {
51- await buildAll ( fuzzyMatchTarget ( targets , buildAllMatching ) )
52- checkAllSizes ( fuzzyMatchTarget ( targets , buildAllMatching ) )
48+ const resolvedTargets = targets . length
49+ ? fuzzyMatchTarget ( targets , buildAllMatching )
50+ : allTargets
51+ await buildAll ( resolvedTargets )
52+ checkAllSizes ( resolvedTargets )
53+ if ( buildTypes ) {
54+ await execa (
55+ 'pnpm' ,
56+ [
57+ 'run' ,
58+ 'build-dts' ,
59+ ...( targets . length
60+ ? [ '--environment' , `TARGETS:${ resolvedTargets . join ( ',' ) } ` ]
61+ : [ ] )
62+ ] ,
63+ {
64+ stdio : 'inherit'
65+ }
66+ )
5367 }
5468 } finally {
5569 removeCache ( )
Original file line number Diff line number Diff line change @@ -199,9 +199,9 @@ async function main() {
199199 // build all packages with types
200200 step ( '\nBuilding all packages...' )
201201 if ( ! skipBuild && ! isDryRun ) {
202- await run ( 'pnpm' , [ 'run' , 'build' ] )
203- step ( '\nBuilding and testing types...' )
204- await run ( 'pnpm' , [ 'test-dts' ] )
202+ await run ( 'pnpm' , [ 'run' , 'build' , '--withTypes' ] )
203+ step ( '\nTesting built types...' )
204+ await run ( 'pnpm' , [ 'test-dts-only ' ] )
205205 } else {
206206 console . log ( `(skipped)` )
207207 }
You can’t perform that action at this time.
0 commit comments