From 65c86e16a8401efa875f42078e5530d030f6a21d Mon Sep 17 00:00:00 2001 From: Jacob Gillespie Date: Wed, 1 Jun 2022 23:39:39 +0100 Subject: [PATCH] Add npm_lifecycle env vars for scripts --- utils.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils.go b/utils.go index fc1f35c..17e32f5 100644 --- a/utils.go +++ b/utils.go @@ -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))