JS-DevTools / npm-publish

GitHub Action to publish to NPM
https://jstools.dev/npm-publish
MIT License
613 stars 74 forks source link

Possibly provide more of the built-in npm "dry run" output #184

Closed forevermatt closed 6 months ago

forevermatt commented 6 months ago

Have you considered including more of the standard output of npm's "dry run" mode? I find that quite helpful sometimes, such as to see what all files would be included in the published package (so that I can adjust things to remove unneeded files).

Here's a slightly-redacted example of what npm shows:

npm notice πŸ“¦  @some-org/some-package@1.2.3
npm notice === Tarball Contents === 
npm notice 1.1kB  LICENSE                            
npm notice 2.6kB  README.md                          
npm notice 20.3kB dist/index.js                      
npm notice 17.8kB dist/index.mjs                     
npm notice 1.4kB  package.json                       
npm notice 3.1kB  src/SomeFile.svelte
npm notice 72B    src/index.js                       
npm notice 1.8kB  src/loader.js
...

However, the npm-publish GitHub action seems to only show something like this:

Run JS-DevTools/npm-publish@v3
  with:
    token: ***
    dry-run: true
πŸ™…β€β™€οΈ @some-org/some-package@1.2.3 publish skipped.

Thank for making helpful open source packages, nonetheless! 😁

mcous commented 6 months ago

I like this idea! I think what might be happening here is that dry-run doesn't affect the version check logic, so if you're in dry-run mode but the version in question is already released, npm publish --dry-run will never be called.

What we could do is have dry-run proceed past the version check (with appropriate logging) and run npm publish --dry-run no matter what. I think if we do that, we'll get the nice little pack log

forevermatt commented 6 months ago

Sounds promising, thanks! Unfortunately, I'm not familiar enough with this codebase to submit a PR myself. Sorry. 😞

mcous commented 6 months ago

All good! It’ll be a pretty small lift if my assumptions hold 🀞, will take a crack at it by Friday

forevermatt commented 6 months ago

Awesome, thanks! We're already seeing those changes in our builds, and it looks great! 😁 πŸŽ‰