1
+ import { info } from './utils'
2
+
1
3
const path = require ( 'path' )
2
4
const { spawnSync } = require ( 'child_process' )
3
5
@@ -14,6 +16,8 @@ interface MetroBundleOptions {
14
16
sourcemapOutput ?: string
15
17
bundleCommand ?: string
16
18
extraBundlerOptions ?: string [ ]
19
+ verbose ?: boolean
20
+ minify ?: boolean
17
21
}
18
22
19
23
export const metroBundle = ( {
@@ -28,6 +32,8 @@ export const metroBundle = ({
28
32
assetsDest = outputDir ,
29
33
sourcemapOutputDir = '' ,
30
34
sourcemapOutput = sourcemapOutputDir ? path . join ( sourcemapOutputDir , `${ bundleName } .map` ) : null ,
35
+ verbose = false ,
36
+ minify = false ,
31
37
extraBundlerOptions = [ ] ,
32
38
} : MetroBundleOptions ) => {
33
39
const args = [
@@ -38,10 +44,14 @@ export const metroBundle = ({
38
44
`--bundle-output=${ bundleOutput } ` ,
39
45
sourcemapOutput && `--sourcemap-output=${ sourcemapOutput } ` ,
40
46
assetsDest && `--assets-dest=${ assetsDest } ` ,
41
- resetCache && '--reset-cache' ,
47
+ `--minify=${ minify } ` ,
48
+ resetCache && `--reset-cache` ,
49
+ verbose && `--verbose` ,
42
50
...extraBundlerOptions ,
43
51
] . filter ( Boolean )
44
52
53
+ info ( `Running: ${ getCliPath ( ) } ${ args . join ( ' ' ) } ` )
54
+
45
55
spawnSync ( getCliPath ( ) , args , { stdio : 'inherit' } )
46
56
}
47
57
0 commit comments