### Get help for format command Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/format.mdx Use the `--help` or `-h` flag to see more examples and a short summary of available options for the `format` command. ```bash syncpack format --help ``` ```bash syncpack format -h ``` -------------------------------- ### Display Detailed Help for Syncpack Commands Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx For comprehensive documentation and examples for a specific Syncpack command, use the '--help' flag. ```bash npx syncpack update --help ``` -------------------------------- ### Install Syncpack Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v15.mdx Install syncpack as a dev dependency. ```bash npm install --save-dev syncpack ``` -------------------------------- ### Display help for json command Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/json.mdx Use the `--help` option to see all available options and examples for the `json` command. ```bash syncpack json --help ``` -------------------------------- ### Install Syncpack Locally Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx Install Syncpack as a dev dependency in your project to ensure all contributors use the same version. This is the recommended approach for real project setups. ```bash npm install syncpack --save-dev ``` -------------------------------- ### Example package.json with 'name~version' format Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx A sample package.json file demonstrating the 'name~version' format, where the package name and version are located at separate, distinct paths. ```json { "devEngines": { "runtime": { "name": "node", "version": "22.11.0" } } } ``` -------------------------------- ### Example package.json with 'version' format Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx A sample package.json file showing the 'version' format, where a version string is directly specified without an accompanying name. ```json { "engines": { "node": "22.11.0" } } ``` -------------------------------- ### Get Help for Syncpack Commands Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx View a summary of available options for any Syncpack command by appending '-h'. ```bash npx syncpack update -h ``` -------------------------------- ### Display short help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/update.mdx Get a concise summary of available options for the `update` command using the `-h` flag. ```bash syncpack update -h ``` -------------------------------- ### Example package.json with 'name@version' format Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx A sample package.json file illustrating the 'name@version' format, where both the package name and version are combined into a single string. ```json { "packageManager": "pnpm@7.27.0" } ``` -------------------------------- ### Run Locally Installed Syncpack Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx Execute the locally installed Syncpack binary using 'npm exec'. This ensures you are running the version installed in your project's devDependencies. ```bash npm exec syncpack -- list ``` -------------------------------- ### Display short help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Get a concise summary of available options for the `list` command using the short flag `-h`. ```bash syncpack list -h ``` -------------------------------- ### Configure Syncpack for Production Dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx Create a `.syncpackrc.json` file to configure Syncpack. This example focuses on syncing all production dependencies and ignoring others. ```json { "versionGroups": [ { "label": "Sync all production dependencies", "dependencyTypes": ["prod"] }, { "label": "Ignore everything else", "isIgnored": true } ] } ``` -------------------------------- ### JavaScript Configuration Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/syncpackrc.mdx Configure Syncpack using a JavaScript file. This example includes JSDoc for type checking. ```javascript // @ts-check /** @type {import("syncpack").RcFile} */ const config = { indent: " ", }; module.exports = config; ``` -------------------------------- ### Default sortAz Configuration Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/sort-az.mdx This example shows the default configuration for `sortAz` in a `.syncpackrc.json` file. It specifies an array of fields that should be sorted alphabetically. ```json { "sortAz": [ "bin", "contributors", "dependencies", "devDependencies", "keywords", "peerDependencies", "resolutions", "scripts" ] } ``` -------------------------------- ### Configure Semver Group Range Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/semver-groups/with-range.mdx Use the 'range' property in your .syncpackrc.json to specify the desired semver range format for dependencies matching the group's criteria. This example enforces the tilde range for packages starting with '@foo/'. ```json { "semverGroups": [ { "dependencies": ["@foo/**"], "range": "~" } ] } ``` -------------------------------- ### Display short help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/fix.mdx Get a concise summary of the `syncpack fix` command's options and their basic usage with the `-h` or `--help` flag. ```bash syncpack fix -h ``` -------------------------------- ### List Dependencies with Exact Version Specifier Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx Find all dependencies installed with an exact version number. This helps in identifying and potentially standardizing versioning strategies. ```bash syncpack list --specifier-types exact ``` -------------------------------- ### Count dependencies by type using jq Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/json.mdx Pipe the JSON output to `jq` to process and analyze dependency data. This example counts dependencies by type. ```bash syncpack json | jq -r '.dependencyType' | sort | uniq -c ``` -------------------------------- ### Default sortFirst Configuration Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/sort-first.mdx This example shows the default value for the `sortFirst` configuration in a `.syncpackrc.json` file. It specifies that 'name', 'description', 'version', and 'author' fields should appear first. ```json { "sortFirst": ["name", "description", "version", "author"] } ``` -------------------------------- ### Configure snapTo for Version Groups Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/snapped-to.mdx Use the `snapTo` array to specify package names that will act as the source of truth for dependency versions. If a dependency is not found in the first package listed, subsequent packages in the array will be checked as fallbacks. This example ensures that 'react' and 'react-native' in this group use the versions defined in the 'mobile-app' package. ```json { "versionGroups": [ { "dependencies": ["react", "react-native"], "snapTo": ["mobile-app"] } ] } ``` -------------------------------- ### JSON output for format command Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/json.mdx Use the `--reporter json` option with the `format` command to get machine-readable output of formatting issues. ```bash syncpack format --reporter json ``` -------------------------------- ### JSON output for fix command Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/json.mdx Use the `--reporter json` option with the `fix` command to get machine-readable output of fixable version mismatches. ```bash syncpack fix --reporter json ``` -------------------------------- ### Update Dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx This command updates dependencies to their latest allowed versions and writes the changes to your files. Ensure you run your package manager's install command afterwards. ```bash syncpack update --dependencies react ``` -------------------------------- ### Configure Different Semver Ranges by Dependency Type Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/semver-groups.mdx This configuration sets different semver ranges based on the dependency type. Production dependencies get fixed versions, development dependencies use '~', and peer dependencies use '^'. ```json { "semverGroups": [ { "dependencyTypes": [ "prod", "resolutions", "overrides", "pnpmOverrides", "local" ], "range": "" }, { "dependencyTypes": ["dev"], "range": "~" }, { "dependencyTypes": ["peer"], "range": "^" } ] } ``` -------------------------------- ### Choose the lowest valid semver version when fixing mismatches Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/lowest-semver.mdx Use this configuration to ensure that all dependencies listed in the `dependencies` array are aligned to the lowest semver version found across your monorepo. This is particularly useful when different packages might have different versions of the same dependency installed. ```json { "versionGroups": [ { "dependencies": ["swing", "low"], "preferVersion": "lowestSemver" } ] } ``` -------------------------------- ### Autofix Dependency Errors Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx If the suggested dependency changes look acceptable, this command can automatically fix them. Remember to run your package manager's install command afterwards to update your lockfile. ```bash syncpack fix --dependency-types prod ``` -------------------------------- ### List dependencies with maximum detail Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx The `--show all` option provides the highest level of detail for all listed dependencies. ```bash syncpack list --show all ``` -------------------------------- ### Display help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Access comprehensive help documentation for the `list` command by using the `--help` flag. ```bash syncpack list --help ``` -------------------------------- ### Display help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/fix.mdx Access comprehensive help documentation for the `syncpack fix` command, including all available options and their usage. ```bash syncpack fix --help ``` -------------------------------- ### Display help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/update.mdx View comprehensive help documentation for the `update` command. ```bash syncpack update --help ``` -------------------------------- ### List all instances of each dependency Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Employ the `--show instances` flag to display every occurrence of each dependency, rather than just their names. ```bash syncpack list --show instances ``` -------------------------------- ### List and inspect dependencies Source: https://github.com/jamiemason/syncpack/blob/main/README.md Query and inspect all dependencies in your project. Various flags allow sorting by usage count, showing instances, ignored dependencies, or specific dependency types and version specifiers. Use --show hints,statuses to choose specific values. ```bash syncpack list --sort count ``` ```bash syncpack list --show instances ``` ```bash syncpack list --show ignored ``` ```bash syncpack list --show all ``` ```bash syncpack list --show hints,statuses ``` ```bash syncpack list --dependency-types peer ``` ```bash syncpack list --dependencies '@types/**' ``` ```bash syncpack list --specifier-types exact --show instances --dependency-types peer ``` ```bash syncpack list --help ``` ```bash syncpack list -h ``` -------------------------------- ### Lint excluding dependency types Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/lint.mdx Use this command to lint all dependency types except for specified ones. For example, to exclude "peerDependencies". ```bash syncpack lint --dependency-types '!peer' ``` -------------------------------- ### List dependencies with selected details Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Filter the displayed dependency information by specifying desired details with the `--show` option, separated by commas. ```bash syncpack list --show hints,statuses ``` -------------------------------- ### Display help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/lint.mdx Use this command to view detailed help information for the `lint` command, including all available options. ```bash syncpack lint --help ``` -------------------------------- ### Configure Ignored Version Group Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/ignored.mdx To ignore a version group, set the `isIgnored` property to `true` within its configuration. This example shows how to ignore the 'keep-walking' dependency. ```json { "versionGroups": [ { "dependencies": ["keep-walking"], "isIgnored": true } ] } ``` -------------------------------- ### List exact version peer dependencies with instances Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Combine `--specifier-types exact`, `--show instances`, and `--dependency-types peer` to list all exact version peer dependencies and their occurrences. ```bash syncpack list --specifier-types exact --show instances --dependency-types peer ``` -------------------------------- ### Display short help information Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/lint.mdx This command displays a concise summary of the available options for the `lint` command. ```bash syncpack lint -h ``` -------------------------------- ### Enable formatRepository Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/format-repository.mdx Configure the 'formatRepository' option in a .syncpackrc.json file to enable formatting of the 'repository' field in package.json files. ```json { "formatRepository": false } ``` -------------------------------- ### Check for Patch Updates in Dev Dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx This command checks for updates to 'devDependencies' where only the patch version is newer than what's currently installed. It's a safe way to check for minor improvements. ```bash syncpack update --check --dependency-types dev --target patch ``` -------------------------------- ### List dependencies matching a pattern Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Use the `--dependencies` option with a glob pattern to list dependencies that match the specified name pattern. ```bash syncpack list --dependencies '@types/**' ``` -------------------------------- ### List Dependencies by Count Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx Use this command to list production dependencies and sort them by how frequently they appear in your project. This helps identify the most used dependencies. ```bash syncpack list --dependency-types prod --sort count ``` -------------------------------- ### Format package.json files Source: https://github.com/jamiemason/syncpack/blob/main/README.md Use this command to organize package.json files according to a conventional format. It ensures fields appear in a predictable order and uses shorthand properties where available. Run with --check to list formatting issues without making changes. ```bash syncpack format ``` ```bash syncpack format --check ``` ```bash syncpack format --check --source 'packages/pingu/package.json' ``` ```bash syncpack format --help ``` ```bash syncpack format -h ``` -------------------------------- ### List peer dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx To list only `peerDependencies`, use the `--dependency-types peer` flag. ```bash syncpack list --dependency-types peer ``` -------------------------------- ### Migrate `--specs` to `--specifier-types` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `--specs` CLI option has been renamed to `--specifier-types` for consistency. ```bash # v13 syncpack format --specs exact,range # v14 syncpack format --specifier-types exact,range ``` -------------------------------- ### Short form for ignoring all dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups.mdx This is a concise way to configure a version group that ignores all dependencies. It's equivalent to the long form but omits properties that default to matching all values. ```json { "versionGroups": [ { "label": "Ignore everything", "isIgnored": true } ] } ``` -------------------------------- ### JSON Configuration Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/syncpackrc.mdx Configure Syncpack using a JSON file. This is the preferred method for performance. ```json { "$schema": "./node_modules/syncpack/schema.json", "indent": " " } ``` -------------------------------- ### Configure 'name~version' Strategy in .syncpackrc.json Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx This configuration shows how to define a custom type using the 'name~version' strategy. It requires specifying both the 'namePath' and 'path' to the respective name and version strings within the package.json. ```json { "customTypes": { "devEnginesRuntime": { "strategy": "name~version", "namePath": "devEngines.runtime.name", "path": "devEngines.runtime.version" } } } ``` -------------------------------- ### Output all dependencies as JSON Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/json.mdx Use this command to output all dependencies in your monorepo as JSON. Each line represents a dependency instance with its version, location, and status. ```bash syncpack json ``` -------------------------------- ### Lint specific dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/lint.mdx This command allows you to target specific dependencies for linting. You can specify exact names or use glob patterns. ```bash syncpack lint --dependencies react ``` ```bash syncpack lint --dependencies '**react**' ``` ```bash syncpack lint --dependencies '@types/**' ``` -------------------------------- ### List Dependencies with Syncpack Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx Use this command to list all dependencies found under the 'dependencies' property in your package.json files. Syncpack automatically detects your package manager's workspace configuration. ```bash npx syncpack list --dependency-types prod ``` -------------------------------- ### Display short summary of json command options Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/json.mdx Use the short `-h` option for a concise summary of the `json` command's options. ```bash syncpack json -h ``` -------------------------------- ### Format code with `syncpack format` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx Use `syncpack format` commands to check, preview, or apply formatting fixes. ```bash # Check if formatting needed (exit 1 if needed) syncpack format --check # Safely see what formatting fixes would look like syncpack format --dry-run # Write formatting fixes to disk syncpack format ``` -------------------------------- ### Configure Same Range Policy Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/same-range.mdx Choose the "sameRange" policy to apply this behaviour to a Version Group. This is a required configuration. ```json { "versionGroups": [ { "dependencies": ["eslint"], "policy": "sameRange" } ] } ``` -------------------------------- ### Configure a Same Minor Version Group Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/same-minor.mdx Set the policy to "sameMinor" to ensure that all dependencies within this group match the MAJOR.MINOR version number. This configuration is for the .syncpackrc.json file. ```json { "versionGroups": [ { "dependencies": ["react", "react-dom"], "policy": "sameMinor" } ] } ``` -------------------------------- ### Configure Legacy pnpm Overrides Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v15.mdx If your pnpm overrides are in `package.json` under `pnpm.overrides`, define `pnpmOverridesLegacy` in your `.syncpackrc.json` to point to the legacy location. ```json { "customTypes": { "pnpmOverridesLegacy": { "strategy": "versionsByName", "path": "pnpm.overrides" } } } ``` -------------------------------- ### Check formatting for a specific package Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/format.mdx You can specify a source file pattern with the `--source` option to check the formatting of only one package. This is helpful for targeted checks. ```bash syncpack format --check --source 'packages/pingu/package.json' ``` -------------------------------- ### Lint all dependency types Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/lint.mdx Use this command to find all version mismatches in your project's "dependencies" and "devDependencies". ```bash syncpack lint --dependency-types prod,dev ``` -------------------------------- ### Migrate `--filter` to `--dependencies` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `--filter` CLI option has been renamed to `--dependencies`. Regular expressions are no longer supported; use glob patterns instead. ```bash # v13 syncpack list-mismatches --filter "^@types/.+" # v14 syncpack lint --dependencies "@types/**" ``` -------------------------------- ### Configure Version Groups in .syncpackrc.json Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups.mdx This configuration defines two version groups: one that bans the 'underscore' dependency and another that ignores all other dependencies. Order is important; more specific rules should come before general ones. ```json { "versionGroups": [ { "label": "Please use lodash instead of underscore", "dependencies": ["underscore"], "isBanned": true }, { "label": "Ignore everything else", "isIgnored": true } ] } ``` -------------------------------- ### Lint for exact version specifiers Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/lint.mdx This command specifically looks for dependencies that are using exact version specifiers (e.g., "1.2.3"). ```bash syncpack lint --specifier-types exact ``` -------------------------------- ### Update dependencies to latest versions Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/update.mdx Accept any update in the latest (x.x.x) version range. ```bash syncpack update --target latest ``` -------------------------------- ### Configure Pinned Version Group Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/pinned.mdx Use `pinVersion` to specify the exact version for dependencies in this group. This configuration is required for pinning. ```json { "versionGroups": [ { "dependencies": ["@types/node"], "pinVersion": "18.14.2" } ] } ``` -------------------------------- ### Lint and sort dependencies by usage count Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/lint.mdx This command lints dependencies and sorts the output by how many times each dependency is used in your project. ```bash syncpack lint --sort count ``` -------------------------------- ### Format package.json files Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/format.mdx Use this command to fix every formatting issue in the monorepo. It sorts fields into a consistent order and alphabetises nested fields. ```bash syncpack format ``` -------------------------------- ### Configure Catalog Policy Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/catalog.mdx Set the policy to "catalog" to enable this behavior for a Version Group. This ensures all specified dependency types come from a catalog. ```json { "versionGroups": [ { "label": "All production deps must come from the catalog", "dependencyTypes": ["prod"], "policy": "catalog" } ] } ``` -------------------------------- ### Preview changes without modifying files Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/fix.mdx Use the `--dry-run` option to see what changes `syncpack fix` would make without actually altering any files. This is useful for verifying the command's behavior before applying it. ```bash syncpack fix --dry-run ``` -------------------------------- ### List ignored dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Use the `--show ignored` option to view dependencies that are currently being ignored according to your `syncpack` configuration. ```bash syncpack list --show ignored ``` -------------------------------- ### Configure 'version' Strategy in .syncpackrc.json Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx This configuration defines a custom type using the 'version' strategy, where only the version string is specified at a given path. The custom type's key is used as the dependency name. ```json { "customTypes": { "node": { "strategy": "version", "path": "engines.node" } } } ``` -------------------------------- ### TypeScript Configuration Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/syncpackrc.mdx Configure Syncpack using a TypeScript file. This allows for type checking and autocompletion. ```typescript export default { indent: " ", } satisfies import("syncpack").RcFile; ``` -------------------------------- ### Specify Custom Config File Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/syncpackrc.mdx Use the --config flag to specify a custom path to your syncpack configuration file. ```bash syncpack list --config ./config/syncpack.json ``` -------------------------------- ### Output dependency state as JSON Source: https://github.com/jamiemason/syncpack/blob/main/README.md Output the state of every instance of every dependency as a JSON object, one per line. This command is best used with tools like jq for filtering and processing. Use --dependencies to filter by package name. ```bash syncpack json ``` ```bash syncpack json --dependencies '@aws-sdk/**' ``` ```bash syncpack json | jq -r '.dependencyType' | sort | uniq -c ``` ```bash syncpack json --help ``` ```bash syncpack json -h ``` -------------------------------- ### List dependencies sorted by usage count Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/list.mdx Use the `--sort count` option to order dependencies based on how many times they are utilized within your monorepo. ```bash syncpack list --sort count ``` -------------------------------- ### Migrate `fix-mismatches` to `fix` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `fix-mismatches` command has been merged into the `fix` command. Formatting is now handled by `syncpack format`. ```bash # v13 syncpack fix-mismatches # v14 syncpack fix ``` -------------------------------- ### Set minimumReleaseAge to one week in .syncpackrc.json Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/minimum-release-age.mdx Sets the minimum release age to one week (10080 minutes) to delay considering newer published versions as available updates. ```json { "minimumReleaseAge": 10080 } ``` -------------------------------- ### Configure Dependency Groups in .syncpackrc.json Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/dependency-groups.mdx Use the `dependencyGroups` array to define groups of dependencies. Each object in the array specifies a list of dependencies (using glob patterns) and an `aliasName` which will be used to refer to this group. Any version differences within the listed dependencies will be flagged. ```jsonc { "dependencyGroups": [ { "dependencies": ["@aws-sdk/**"], "aliasName": "aws-sdk-dependencies", }, ], } ``` -------------------------------- ### Configure Banned Dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups/banned.mdx Activate the banned dependency behavior for a Version Group by setting `isBanned` to `true` and listing the dependencies to ban in the `dependencies` array. This configuration applies to the `.syncpackrc.json` file. ```json { "versionGroups": [ { "dependencies": ["never-gonna"], "isBanned": true } ] } ``` -------------------------------- ### Lint and List with pnpm Catalog Dependency Types Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/reference/dependency-types.mdx Use the `--dependency-types` option to lint or list dependencies specifically within pnpm catalog types. This allows for targeted management of dependencies defined in pnpm catalogs. ```bash syncpack lint --dependency-types pnpmCatalog syncpack list --dependency-types 'pnpmCatalog:react18' ``` -------------------------------- ### Migrate `list-mismatches` to `lint` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `list-mismatches` command has been merged into the `lint` command. Use `--dependency-types` instead of `--types`. ```bash # v13 syncpack list-mismatches --types prod,dev # v14 syncpack lint --dependency-types prod,dev ``` -------------------------------- ### List Dependencies by Name Pattern Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx Filter the dependency list to show only those that match a specific name pattern, such as those containing 'eslint'. This is useful for managing groups of related dependencies. ```bash syncpack list --dependencies '**eslint**' ``` -------------------------------- ### Configure 'name@version' Strategy in .syncpackrc.json Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx This configuration demonstrates how to define a custom type using the 'name@version' strategy. It specifies the path in package.json where the 'name@version' string is located, such as 'packageManager'. ```json { "customTypes": { "packageManager": { "strategy": "name@version", "path": "packageManager" } } } ``` -------------------------------- ### Configure Syncpack for Specific Dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx This configuration in `.syncpackrc.json` targets specific dependencies like 'react' and 'react-dom' for syncing in production, while ignoring others. ```json { "versionGroups": [ { "label": "Sync react dependencies only", "dependencies": ["react", "react-dom"], "dependencyTypes": ["prod"] }, { "label": "Ignore everything else", "isIgnored": true } ] } ``` -------------------------------- ### Configure Syncpack for Workspace Dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx This `.syncpackrc.json` configuration ensures that local packages within your monorepo are always referenced using the `workspace:*` protocol for both dev and prod dependencies. ```json { "versionGroups": [ { "label": "Use `workspace:*` protocol for local packages", "dependencies": ["$LOCAL"], "dependencyTypes": ["dev", "prod"], "pinVersion": "workspace:*" }, { "label": "Ignore everything else", "isIgnored": true } ] } ``` -------------------------------- ### Use `--dependency-types` for npm and pnpm overrides Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `--overrides` option now specifically refers to npm overrides. For pnpm overrides, use `--pnpmOverrides`. Both can be specified using the `--dependency-types` option. ```bash # v7 (pnpm users) syncpack list --overrides # v14 (pnpm users) syncpack list --dependency-types pnpmOverrides # v14 (npm users) syncpack list --dependency-types overrides ``` -------------------------------- ### Lint Dependencies with Errors Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx This command focuses on linting only those production dependencies that have errors, allowing you to quickly address issues. It's a more targeted approach than listing all dependencies. ```bash syncpack lint --dependency-types prod ``` -------------------------------- ### Lint dependency issues with wildcard Source: https://github.com/jamiemason/syncpack/blob/main/README.md Look for issues in dependencies whose names contain 'react'. ```bash syncpack lint --dependencies '**react**' ``` -------------------------------- ### Migrate `lint-semver-ranges` to `lint` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `lint-semver-ranges` command has been merged into the `lint` command. Semver ranges are now always checked with version mismatches. ```bash # v13 syncpack lint-semver-ranges # v14 syncpack lint ``` -------------------------------- ### Configure Source Files with Glob Patterns Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/source.mdx Use the 'source' property in your .syncpackrc.json to specify glob patterns for package.json files. This allows syncpack to find and manage packages across different directories, including nested ones. ```json { "source": ["./*/package.json", "./*/packages/*/package.json"] } ``` -------------------------------- ### Define Custom Type with 'version' Strategy Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx Configure a custom dependency type named 'prod' to manage dependencies listed under the 'dependencies' key in package.json. This type uses the 'version' strategy, meaning it focuses on the version strings themselves. ```json { "dependencies": { "pnpm": "10.10.0", "prettier": "3.5.3" } } ``` ```json { "customTypes": { "prod": { "strategy": "version", "path": "dependencies" } } } ``` -------------------------------- ### Remove `dependencyTypes` config Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `dependencyTypes` configuration option has been removed. Use `versionGroups` or the `--dependency-types` CLI option instead. ```json { // Removed in v14 "dependencyTypes": ["prod", "dev", "peer"], // Use instead "versionGroups": [ { "label": "Ignore everything except dependencies, devDependencies, and peerDependencies", "dependencies": ["!prod", "!dev", "!peer"], "isIgnored": true, }, ], } ``` ```bash syncpack lint --dependency-types prod,dev,peer ``` -------------------------------- ### Replace boolean config properties with `versionGroups` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx Individual boolean configuration properties for dependency types have been replaced by the `versionGroups` configuration. Use `versionGroups` to define rules for different dependency types. ```json // v8 { "dev": true, "overrides": false, "peer": true, "pnpmOverrides": false, "prod": true, "resolutions": false, "workspace": true } // v14 (use versionGroups instead) { "versionGroups": [ { "label": "Ignore overrides", "dependencyTypes": ["overrides", "pnpmOverrides", "resolutions"], "isIgnored": true } ] } ``` -------------------------------- ### Lint specific dependency issues Source: https://github.com/jamiemason/syncpack/blob/main/README.md Only lint issues related to the 'react' dependency. ```bash syncpack lint --dependencies react ``` -------------------------------- ### Autofix Specific Dependency Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx To autofix only a particular dependency, such as 'react', use this command. This allows for granular control over which dependencies are modified. ```bash syncpack fix --dependency-types prod --dependencies react ``` -------------------------------- ### Output specific dependencies as JSON Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/json.mdx Filter the JSON output to include only dependencies matching a specific pattern, such as all AWS SDK dependencies. ```bash syncpack json --dependencies '@aws-sdk/**' ``` -------------------------------- ### Specify Package Locations with `--source` in v14 Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx In v14, package locations are specified using the repeatable `--source` option instead of positional arguments. This allows for more flexible and explicit definition of package locations. ```bash syncpack list --source './package.json' --source './packages/*/package.json' ``` -------------------------------- ### Long form for ignoring all dependencies Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/version-groups.mdx This configuration explicitly defines a version group that ignores all dependencies by setting all relevant properties to match all possible values ('**'). ```json { "versionGroups": [ { "label": "Ignore everything", "dependencies": ["**"], "dependencyTypes": ["**"], "packages": ["**"], "specifierTypes": ["**"], "isIgnored": true } ] } ``` -------------------------------- ### Enable formatBugs Configuration Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/format-bugs.mdx Set `formatBugs` to `true` in your configuration file to enable formatting of the `bugs` field in `package.json` files. This is disabled by default. ```json { "formatBugs": false } ``` -------------------------------- ### `prompt` command removed Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The interactive `prompt` command is not yet available in v14 and will be added later. It was used for issues syncpack couldn't fix automatically. ```bash # v13 syncpack prompt # v14 # Not yet implemented ``` -------------------------------- ### Remove `lintFormatting` configuration Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `lintFormatting` option has been removed as the `lint` command no longer checks formatting. Use `syncpack format` for formatting tasks. ```json { // Removed in v14 "lintFormatting": false, } ``` -------------------------------- ### Migrate `set-semver-ranges` to `fix` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `set-semver-ranges` command has been merged into the `fix` command. Semver ranges are now always fixed with version mismatches. ```bash # v13 syncpack set-semver-ranges # v14 syncpack fix ``` -------------------------------- ### Update dependencies by exact name Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/command/update.mdx Use `--dependencies` with an exact dependency name to update only that specific package. ```bash syncpack update --dependencies 'react' ``` -------------------------------- ### Check for Dependency Updates Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/getting-started.mdx This command checks if a specific dependency, like 'react', needs updating. Use the `--check` flag to only report on potential updates without modifying files. ```bash syncpack update --check --dependencies react ``` -------------------------------- ### Define Default Dependency Types in .syncpackrc.json Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/config/custom-types.mdx This JSON configuration defines the default dependency types that Syncpack recognizes, mapping them to their respective locations within package.json files. It includes 'dev', 'local', 'overrides', 'peer', 'pnpmOverrides', 'prod', and 'resolutions'. ```json { "$schema": "./node_modules/syncpack/schema.json", "customTypes": { "dev": { "strategy": "versionsByName", "path": "devDependencies" }, "local": { "strategy": "name~version", "namePath": "name", "path": "version" }, "overrides": { "strategy": "versionsByName", "path": "overrides" }, "peer": { "strategy": "versionsByName", "path": "peerDependencies" }, "pnpmOverrides": { "strategy": "versionsByName", "path": "overrides", "source": "PnpmWorkspace" }, "prod": { "strategy": "versionsByName", "path": "dependencies" }, "resolutions": { "strategy": "versionsByName", "path": "resolutions" } } } ``` -------------------------------- ### Rename `workspace` dependency type to `local` Source: https://github.com/jamiemason/syncpack/blob/main/site/src/content/docs/guide/migrate-v14.mdx The `workspace` dependency type has been renamed to `local`. Update your commands accordingly. ```bash # v11.2.0 and earlier syncpack list --types prod,workspace # v14 syncpack lint --dependency-types prod,local ```