verdaccio: README published by yarn 2 is not correctly shown on verdaccio
⚠️⚠️⚠️⚠️ Workaround available, scroll down ⬇️ ⚠️⚠️⚠️⚠️
Describe the bug
README is not correctly shown on verdaccio using yarn npm publish
To Reproduce
mkdir yarn-verdaccio-readme
cd yarn-verdaccio-readme
yarn set version berry
echo '
npmPublishRegistry: http://localhost:4873
unsafeHttpWhitelist: [localhost]
' >> .yarnrc.yml
echo '
{
"name": "yarn-verdaccio-readme",
"version": "0.1.0"
}
' > package.json
echo '# yarn-verdaccio-readme' > README.md
yarn
docker run --rm -p 4873:4873 -d verdaccio/verdaccio:4.8.1
echo 'input some random username/password'
yarn npm login --publish
yarn npm publish
yarn npm logout --publish
echo 'open http://localhost:4873/-/web/detail/yarn-verdaccio-readme then you will see "ERROR: No README data found!".'
Expected behavior
README should be correctly shown on verdaccio
Screenshots
$ yarn npm publish
➤ YN0000: README.md
➤ YN0000: package.json
➤ YN0000: Package archive published
➤ YN0000: Done in 0.91s
Configuration File (cat ~/.config/verdaccio/config.yaml)
Default config in the verdaccio/verdaccio:4.8.1 docker image
Environment information
Server: the verdaccio/verdaccio:4.8.1 docker image
Client: Yarn 2.1.1
Additional context
README.mdis correctly uploaded- the issue seems to be that
verdacciodepends on thereadmefield in the publish body to show the README content - the yarn 2 client does not provide the
readmefield in the publish body whilenpmdid provide it, but the NPM registry seems to work fine without that field, for example the yarn 2 published@yarnpkg/libzippackage shows the README correctly. - the corresponding yarn 2 issue: https://github.com/yarnpkg/berry/issues/1702
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 16 (9 by maintainers)
Still actual for Verdaccio v5.6.2 and Yarn v3.2.0 😕
As a temporary workaround, I ended up manually adding the readme field with the contents of the
README.md. It’s suitable for the CI environment, but you can do a cleanup in thepostpackscript if you need to. It’s dirty enough, hope this issue will be resolved someday.package.json
scripts/prepack.js
I’ll ship it in the next minor release over the weekend 👍
@juanpicado Thanks for your info! The fix seems to be released at 4.9.1. (https://github.com/verdaccio/verdaccio/compare/v4.9.0...v4.9.1)
And I reported about my issue to lerna repo 😄 https://github.com/lerna/lerna/issues/2877
Nice find(s) yes I see - I’m using
npm@7(_npmVersion: '7.0.10',) 👍Thanks for that, I’ll verify that.
What I observed: At https://github.com/verdaccio/verdaccio/blob/master/src/api/endpoint/api/publish.ts#L187 a console.log(metadataCopy) had this - Note it contains a
readme: '# Test\n',for version1.0.0By the time it gets to https://github.com/verdaccio/verdaccio/blob/master/src/lib/local-storage.ts#L217 console.log(metadata) has
readme: '',Hope this helps a bit!
Same issue on NPM (I’m running NPM version is 7.0.10)