npm / npm/cli

[DOCS] Question on `.npmignore` / `files` behavior for git dependencies in latest version

Open
#7,335 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Documentation Needs Triage
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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

Considering a sample typescript project like this minimal example: https://github.com/cs-balazs/dummy-lib
When this repo is used as a git dependency in an npm project, after npm install, the build folder is not included in node_modules/dummy-lib. With version 10.2.4, it does appear in the folder, but with 10.5.0 it doesn't

With either of these changes, it works with 10.5.0:

  • Adding a files: ["./build/**/*"] in package.json
  • Removing src from .npmignore

I wanted to understand the reason behind this, but couldn't find the relevant change in the changelog, nor found a reason in the docs. The documentation of the files field states, that:

Certain files are always included, regardless of settings:

  • package.json
  • README
  • LICENSE / LICENCE
  • The file in the "main" field
  • The file(s) in the "bin" field

Which to me means, that in this case at least build/src/index.js should be there

I don't know if this is indeed a problem with the docs, or just my misunderstanding, I'm submitting this issue to find that out, and a reason on why this git dependency behavior changed

Potential Solution

No response

Docs URL

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported difference using the linked dummy-lib project with npm 10.2.4 and 10.5.0, focusing on package.json and .npmignore. Read the package.json files documentation and the linked changelog to determine whether the git-dependency behavior is documented; done means explaining the behavior and identifying any required documentation update.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.