Is there an existing issue for this?
This issue exists in the latest npm version
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.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
In monorepositories (with
workspacesinpackage.json),npm publishandnpm packtake into account.gitignoreand ignore.npmignore.Expected Behavior
If
.npmignoreis present,npm publishandnpm packshould take that file into account and ignore.gitignore.Steps To Reproduce
Now you can see that the
packages/pkg1/pkg1-1.0.0.tgzarchive does not contain adistdirectory.Environment