Commit 3ed764a
<!-- What / Why -->
<!-- Describe the request in detail. What it does and why it's being
changed. -->
This pull request updates the documentation for npm scripts,
specifically the `scripts.md` file.
**What:**
- Clarified that scripts are always run from the root of the package
folder in npm v7 and later.
- Added a "Historical Behavior in Older npm Versions" section to explain
that while generally true for npm v6 and earlier, there were
inconsistencies and that `process.cwd()` could be used as a safeguard.
- Ensured the `INIT_CWD` environment variable is mentioned as a way for
scripts to access the original working directory.
- Provided links to the npm v7 release notes and the relevant GitHub
issue discussing script working directory reliability in older versions.
**Why:**
This change aims to provide clearer and more accurate documentation
regarding the working directory of npm scripts, addressing potential
confusion, especially for users working with or migrating from older npm
versions. This helps resolve the points raised in issue #8305.
## References
<!-- Examples:
Related to #0
Depends on #0
Blocked by #0
Fixes #0
Closes #0
-->
Fixes #8305
---------
Co-authored-by: Michael Smith <[email protected]>
1 parent 2f30251 commit 3ed764a
1 file changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
231 | 245 | | |
232 | 246 | | |
233 | 247 | | |
| |||
350 | 364 | | |
351 | 365 | | |
352 | 366 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | 367 | | |
359 | 368 | | |
360 | 369 | | |
| |||
0 commit comments