Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-02-22 22:58:19 +0300
committerGitHub <noreply@github.com>2022-02-22 22:58:19 +0300
commitd8fa9fa5e44d91e1c0170628d4839f7802c65a7f (patch)
treeb05a8c64c40cc73eee828407c7745f4b1df4222f
parentc9ff797e8b5e5a7b39ced04b1d3f8a0006993a1f (diff)
docs: explain $INIT_CWD on using scripts page (#4436)
-rw-r--r--docs/content/using-npm/scripts.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/content/using-npm/scripts.md b/docs/content/using-npm/scripts.md
index a3fa868f6..7df289b3b 100644
--- a/docs/content/using-npm/scripts.md
+++ b/docs/content/using-npm/scripts.md
@@ -344,6 +344,11 @@ file.
preinstall or install script. If you are doing this, please consider if
there is another option. The only valid use of `install` or `preinstall`
scripts is for compilation which must be done on the target architecture.
+* Scripts are run from the root of the package folder, regardless of what the
+ current working directory is when `npm` is invoked. If you want your
+ script to use different behavior based on what subdirectory you're in, you
+ can use the `INIT_CWD` environment variable, which holds the full path you
+ were in when you ran `npm run`.
### See Also