Skip to content

Add option to bundle TypeScript project #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions opt/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (App) CreateBundle() {
var appName string
var deployment string
var rnDir string
var isTypescriptProject bool
var description string
var isMinifyDisabled bool
var hermes bool
Expand All @@ -61,12 +62,13 @@ func (App) CreateBundle() {
flag.StringVar(&rnDir, "p", "./", "React native project dir")
flag.StringVar(&description, "description", "", "Description")
flag.BoolVar(&isMinifyDisabled, "disable-minify", false, "Disable minify")
flag.BoolVar(&isTypescriptProject, "bundle-typescript", false, "Bundle typescript project")
flag.BoolVar(&hermes, "hermes", false, "Enable hermes")

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> --description <*Optional Description> --disable-minify (*Optional) --hermes (*Optional)")
fmt.Println("Usage: code-push-go create_bundle -t <TargetVersion> -n <AppName> -d <deployment> -p <*Optional React native project dir> --description <*Optional Description> --disable-minify (*Optional) --bundle-typescript (*Optional) --hermes (*Optional)")
return
}
log.Println("Get app info...")
Expand Down Expand Up @@ -109,6 +111,12 @@ func (App) CreateBundle() {
if isMinifyDisabled {
minify = "false"
}

indexFile := "index.js"
if isTypescriptProject {
indexFile = "index.tsx"
}

buildUrl := rnDir + "build/CodePush"
bundelUrl := buildUrl + "/" + jsName
cmd := exec.Command(
Expand All @@ -122,7 +130,7 @@ func (App) CreateBundle() {
"--dev",
"false",
"--entry-file",
"index.js",
indexFile,
"--platform",
osName,
"--minify",
Expand Down
Loading