Skip to content

Commit

Permalink
cli: do not print global version warning when already using local ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
thdxr committed Jul 22, 2024
1 parent 847612c commit d7d6e4d
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion cmd/sst/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var version = "dev"
func main() {
// check if node_modules/.bin/sst exists
nodeModulesBinPath := filepath.Join("node_modules", ".bin", "sst")
if _, err := os.Stat(nodeModulesBinPath); err == nil && os.Getenv("SST_SKIP_LOCAL") != "true" {
if _, err := os.Stat(nodeModulesBinPath); err == nil && os.Getenv("npm_config_user_agent") == "" && os.Getenv("SST_SKIP_LOCAL") != "true" && version != "dev" {
// forward command to node_modules/.bin/sst
fmt.Println(ui.TEXT_WARNING_BOLD.Render("Warning: ") + "You are using a global installation of SST but you also have a local installation specified in your package.json. The local installation will be used but you should typically run it through your package manager.")
cmd := exec.Command(nodeModulesBinPath, os.Args[1:]...)
Expand Down Expand Up @@ -427,6 +427,31 @@ var root = &cli.Command{
},
Run: CmdDeploy,
},
{
Name: "preview",
Description: cli.Description{
Short: "Deploy your application",
Long: strings.Join([]string{}, "\n"),
},
Flags: []cli.Flag{
{
Name: "target",
Description: cli.Description{
Short: "Comma seperated list of target URNs",
Long: "Comma seperated list of target URNs.",
},
},
},
Examples: []cli.Example{
{
Content: "sst preview --stage production",
Description: cli.Description{
Short: "Preview changes to production",
},
},
},
Run: CmdPreview,

Check failure on line 453 in cmd/sst/main.go

View workflow job for this annotation

GitHub Actions / goreleaser

undefined: CmdPreview
},
{
Name: "add",
Description: cli.Description{
Expand Down

0 comments on commit d7d6e4d

Please sign in to comment.