-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initalized frontend w/ login, contains persistance issues
- Loading branch information
Showing
29 changed files
with
724 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package commands | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
|
||
_ "github.com/lib/pq" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func RunFrontendCommand() *cli.Command { | ||
command := cli.Command{ | ||
Name: "fe", | ||
Usage: "Run the frontend", | ||
Category: "Development", | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "target", | ||
Aliases: []string{"t"}, | ||
Value: "mobile", | ||
Usage: "Run a specific frontend type (web or mobile)", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "platform", | ||
Aliases: []string{"p"}, | ||
Usage: "Run a specific platform for mobile frontend", | ||
Value: "ios", | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
if c.Args().Len() > 0 { | ||
return cli.Exit("Invalid arguments", 1) | ||
} | ||
|
||
target := c.String("target") | ||
if target != "web" && target != "mobile" { | ||
return cli.Exit("Invalid frontend type: must be 'web' or 'mobile'", 1) | ||
} | ||
|
||
|
||
err := RunFE(c.String("type"), c.String("platform")) | ||
if err != nil { | ||
return cli.Exit(err.Error(), 1) | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
return &command | ||
} | ||
|
||
func RunFE(feType string, platform string) error { | ||
switch feType { | ||
case "mobile": | ||
return RunMobileFE(platform) | ||
case "web": | ||
return RunWebFE() | ||
default: | ||
return RunMobileFE(platform) | ||
} | ||
} | ||
|
||
func RunMobileFE(platform string) error { | ||
mobileCmd := exec.Command("yarn", "run", platform) | ||
mobileCmd.Dir = FRONTEND_DIR + "/sac-mobile" | ||
|
||
mobileCmd.Stdout = os.Stdout | ||
mobileCmd.Stderr = os.Stderr | ||
mobileCmd.Stdin = os.Stdin | ||
|
||
if err := mobileCmd.Run(); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func RunWebFE() error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.