From 7ce666e4a32e4cc48ed2b6101eef3a9728cb36da Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Mon, 23 Sep 2024 10:05:11 -0400 Subject: [PATCH] respect NO_BUN and avoid installing bun --- pkg/flag/flag.go | 1 + pkg/global/global.go | 4 ++++ pkg/project/install.go | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/flag/flag.go b/pkg/flag/flag.go index f716a2486..704db13ae 100644 --- a/pkg/flag/flag.go +++ b/pkg/flag/flag.go @@ -9,3 +9,4 @@ var SST_PASSPHRASE = os.Getenv("SST_PASSPHRASE") var SST_PULUMI_PATH = os.Getenv("SST_PULUMI_PATH") var SST_PRINT_LOGS = os.Getenv("SST_PRINT_LOGS") != "" var SST_BUILD_CONCURRENCY = os.Getenv("SST_BUILD_CONCURRENCY") +var NO_BUN = os.Getenv("NO_BUN") != "" diff --git a/pkg/global/global.go b/pkg/global/global.go index 5c3fc9bb9..ac5e39845 100644 --- a/pkg/global/global.go +++ b/pkg/global/global.go @@ -15,6 +15,7 @@ import ( "strings" "github.com/pulumi/pulumi/sdk/v3" + "github.com/sst/ion/pkg/flag" ) var PULUMI_VERSION = "v" + sdk.Version.String() @@ -132,6 +133,9 @@ func CertPath() string { } func NeedsBun() bool { + if flag.NO_BUN { + return false + } path := BunPath() slog.Info("checking for bun", "path", path) if _, err := os.Stat(path); err != nil { diff --git a/pkg/project/install.go b/pkg/project/install.go index b3ccaeb73..4fae9f1d9 100644 --- a/pkg/project/install.go +++ b/pkg/project/install.go @@ -11,6 +11,7 @@ import ( "path/filepath" "strings" + "github.com/sst/ion/pkg/flag" "github.com/sst/ion/pkg/global" "github.com/sst/ion/pkg/npm" "golang.org/x/sync/errgroup" @@ -154,7 +155,7 @@ func (p *Project) writeTypes() error { func (p *Project) fetchDeps() error { slog.Info("fetching deps") manager := global.BunPath() - if os.Getenv("NO_BUN") != "" { + if flag.NO_BUN { manager = "npm" } cmd := exec.Command(manager, "install")