Skip to content

[BUG] In monorepositories npm publish and npm pack take into account .gitignore and ignore .npmignore #6808

Description

@KostyaTretyak

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

In monorepositories (with workspaces in package.json), npm publish and npm pack take into account .gitignore and ignore .npmignore.

Expected Behavior

If .npmignore is present, npm publish and npm pack should take that file into account and ignore .gitignore.

Steps To Reproduce

git clone git@github.com:KostyaTretyak/npm-bug-with-monorepo.git
cd npm-bug-with-monorepo
npm i
cd packages/pkg1
npm pack

Now you can see that the packages/pkg1/pkg1-1.0.0.tgz archive does not contain a dist directory.

Environment

  • npm: 10.1 (and tested with v9.6.7);
  • Node.js: v18.17.1;
  • OS Name: Ubuntu 22.04;
  • System Model Name: HP Notebook
  • npm config:
; "user" config from /home/me/.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = /home/me/.nvm/versions/node/v18.17.1/bin/node
; node version = v18.17.1
; npm local prefix = /srv/git/npm-bug-with-monorepo
; npm version = 10.1.0
; cwd = /srv/git/npm-bug-with-monorepo
; HOME = /home/me
; Run `npm config ls -l` to show all defaults.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issueRelease 10.xRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions