JSPM

align-deps-vers

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q29716F
  • License MIT

CLI tool to align package.json dependency versions with actually installed versions, i.e. ^6.0.0 to ^6.2.2

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.json with what’s actually installed in node_modules.

npm version License: MIT


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-vers

This:

  • 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:
    • dependencies
    • devDependencies
    • optionalDependencies
  • 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.0
  • ora@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