Content-Length: 282791 | pFad | https://github.com/npm/cli/issues/8305

B5 [DOCS] Working directory of npm scripts in older versions of npm · Issue #8305 · npm/cli · GitHub
Skip to content

[DOCS] Working directory of npm scripts in older versions of npm #8305

@mk-pmb

Description

@mk-pmb

Is there an existing issue for this?

  • I have searched the existing issues

This is a CLI Docs Enhancement, not another kind of Docs Enhancement.

  • This is a CLI Docs Enhancement.

Description of Problem

I was unable to prove whether npm v7 scripts can expect to be run in the top level of their package directory in all circumstances.

Potential Solution

I'm glad to see that the current (npm v11) docs now seem to give an authoritative guarantee about the working directory for scripts to be run: https://docs.npmjs.com/cli/v11/using-npm/scripts/#best-practices

However, "Scripts are run from the root of the package folder" is a description of what npm does. It seems a bit misplaced in a chapter "Best practices", where I'd expect things I can and should do, but can opt to misbehave. I do see that this information is required for the next sentences to make sense, but that info is worthy in itself, there's no need to bury it here.

I think we should move that up a lot, at least up to the "User" or "Environment" chapters, probably even before "User".
Also it would be nice to have an overview (maybe as a link to an external page) of how earlier versions of npm were expected to behave in regards to the working directory, and how reliable it was. That would give an easy authoritative source on how much path verification code is justified in scripts.

Docs URL

https://docs.npmjs.com/cli/v11/using-npm/scripts/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationdocumentation related issueNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/npm/cli/issues/8305

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy