Menu

How to check every link in your npm package before you publish (README, homepage, repository and bugs)
📰

How to check every link in your npm package before you publish (README, homepage, repository and bugs)

DEV Community: node·linkbruno.com·3 days ago
#uwATx462
#devtonodejs#devto#dev#package#readme
Reading 0:00
15s threshold

Scheduled broken-link and redirect checks that tell you the moment a link breaks — linkbruno.com

There's a detail about npm that surprises a lot of package authors: the README shown on npmjs.com is the one from the published tarball. It doesn't update when you fix your GitHub README. If version 2.3.1 shipped with a broken link to the docs, every visitor to the package page sees that broken link until you publish 2.3.2.

The same goes for the URLs in package.json : homepage , repository , bugs and funding are shown in the package page sidebar, used by npm docs and npm bugs , and read by tools that build dependency reports. A typo there is a broken link in thousands of places at once.

So the right moment to check those links is just before npm publish . Here's a small script that does it.

What to check

Every absolute URL in the README. Documentation, badges, examples, license, changelog.

Relative links in the README.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.