npm / cli

the package manager for JavaScript

Home Page:https://docs.npmjs.com/cli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] file are unexpectedly ignored from being published

trusktr opened this issue · comments

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

My project has a .gitignore (content doesn't matter), an empty .npmignore, and does not have a files field in package.json. When I run npm pack --dry-run, it does not publish all the files in the project.

Expected Behavior

It should file all the files, I am not ignoring any.

Steps To Reproduce

It seems to have to do with being nested in another project (workspaces).

git clone --single-branch --depth=1 git@github.com:lume/lume.git lume
cd lume
git checkout beed124b5958bc59ba43212b2cf0dbbe294b4034
git submodule update --init packages/cli
cd packages/cli
npm pack --dry-run

Unexpected output of npm pack:

npm WARN ignoring workspace config at /Users/trusktr/src/lume-test/packages/cli/.npmrc 
npm notice 
npm notice 📦  @lume/cli@0.11.0
npm notice === Tarball Contents === 
npm notice 16.2kB README.md   
npm notice 5.5kB  bin/cli.js  
npm notice 1.4kB  package.json
npm notice === Tarball Details === 
npm notice name:          @lume/cli                               
npm notice version:       0.11.0                                  
npm notice filename:      lume-cli-0.11.0.tgz                     
npm notice package size:  8.3 kB                                  
npm notice unpacked size: 23.2 kB                                 
npm notice shasum:        68420d2ebf0f490897d6fa2db6cd32c45bc1a6a7
npm notice integrity:     sha512-XPJqE/ZgAAMC0[...]e5ap17NuJydIQ==
npm notice total files:   3                                       
npm notice 
lume-cli-0.11.0.tgz

If you clone the cli repo directly, no problem (make sure you back out of the lume folder):

git clone --single-branch --depth=1 git@github.com:lume/cli.git lume-cli
cd lume-cli
git checkout 56565bc3f435d0819f9e4e7f74622c72f09e6762
npm pack --dry-run

Expected output of npm pack:

npm notice 
npm notice 📦  @lume/cli@0.11.0
npm notice === Tarball Contents === 
npm notice 19B    .gitattributes                   
npm notice 28B    .prettierignore                  
npm notice 215B   .prettierrc.js                   
npm notice 16.2kB README.md                        
npm notice 5.5kB  bin/cli.js                       
npm notice 13.8kB bin/commands.js                  
npm notice 650B   config/babel.config.js           
npm notice 708B   config/getUserBabelConfig.js     
npm notice 787B   config/getUserConfig.js          
npm notice 697B   config/gulpfile.js               
npm notice 2.3kB  config/ts.config.json            
npm notice 3.3kB  config/web-test-runner.config.mjs
npm notice 507B   config/wtr-load-jest-globals.js  
npm notice 77B    index.js                         
npm notice 1.4kB  package.json                     
npm notice 1.6kB  scripts/exec.js                  
npm notice 879B   scripts/name.js                  
npm notice 543B   scripts/postversion.sh           
npm notice 636B   scripts/release-pre.sh           
npm notice 907B   scripts/run-web-test-runner.js   
npm notice 1.1kB  scripts/version-to-source.js     
npm notice 300B   scripts/version.sh               
npm notice === Tarball Details === 
npm notice name:          @lume/cli                               
npm notice version:       0.11.0                                  
npm notice filename:      lume-cli-0.11.0.tgz                     
npm notice package size:  16.6 kB                                 
npm notice unpacked size: 52.2 kB                                 
npm notice shasum:        b5d1f66eb00c14e2f124abd361234c258726f308
npm notice integrity:     sha512-CWw19zyQhilOY[...]+nnD2zhEKVMeQ==
npm notice total files:   22                                      
npm notice 
lume-cli-0.11.0.tgz

Environment

  • npm: 10.5.2
  • Node.js: v20.6.1
  • OS Name: macOS
  • System Model Name: MacBook Air M2
  • npm config:
❯ npm config ls
npm WARN ignoring workspace config at /Users/trusktr/src/lume+lume/packages/cli/.npmrc 
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in: /Users/trusktr/.npm/_logs/2024-04-26T22_18_15_165Z-debug-0.log
❯ npm config ls --no-workspaces
; "builtin" config from /Users/trusktr/.npm-packages/lib/node_modules/npm/npmrc

; prefix = "/opt/homebrew" ; overridden by user

; "user" config from /Users/trusktr/.npmrc

//registry.npmjs.org/:_authToken = (protected) 
prefix = "/Users/trusktr/.npm-packages" 

; "project" config from /Users/trusktr/src/lume+lume/packages/cli/.npmrc

package-lock = false 

; "cli" config from command line options

workspaces = false 

; node bin location = /Users/trusktr/.n-node-versions/bin/node
; node version = v20.6.1
; npm local prefix = /Users/trusktr/src/lume+lume/packages/cli
; npm version = 10.5.2
; cwd = /Users/trusktr/src/lume+lume/packages/cli
; HOME = /Users/trusktr
; Run `npm config ls -l` to show all defaults.

Npm pack will show the correct output if I use no-workspaces:

npm pack --dry-run --no-workspaces
commented

beed124b5958bc59ba43212b2cf0dbbe294b4034 is not a valid git reference in that repo