Package Exports
- align-deps-vers
- align-deps-vers/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (align-deps-vers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
align-deps-vers
🛠️ A tiny CLI tool to align semver-declared dependency versions in
package.jsonwith what’s actually installed innode_modules.
What it does
When dependencies are declared like:
"chalk": "^5.0.0"But node_modules contains a newer compatible version, say:
"chalk": "5.3.0"This tool updates your package.json to:
"chalk": "^5.3.0"➡️ Keeping your semver prefixes (^, ~, etc.), while reflecting actual versions.
Usage
Run instantly with npx
npx align-deps-versThis:
- Reads your
package.json - Gets actual installed versions
- Rewrites all matching dependencies with updated (actual) versions
How It Works
- Calls
npm list --json - Resolves top-level installed packages from
node_modules - Walks through:
dependenciesdevDependenciesoptionalDependencies
- If the declared version uses a prefix (
^,~, etc.) — it replaces only the version part, not the prefix
Example
Before:
"dependencies": {
"chalk": "^5.0.0",
"ora": "~6.0.0"
}Actually installed:
chalk@5.3.0ora@6.1.1
After:
"dependencies": {
"chalk": "^5.3.0",
"ora": "~6.1.1"
}Use Case
Useful for:
- Committing package updates with accurate dependency metadata
- Snapshotting versions for auditability and long-term tracking
- Improving visibility into the actual versions installed in
node_modules(let's be honest, package-lock.json is not human-friendly) - Avoiding confusion caused by mismatches between declared and real versions