gitmyhub

cdnm

JavaScript ★ 2 updated 3y ago

Manage dependencies through CDN URLs in HTML files.

A command-line tool that finds and updates the CDN-linked JavaScript/CSS library versions inside your HTML files, without needing a build tool.

JavaScriptNode.jssetup: easycomplexity 2/5

CDNM Explanation

CDNM is a tool that helps you keep track of and update JavaScript and CSS libraries in HTML files without using a traditional build tool. Instead of bundling your code, you reference libraries directly from CDNs (content delivery networks)—services that host popular packages online. This approach is simple for small projects or static sites, but managing those library versions manually gets tedious. CDNM automates that part.

Here's what it does: you write HTML with script or link tags pointing to libraries on CDNs like unpkg or jsDelivr, and CDNM reads those URLs, understands which libraries you're using and what versions, then can check for newer versions and update your HTML automatically. Think of it like having npm's update command, but for HTML files instead of a Node.js project. When you run cdnm update, it scans your HTML, sees that you're using, say, version 2.1.0 of a library, checks if 2.1.1 is available, and rewrites the URL in your file.

The tool also lets you list what dependencies you have (cdnm list), see which ones are out of date (cdnm outdated), and even generate a package.json file for reference. It currently works with npm-backed CDNs—unpkg, jsDelivr, and bundle.run are supported, so virtually any package published to npm can be managed this way.

This is useful if you're building a small website, a static site, or any project where you don't want the complexity of a bundler like Webpack. You just link to libraries from a CDN in your HTML and let CDNM keep them updated, removing the friction of manually editing version numbers in URLs. It's installed globally via npm, so once you set it up, it's a simple command-line tool to run whenever you want to check for or apply updates.

Where it fits