-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathexpo.go
87 lines (69 loc) · 1.98 KB
/
expo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package main
import (
"os"
"strings"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-tools/go-steputils/stepconf"
)
// Expo ...
type Expo struct {
Version string
Workdir string
}
// installExpoCLI runs the install npm command to install the expo-cli
func (e Expo) installExpoCLI() error {
args := []string{"install", "-g"}
if e.Version != "latest" {
args = append(args, "expo-cli@"+e.Version)
} else {
args = append(args, "expo-cli")
}
cmd := command.New("npm", args...)
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
log.Donef("$ %s", cmd.PrintableCommandArgs())
return cmd.Run()
}
// Login with your Expo account
func (e Expo) login(userName string, password stepconf.Secret) error {
args := []string{"login", "--non-interactive", "-u", userName, "-p", string(password)}
cmd := command.New("expo", args...)
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
nonFilteredArgs := ("$ " + cmd.PrintableCommandArgs())
fileredArgs := strings.Replace(nonFilteredArgs, string(password), "[REDACTED]", -1)
log.Printf(fileredArgs)
return cmd.Run()
}
// Logout from your Expo account
func (e Expo) logout() error {
cmd := command.New("expo", "logout", "--non-interactive")
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
log.Donef("$ %s", cmd.PrintableCommandArgs())
return cmd.Run()
}
// Eject command creates Xcode and Android Studio projects for your app.
func (e Expo) eject() error {
args := []string{"eject", "--non-interactive"}
cmd := command.New("expo", args...)
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
if e.Workdir != "" {
cmd.SetDir(e.Workdir)
}
log.Donef("$ %s", cmd.PrintableCommandArgs())
return cmd.Run()
}
func (e Expo) publish() error {
args := []string{"publish", "--non-interactive"}
cmd := command.New("expo", args...)
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
if e.Workdir != "" {
cmd.SetDir(e.Workdir)
}
log.Donef("$ %s", cmd.PrintableCommandArgs())
return cmd.Run()
}