Skip to content
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

Pnpm #11

Merged
merged 2 commits into from
Nov 1, 2023
Merged

Pnpm #11

Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions cmd/frontend/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ var AddCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
bash_args := []string{"add", args[0]}
if cmd.Flag("dev").Value.String() == "true" {
bash_args = append(bash_args, "--dev")
bash_args = append(bash_args, "-D")
}
if cmd.Flag("yarn").Value.String() == "true" {
frontend.ExecBashCmd("yarn", bash_args...)
} else {
frontend.ExecBashCmd("pnpm", bash_args...)
}
frontend.ExecBashCmd("yarn", bash_args...)
},
}

Expand Down
1 change: 1 addition & 0 deletions cmd/frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var FrontendCmd = &cobra.Command{

func init() {
cmd.RootCmd.AddCommand(FrontendCmd)
FrontendCmd.PersistentFlags().Bool("yarn", false, "Uses yarn instead of pnpm")
}

func ExecBashCmd(name string, args ...string) string {
Expand Down
6 changes: 5 additions & 1 deletion cmd/frontend/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ var InstallCmd = &cobra.Command{
if cmd.Flag("force").Value.String() == "true" {
bash_args = append(bash_args, "--force")
}
frontend.ExecBashCmd("yarn", bash_args...)
if cmd.Flag("yarn").Value.String() == "true" {
frontend.ExecBashCmd("yarn", bash_args...)
} else {
frontend.ExecBashCmd("pnpm", bash_args...)
}
},
}

Expand Down
8 changes: 6 additions & 2 deletions cmd/frontend/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ var RemoveCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
bash_args := []string{"remove", args[0]}
if cmd.Flag("dev").Value.String() == "true" {
bash_args = append(bash_args, "--dev")
bash_args = append(bash_args, "-D")
}
if cmd.Flag("yarn").Value.String() == "true" {
frontend.ExecBashCmd("yarn", bash_args...)
} else {
frontend.ExecBashCmd("pnpm", bash_args...)
}
frontend.ExecBashCmd("yarn", bash_args...)
},
}

Expand Down
7 changes: 6 additions & 1 deletion cmd/frontend/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ var StartCmd = &cobra.Command{
Long: `Starts an instance of the nextjs frontend in the terminal`,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
frontend.ExecBashCmd("yarn", "next", "dev", "-p", fmt.Sprintf("%v", cmd.Flag("port").Value))
if cmd.Flag("yarn").Value.String() == "true" {
frontend.ExecBashCmd("yarn", "start", "-p", fmt.Sprintf("%v", cmd.Flag("port").Value))
} else {
frontend.ExecBashCmd("pnpm", "start", "-p", fmt.Sprintf("%v", cmd.Flag("port").Value))
}

},
}

Expand Down
9 changes: 7 additions & 2 deletions cmd/serverless/core/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ var AddCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
bash_args := []string{"add", args[0]}
if cmd.Flag("dev").Value.String() == "true" {
bash_args = append(bash_args, "--dev")
bash_args = append(bash_args, "-D")
}
core.ExecBashCmd("yarn", bash_args...)
if cmd.Flag("yarn").Value.String() == "true" {
core.ExecBashCmd("yarn", bash_args...)
} else {
core.ExecBashCmd("pnpm", bash_args...)
}

},
}

Expand Down
9 changes: 7 additions & 2 deletions cmd/serverless/core/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ var RemoveCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
bash_args := []string{"remove", args[0]}
if cmd.Flag("dev").Value.String() == "true" {
bash_args = append(bash_args, "--dev")
bash_args = append(bash_args, "-D")
}
core.ExecBashCmd("yarn", bash_args...)
if cmd.Flag("yarn").Value.String() == "true" {
core.ExecBashCmd("yarn", bash_args...)
} else {
core.ExecBashCmd("pnpm", bash_args...)
}

},
}

Expand Down
9 changes: 7 additions & 2 deletions cmd/serverless/functions/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ var AddCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
bash_args := []string{"add", args[0]}
if cmd.Flag("dev").Value.String() == "true" {
bash_args = append(bash_args, "--dev")
bash_args = append(bash_args, "-D")
}
functions.ExecBashCmd("yarn", bash_args...)
if cmd.Flag("yarn").Value.String() == "true" {
functions.ExecBashCmd("yarn", bash_args...)
} else {
functions.ExecBashCmd("pnpm", bash_args...)
}

},
}

Expand Down
9 changes: 7 additions & 2 deletions cmd/serverless/functions/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ var RemoveCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
bash_args := []string{"remove", args[0]}
if cmd.Flag("dev").Value.String() == "true" {
bash_args = append(bash_args, "--dev")
bash_args = append(bash_args, "-D")
}
functions.ExecBashCmd("yarn", bash_args...)
if cmd.Flag("yarn").Value.String() == "true" {
functions.ExecBashCmd("yarn", bash_args...)
} else {
functions.ExecBashCmd("pnpm", bash_args...)
}

},
}

Expand Down
6 changes: 5 additions & 1 deletion cmd/serverless/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ var InstallCmd = &cobra.Command{
if cmd.Flag("force").Value.String() == "true" {
bash_args = append(bash_args, "--force")
}
serverless.ExecBashCmd("yarn", bash_args...)
if cmd.Flag("yarn").Value.String() == "true" {
serverless.ExecBashCmd("yarn", bash_args...)
} else {
serverless.ExecBashCmd("pnpm", bash_args...)
}
},
}

Expand Down
1 change: 1 addition & 0 deletions cmd/serverless/serverless.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var ServerlessCmd = &cobra.Command{

func init() {
cmd.RootCmd.AddCommand(ServerlessCmd)
cmd.RootCmd.PersistentFlags().Bool("yarn", false, "Uses yarn instead of pnpm")
}

func ExecBashCmd(name string, args ...string) string {
Expand Down
6 changes: 5 additions & 1 deletion cmd/serverless/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ var StartCmd = &cobra.Command{
Long: `Starts SST's Live Lambda Development environment in the terminal`,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
serverless.ExecBashCmd("yarn", "sst", "dev")
if cmd.Flag("yarn").Value.String() == "true" {
serverless.ExecBashCmd("yarn", "sst", "dev")
} else {
serverless.ExecBashCmd("pnpm", "sst", "dev")
}
},
}

Expand Down