Skip to content

Commit

Permalink
Add option to disable minify in bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
esbenvb committed May 22, 2024
1 parent e8ab7a6 commit c371d36
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion opt/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (App) CreateBundle() {
var appName string
var deployment string
var rnDir string
var isMinifyDisabled bool

flag.StringVar(&targetVersion, "t", "", "Target version")
flag.StringVar(&appName, "n", "", "AppName")
Expand All @@ -58,6 +59,11 @@ func (App) CreateBundle() {

if targetVersion == "" || appName == "" || deployment == "" {
fmt.Println("Usage: code-push-go create_bundle -t <TargetVersion> -n <AppName> -d <deployment> -p <*Optional React native project dir>")
flag.BoolVar(&isMinifyDisabled, "no-minify", false, "Disable minify")
flag.Parse()

if targetVersion == "" || appName == "" || deployment == "" {
fmt.Println("Usage: code-push-go create_bundle -t <TargetVersion> -n <AppName> -d <deployment> -p <*Optional React native project dir> --disable-minify (*Optional)")
return
}
log.Println("Get app info...")
Expand Down Expand Up @@ -95,6 +101,12 @@ func (App) CreateBundle() {
if osName == "android" {
jsName = "index.android.bundle"
}

minify := "true"
if isMinifyDisabled {
minify = "false"
}

cmd := exec.Command(
"npx",
"react-native",
Expand All @@ -108,7 +120,9 @@ func (App) CreateBundle() {
"--entry-file",
"index.js",
"--platform",
osName)
osName,
"--minify",
minify)
cmd.Dir = rnDir
out, err := cmd.CombinedOutput()
if err != nil {
Expand Down

0 comments on commit c371d36

Please sign in to comment.