Skip to content

Commit 2130609

Browse files
author
rn-h
committed
Init
1 parent 4d0d59a commit 2130609

File tree

9 files changed

+855
-1
lines changed

9 files changed

+855
-1
lines changed

.vscode/launch.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Main",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${workspaceFolder}/main.go",
13+
"args": [
14+
"app",
15+
"ls_deployment",
16+
17+
"-n",
18+
"cp_ios",
19+
"-k"
20+
21+
// "login",
22+
// "-u",
23+
// "admin",
24+
// "-p",
25+
// "asdafkqwmefklqkf",
26+
// "-h",
27+
// "http://127.0.0.1:8080"
28+
]
29+
}
30+
]
31+
}

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
1-
# code-push-go
1+
# code-push-go
2+
Code-push-go cli used with [code-push-server-go](https://github.com/htdcx/code-push-server-go.git), only support react native
3+
4+
# Install
5+
``` shell
6+
git clone https://github.com/htdcx/code-push-go.git
7+
cd code-push-go
8+
9+
#MacOS build GOOS:windows,darwin
10+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o code-push-go(.exe) main.go
11+
12+
#Windows build
13+
set GOARCH=amd64
14+
set GOOS=linux #windows,darwin
15+
go build -o code-push-go(.exe) main.go
16+
mv code-push-go(.exe) <You project>
17+
18+
#Linux
19+
chmod +x code-push-go
20+
21+
#Login
22+
./code-push-go login -u <userName> -p <password> -h <serverUrl>
23+
24+
```
25+
26+
# Use
27+
``` shell
28+
./code-push-go app create_app -n <AppName> -os <ios or android>
29+
./code-push-go app create_deployment -n <AppName> -dn <DeploymentName>
30+
31+
#Update react native
32+
./code-push-go create_bundle -t <TargetVersion> -n <AppName> -d <DeploymentName> -p <(*Optional) React native project default:./>
33+
```
34+
35+
## License
36+
MIT License [Read](https://github.com/htdcx/code-push-go/blob/main/LICENSE)

constants/constants.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package constants
2+
3+
type SaveLoginInfo struct {
4+
Token string `json:"token"`
5+
ServerUrl string `json:"serverUrl"`
6+
}
7+
8+
type RespStatus struct {
9+
Success bool `json:"success"`
10+
}

go.mod

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module com.lc.go.codepush/client
2+
3+
go 1.21.5
4+
5+
require github.com/aws/aws-sdk-go v1.51.22
6+
7+
require (
8+
github.com/google/uuid v1.6.0 // indirect
9+
github.com/jmespath/go-jmespath v0.4.0 // indirect
10+
github.com/liushuochen/gotable v0.0.0-20221119160816-1113793e7092
11+
)

go.sum

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

main.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"com.lc.go.codepush/client/opt"
8+
)
9+
10+
func main() {
11+
12+
var args []string
13+
var notargs []string
14+
var in_flags bool = false
15+
for i := 0; i < len(os.Args); i++ {
16+
if os.Args[i][0] == '-' {
17+
in_flags = true
18+
}
19+
if i == 0 || in_flags {
20+
notargs = append(notargs, os.Args[i])
21+
} else {
22+
args = append(args, os.Args[i])
23+
}
24+
}
25+
os.Args = notargs
26+
help := "Usage: code-push-go <command>\n" +
27+
"Commands:\n" +
28+
" login Authenticate in order to begin managing your apps\n" +
29+
" logout Log out of the current session\n" +
30+
" app View and manage your CodePush apps\n" +
31+
" create_bundle Create react native hotfix bundle"
32+
var command string
33+
if len(args) <= 0 {
34+
fmt.Println(help)
35+
return
36+
}
37+
command = args[0]
38+
39+
switch command {
40+
case "login":
41+
opt.User{}.Login()
42+
case "logout":
43+
opt.User{}.Logout()
44+
case "create_bundle":
45+
opt.App{}.CreateBundle()
46+
case "app":
47+
opt.App{}.App(args)
48+
default:
49+
fmt.Println(help)
50+
return
51+
}
52+
53+
}

0 commit comments

Comments
 (0)