1+ import { info } from './utils'
2+
13const path = require ( 'path' )
24const { spawnSync } = require ( 'child_process' )
35
@@ -14,6 +16,8 @@ interface MetroBundleOptions {
1416 sourcemapOutput ?: string
1517 bundleCommand ?: string
1618 extraBundlerOptions ?: string [ ]
19+ verbose ?: boolean
20+ minify ?: boolean
1721}
1822
1923export const metroBundle = ( {
@@ -28,6 +32,8 @@ export const metroBundle = ({
2832 assetsDest = outputDir ,
2933 sourcemapOutputDir = '' ,
3034 sourcemapOutput = sourcemapOutputDir ? path . join ( sourcemapOutputDir , `${ bundleName } .map` ) : null ,
35+ verbose = false ,
36+ minify = false ,
3137 extraBundlerOptions = [ ] ,
3238} : MetroBundleOptions ) => {
3339 const args = [
@@ -38,10 +44,14 @@ export const metroBundle = ({
3844 `--bundle-output=${ bundleOutput } ` ,
3945 sourcemapOutput && `--sourcemap-output=${ sourcemapOutput } ` ,
4046 assetsDest && `--assets-dest=${ assetsDest } ` ,
41- resetCache && '--reset-cache' ,
47+ `--minify=${ minify } ` ,
48+ resetCache && `--reset-cache` ,
49+ verbose && `--verbose` ,
4250 ...extraBundlerOptions ,
4351 ] . filter ( Boolean )
4452
53+ info ( `Running: ${ getCliPath ( ) } ${ args . join ( ' ' ) } ` )
54+
4555 spawnSync ( getCliPath ( ) , args , { stdio : 'inherit' } )
4656}
4757
0 commit comments