Skip to content

Commit

Permalink
Add npm_lifecycle env vars for scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie committed Jun 1, 2022
1 parent 1bc6726 commit 65c86e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func runScript(name string, args []string) error {
env := os.Environ()
env = append(env, fmt.Sprintf("PATH=%s:%s", strings.Join(binDirs, ":"), os.Getenv("PATH")))

if ok {
env = append(env, fmt.Sprintf("npm_lifecycle_event=%s", name))
env = append(env, fmt.Sprintf("npm_lifecycle_script=%s", name))
}

commandArgs := strings.Join(append([]string{script}, args...), " ")

fmt.Printf("%s %s\n", green.Render("$"), gray.Render(name))
Expand Down

0 comments on commit 65c86e1

Please sign in to comment.