Migrate Catalog is a CLI tool for automating the migration of dependency versions from a centralized catalog in your pnpm-workspace.yaml file to all package.json files in a monorepo. This tool streamlines version updates in pnpm workspaces, saving time and reducing manual errors.
- Automated Migration: Scans all
package.jsonfiles and replaces"catalog:"with the correct version from yourpnpm-workspace.yamlcatalog. - Monorepo Support: Built to work seamlessly in multi-package repositories managed by pnpm.
- Easy Integration: Ideal for CI/CD pipelines and local development environments.
- TypeScript Support: Written in TypeScript with full type definitions included.
- Customizable: Extendable for additional dependency sections or custom update logic.
Install the package globally with npm:
pnpm install -g migrate-catalogOr use it via pnpx:
pnpx migrate-catalog@latestAdd this to your .npmrc file:
@imbios:registry=https://npm.pkg.github.com
Then install the package:
pnpm install -g migrate-catalogRun the tool from the root of your monorepo:
migrate-catalogThe script will:
- Read the
catalogsection frompnpm-workspace.yaml. - Recursively locate all
package.jsonfiles (ignoringnode_modules). - Update dependencies with the version placeholder
"catalog:"to the actual version from the catalog.
The tool supports several command-line options for customizing its behavior:
# Use a custom workspace file location
migrate-catalog --workspace ./custom-workspace.yaml
# Process only specific package.json files matching a pattern
migrate-catalog --pattern "packages/*/package.json"
# Perform a dry run without actually modifying files
migrate-catalog --dry-runThe tool supports named catalogs as defined in the catalogs section of your pnpm-workspace.yaml. To reference a named catalog in your package.json, use the format "catalog:catalog-name":
{
"dependencies": {
"react": "catalog:react19",
"react-dom": "catalog:react19"
}
}-
Configure Your Monorepo: Ensure your
pnpm-workspace.yamlincludes a validcatalogsection and that yourpackage.jsonfiles have dependencies with"catalog:"as their version. -
Run Migrate Catalog: Execute the tool in your project root and verify that the updates have been applied across your packages.
packages:
- apps/*
- packages/*
- tooling/*
catalog:
# Auth
"@auth/core": 0.37.2
"@auth/drizzle-adapter": ~1.7.4
# Dev tooling
eslint: ^9.23.0
prettier: ^3.5.3
catalogs:
react19:
react: 19.0.0
react-dom: 19.0.0
"@types/react": ^19.0.12
"@types/react-dom": ^19.0.4{
"name": "@my-app/web",
"dependencies": {
"@auth/core": "catalog:",
"react": "catalog:react19",
"react-dom": "catalog:react19"
},
"devDependencies": {
"eslint": "catalog:",
"prettier": "catalog:",
"@types/react": "catalog:react19"
}
}The tool includes a comprehensive test suite:
# Run all tests
pnpm test
# Run only the end-to-end tests
pnpm run test:e2e
# Generate test coverage report
pnpm run test:coverageThe end-to-end tests validate the tool's functionality using a real monorepo structure with catalog definitions.
Contributions are welcome! Fork the repository, create your feature branch, and submit a pull request with your enhancements.
- Publishing Guide - Instructions for setting up and using the automated publishing workflow
- Manual Publishing Guide - Instructions for manually publishing to both registries
- Troubleshooting - Common issues and their solutions
This project is licensed under the MIT License.
catalog migration, monorepo, pnpm, npm package, dependency management, version automation, node CLI tool, automated version update