shashkovdanil / clean-publish

Removing configuration files and fields in package.json before publishing to npm
https://www.npmjs.com/package/clean-publish
MIT License
313 stars 18 forks source link

Dry run mode (like `npm publish --dry-run`) #126

Closed igorkamyshev closed 3 years ago

igorkamyshev commented 3 years ago

Hello! I've read about this package in @ai's twitter and tried to check the difference of published size for my package.

So, I use npm publish --dry-run to check the list of file to publish and the final size of package. I think, the same mode for this package can be useful to emphasize difference between native publish and this package.

Example of dry-mod in npm:

➜  eslint-plugin-effector git:(master) ✗ npm publish --dry-run        
npm notice 📦  eslint-plugin-effector@0.3.1
npm notice === Tarball Contents === 
...
npm notice 2.0kB rules/no-ambiguity-target/no-ambiguity-target.js                                        
...                                                             
npm notice === Tarball Details === 
npm notice name:          eslint-plugin-effector                  
npm notice version:       0.3.1                                   
npm notice package size:  8.4 kB                                  
npm notice unpacked size: 34.8 kB                                 
...
npm notice total files:   32                                      
ai commented 3 years ago

We have --no-publish mode. Should we add alias to --dry-mode?

igorkamyshev commented 3 years ago

--no-publish just creates a folder and doesn't write an info about it in terminal 🤔

I tried to check the size of the result directory by myself, but results weren't correct (because it should respect .npmignore for example).

ai commented 3 years ago

Yeap, for --dry-run we can call npm publish --dry-run on temporary directory.

Can I ask you to send PR.

igorkamyshev commented 3 years ago

Yeah, I'll do it.

Should we remove temporary directory after npm publish --dry-run call?

ai commented 3 years ago

Should we remove temporary directory after npm publish --dry-run call?

Yeap