What is syncpack?
Syncpack is a tool for managing multiple package.json files in a monorepo or multi-package repository. It helps ensure consistency across dependencies, scripts, and other configurations.
What are syncpack's main functionalities?
List Dependencies
Lists all dependencies across multiple package.json files, helping you identify inconsistencies.
const { list } = require('syncpack');
list();
Fix Versions
Fixes version mismatches across multiple package.json files, ensuring all packages use the same version of a dependency.
const { fix } = require('syncpack');
fix();
Set Version
Sets a specific version for a dependency across all package.json files.
const { set } = require('syncpack');
set('react', '17.0.2');
Format
Formats all package.json files to ensure a consistent style.
const { format } = require('syncpack');
format();
Other packages similar to syncpack
lerna
Lerna is a tool for managing JavaScript projects with multiple packages. It optimizes the workflow around managing multi-package repositories with git and npm. Compared to Syncpack, Lerna offers more comprehensive features for managing monorepos, including versioning and publishing.
yarn
Yarn is a package manager that doubles down as a project manager. It offers workspaces that can manage multiple packages within a single repository. While Syncpack focuses on consistency across package.json files, Yarn provides a broader set of features for dependency management and project workflows.
pnpm
pnpm is a fast, disk space-efficient package manager. It also supports workspaces for managing multiple packages in a monorepo. Compared to Syncpack, pnpm is more focused on performance and efficient storage, while Syncpack is specialized in ensuring consistency across package.json files.
syncpack
Consistent dependency versions in large JavaScript Monorepos.
https://jamiemason.github.io/syncpack
Installation
npm install --save-dev syncpack
Commands
Ensure that multiple packages requiring the same dependency define the same version, so that every package requires eg. react@16.4.2
, instead of a combination of react@16.4.2
, react@0.15.9
, and react@16.0.0
.
Organise package.json files according to a conventional format, where fields appear in a predictable order and nested fields are ordered alphabetically. Shorthand properties are used where available, such as the "repository"
and "bugs"
fields.
Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack configuration file.
Check whether dependency versions used within "dependencies", "devDependencies", etc follow a consistent format.
List all dependencies required by your packages.
List dependencies which are required by multiple packages, where the version is not the same across every package.
Displays a series of prompts to fix mismatches which syncpack cannot fix automatically.
Ensure dependency versions used within "dependencies"
, "devDependencies"
etc follow a consistent format.
Interactively update packages to the latest versions from the npm registry, wherever they are in your monorepo. You can update every dependency, just dev/peer/prod dependencies, just packages which match a name filter, and more.
Badges