Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
pickup node_modules bin
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Feb 19, 2024
1 parent 6c84f85 commit 560c55e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
5 changes: 2 additions & 3 deletions cmd/sst/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,14 @@ func main() {
break
}

cwd, _ := os.Getwd()
os.Setenv("PATH", os.Getenv("PATH")+":"+filepath.Join(cwd, "node_modules", ".bin"))
for {
cmd := exec.Command(
args[0],
args[1:]...,
)

cwd, _ := os.Getwd()
for dir, receiver := range complete.Receivers {
dir = filepath.Join(cfgPath, "..", dir)
if !strings.HasPrefix(dir, cwd) {
Expand Down Expand Up @@ -441,7 +442,6 @@ func main() {
defer u.Event(&event)
if event.StackEvent.PreludeEvent != nil {
u.Reset()
u.Start()
}
}

Expand Down Expand Up @@ -505,7 +505,6 @@ func main() {
ui.Interrupt()
cancel()
}()
ui.Start()
err = p.Stack.Run(ctx, &project.StackInput{
Command: "up",
OnEvent: ui.Trigger,
Expand Down
27 changes: 24 additions & 3 deletions cmd/sst/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,31 @@ func (u *UI) Reset() {
}

func (u *UI) Trigger(evt *project.StackEvent) {
if evt.StackCommandEvent != nil && evt.StackCommandEvent.Command == "up" {
color.New(color.FgYellow, color.Bold).Print("~")
color.New(color.FgWhite, color.Bold).Println(" Deploying changes")
if evt.StackCommandEvent != nil {
u.spinner.Disable()

if evt.StackCommandEvent.Command == "up" {
color.New(color.FgYellow, color.Bold).Print("~")
color.New(color.FgWhite, color.Bold).Println(" Deploying")
u.spinner.Suffix = " Deploying..."
}

if evt.StackCommandEvent.Command == "destroy" {
color.New(color.FgRed, color.Bold).Print("~")
color.New(color.FgWhite, color.Bold).Println(" Removing")
u.spinner.Suffix = " Removing..."
}

if evt.StackCommandEvent.Command == "refresh" {
color.New(color.FgBlue, color.Bold).Print("~")
color.New(color.FgWhite, color.Bold).Println(" Refreshing")
u.spinner.Suffix = " Refreshing..."
}

fmt.Println()
u.spinner.Start()
u.spinner.Enable()
return
}

if evt.SummaryEvent != nil {
Expand Down
4 changes: 1 addition & 3 deletions pkg/project/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (s *stack) Run(ctx context.Context, input *StackInput) error {
slog.Info("stack command complete")
defer input.OnEvent(&StackEvent{CompleteEvent: complete})

rawDeploment, _ := stack.Export(ctx)
rawDeploment, _ := stack.Export(context.Background())
var deployment apitype.DeploymentV3
json.Unmarshal(rawDeploment.Deployment, &deployment)

Expand Down Expand Up @@ -485,10 +485,8 @@ func (s *stack) Import(ctx context.Context, input *ImportOptions) error {
return err
}

fmt.Println("existing")
existingIndex := -1
for index, resource := range deployment.Resources {
fmt.Println(resource.URN)
if urn == resource.URN {
existingIndex = index
break
Expand Down

0 comments on commit 560c55e

Please sign in to comment.