From 69dbfd7cb043d1cdb95f5d08ea1ef1f0a334ce77 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 16 May 2024 21:13:24 -0400 Subject: [PATCH] cli: add lifecycle event env to `node --run` --- doc/api/cli.md | 11 +++++++++++ src/node_task_runner.cc | 7 ++++++- src/node_task_runner.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 10ade9da2bd4482..07a0c7b6f6241a0 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1847,6 +1847,10 @@ Modules preloaded with `--require` will run before modules preloaded with `--imp > Stability: 1.1 - Active development @@ -1887,6 +1891,13 @@ are: * Running `pre` or `post` scripts in addition to the specified script. * Defining package manager-specific environment variables. +#### Environment variables + +The following environment variables are set when running a script with `--run`: + +* `NODE_LIFECYCLE_EVENT`: The name of the script being run. For example, if + `--run` is used to run `test`, the value of this variable will be `test`. + ### `--secure-heap=n`