Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
rn-h committed May 6, 2024
1 parent 4d0d59a commit 2130609
Show file tree
Hide file tree
Showing 9 changed files with 855 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Main",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"args": [
"app",
"ls_deployment",

"-n",
"cp_ios",
"-k"

// "login",
// "-u",
// "admin",
// "-p",
// "asdafkqwmefklqkf",
// "-h",
// "http://127.0.0.1:8080"
]
}
]
}
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# code-push-go
# code-push-go
Code-push-go cli used with [code-push-server-go](https://github.com/htdcx/code-push-server-go.git), only support react native

# Install
``` shell
git clone https://github.com/htdcx/code-push-go.git
cd code-push-go

#MacOS build GOOS:windows,darwin
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o code-push-go(.exe) main.go

#Windows build
set GOARCH=amd64
set GOOS=linux #windows,darwin
go build -o code-push-go(.exe) main.go
mv code-push-go(.exe) <You project>

#Linux
chmod +x code-push-go

#Login
./code-push-go login -u <userName> -p <password> -h <serverUrl>

```

# Use
``` shell
./code-push-go app create_app -n <AppName> -os <ios or android>
./code-push-go app create_deployment -n <AppName> -dn <DeploymentName>

#Update react native
./code-push-go create_bundle -t <TargetVersion> -n <AppName> -d <DeploymentName> -p <(*Optional) React native project default:./>
```

## License
MIT License [Read](https://github.com/htdcx/code-push-go/blob/main/LICENSE)
10 changes: 10 additions & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package constants

type SaveLoginInfo struct {
Token string `json:"token"`
ServerUrl string `json:"serverUrl"`
}

type RespStatus struct {
Success bool `json:"success"`
}
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module com.lc.go.codepush/client

go 1.21.5

require github.com/aws/aws-sdk-go v1.51.22

require (
github.com/google/uuid v1.6.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/liushuochen/gotable v0.0.0-20221119160816-1113793e7092
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
github.com/aws/aws-sdk-go v1.51.22 h1:VL2p2JgC32myt7DMEcbe1devdtgGSgMNvZpkcdvlxq4=
github.com/aws/aws-sdk-go v1.51.22/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/liushuochen/gotable v0.0.0-20221119160816-1113793e7092 h1:u9I3sJ+uTakxnRrvuYJGsEi4SvEMN+yB47WWGDHHxIk=
github.com/liushuochen/gotable v0.0.0-20221119160816-1113793e7092/go.mod h1:CxUy8nDvutaC1pOfaG9TRoYwdHHqoNstSPPKhomC9k8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
53 changes: 53 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package main

import (
"fmt"
"os"

"com.lc.go.codepush/client/opt"
)

func main() {

var args []string
var notargs []string
var in_flags bool = false
for i := 0; i < len(os.Args); i++ {
if os.Args[i][0] == '-' {
in_flags = true
}
if i == 0 || in_flags {
notargs = append(notargs, os.Args[i])
} else {
args = append(args, os.Args[i])
}
}
os.Args = notargs
help := "Usage: code-push-go <command>\n" +
"Commands:\n" +
" login Authenticate in order to begin managing your apps\n" +
" logout Log out of the current session\n" +
" app View and manage your CodePush apps\n" +
" create_bundle Create react native hotfix bundle"
var command string
if len(args) <= 0 {
fmt.Println(help)
return
}
command = args[0]

switch command {
case "login":
opt.User{}.Login()
case "logout":
opt.User{}.Logout()
case "create_bundle":
opt.App{}.CreateBundle()
case "app":
opt.App{}.App(args)
default:
fmt.Println(help)
return
}

}
Loading

0 comments on commit 2130609

Please sign in to comment.