### Syncpack Package Name Matching Examples Source: https://jamiemason.github.io/syncpack/version-groups/pinned Provides examples of how to match package names in Syncpack configurations using glob patterns, exact names, and negation. This is useful for targeting specific packages or excluding others from version management. ```javascript // ✅ match any package name packages: ["**"] ``` ```javascript // ✅ match any package name with this scope packages: ["@my-repo/**"] ``` ```javascript // ✅ match specific packages by name packages: ["my-server", "my-client"] ``` ```javascript // ✅ match all packages except negated ones packages: ["!my-server", "!@my-repo/**"] ``` ```javascript // ❌ no mixing of specific and negated packages packages: ["my-client", "!@my-repo/**"] ``` ```javascript // ❌ not file system paths, name properties of package.json files packages: ["packages/my-client"] ``` ```javascript // ❌ not file system globs, name properties of package.json files packages: ["packages/**"] ``` -------------------------------- ### Display help information with --help Source: https://jamiemason.github.io/syncpack/command/lint The --help option provides assistance by displaying a list of available CLI options and commands. Use '-h' for a short summary or '--help' for detailed information with examples. ```bash # Display a short summary of commands and options syncpack lint -h # Display full help with examples syncpack lint --help ``` -------------------------------- ### Configure Dependency Matching with Globs Source: https://jamiemason.github.io/syncpack/config/dependency-groups Demonstrates how to use glob patterns to match dependencies. The examples show matching any dependency, all dependencies within a specific scope (e.g., '@aws-sdk/**'), and specific dependencies by name. ```javascript // match any dependency dependencies: ["**"] // match all dependencies with a certain scope dependencies: ["@aws-sdk/**"] // match specific dependencies by name dependencies: ["react", "react-dom"] ``` -------------------------------- ### Syncpack 'name~version' Strategy Example Source: https://jamiemason.github.io/syncpack/config/custom-types Demonstrates the 'name~version' strategy for Syncpack custom types, where the package name and version are located in different fields within the package.json file. ```json { "name": "some-local-package", "version": "12.4.2" } ``` -------------------------------- ### Syncpack fix --config option example Source: https://jamiemason.github.io/syncpack/command/fix Shows how to specify a custom configuration file for the 'syncpack fix' command using the --config option. ```bash syncpack fix --config ./config/syncpack.json ``` -------------------------------- ### Display Syncpack CLI Help Information Source: https://jamiemason.github.io/syncpack/command/list Provides help information for the syncpack CLI. Use '-h' for a short summary of commands and options, or '--help' for full documentation with examples. ```bash # Display a short summary of commands and options syncpack list -h ``` ```bash # Display full help with examples syncpack list --help ``` -------------------------------- ### Syncpack fix --log-levels option examples Source: https://jamiemason.github.io/syncpack/command/fix Provides examples of controlling the verbosity of the log output using the --log-levels option, from turning off logging to showing all details. ```bash # Turn off logging completely syncpack fix --log-levels off # Only show verbose debugging logs syncpack fix --log-levels debug # Show everything syncpack fix --log-levels error,warn,info,debug ``` -------------------------------- ### Syncpack Configuration in JSON Source: https://jamiemason.github.io/syncpack/config/syncpackrc Provides an example of a Syncpack configuration file in JSON format. This is the preferred format for its speed and lack of Node.js overhead. It shows how to set the 'indent' property. ```json { "$schema": "./node_modules/syncpack/dist/schema.json", "indent": " " } ``` -------------------------------- ### Syncpack fix --dry-run option example Source: https://jamiemason.github.io/syncpack/command/fix Shows the usage of the --dry-run option to preview changes without modifying any files. ```bash syncpack fix --dry-run ``` -------------------------------- ### Install Syncpack v14 Alpha Source: https://jamiemason.github.io/syncpack/guide/migrate-v14 Installs the alpha version of Syncpack using npm. This command is used to get the latest development version for testing. ```bash npm install --save-dev syncpack@alpha ``` -------------------------------- ### Syncpack Update Command Examples Source: https://jamiemason.github.io/syncpack/command/update Demonstrates various ways to use the 'syncpack update' command to manage dependencies. It shows how to target specific version types, filter by dependency names and types, and use flags like '--check' and '--dry-run'. ```bash # Accept any update in latest (x.x.x) syncpack update --target latest # Only update minor versions (1.x.x) syncpack update --target minor # Only update patch versions (1.2.x) syncpack update --target patch # Check for outdated dependencies in one package syncpack update --check --source 'packages/pingu/package.json' # Update dependencies and devDependencies in the whole monorepo syncpack update --dependency-types dev,prod # Only update dependencies with a semver range specifier (^, ~, etc.) syncpack update --specifier-types range # Update dependencies where name exactly matches 'react' syncpack update --dependencies 'react' # Update dependencies where name contains 'react' syncpack update --dependencies '**react**' # Update dependencies with the '@aws-sdk' scope syncpack update --dependencies '@aws-sdk/**' # See more examples syncpack update --help # See a short summary of options syncpack update -h ``` -------------------------------- ### Configure Package Matching with Globs Source: https://jamiemason.github.io/syncpack/config/dependency-groups Illustrates how to use glob patterns to match package names in your `package.json` files. Examples include matching any package, packages within a scope, specific packages, and excluding certain packages. ```javascript // ✅ match any package name packages: ["**"] // ✅ match any package name with this scope packages: ["@my-repo/**"] // ✅ match specific packages by name packages: ["my-server", "my-client"] // ✅ match all packages except negated ones packages: ["!my-server", "!@my-repo/**] // ❌ no mixing of specific and negated packages packages: ["my-client", "!@my-repo/**"] // ❌ not file system paths, name properties of package.json files packages: ["packages/my-client"] // ❌ not file system globs, name properties of package.json files packages: ["packages/**"] ``` -------------------------------- ### Syncpack 'versionsByName' Strategy Example Source: https://jamiemason.github.io/syncpack/config/custom-types Shows the 'versionsByName' strategy for Syncpack custom types, which is typical for dependency objects where package names are keys and version strings are values. ```json { "pnpm": "10.10.0", "prettier": "3.5.3" } ``` -------------------------------- ### Syncpack fix command examples Source: https://jamiemason.github.io/syncpack/command/fix Demonstrates various ways to use the 'syncpack fix' command for different scenarios like dry runs, specific dependency types, exact versions, and targeting specific packages. ```bash syncpack fix --dry-run syncpack fix --dependency-types prod,dev syncpack fix --specifier-types exact syncpack fix --dependencies react syncpack fix --dependencies '@types/**' syncpack fix --help syncpack fix -h ``` -------------------------------- ### Syncpack fix --show option examples Source: https://jamiemason.github.io/syncpack/command/fix Illustrates how to control the detail level of information displayed in the terminal output using the --show option, such as showing instances, hints, or statuses. ```bash # Only opt into showing status codes syncpack fix --show statuses # Show all instances, not just their names syncpack fix --show instances # Show highest level of detail syncpack fix --show all # Show lowest level of detail syncpack fix --show none ``` -------------------------------- ### Syncpack fix --dependencies option examples Source: https://jamiemason.github.io/syncpack/command/fix Illustrates how to use the --dependencies option with glob patterns to include or exclude specific dependencies, including scoped packages and multiple dependencies. ```bash # Exact match for "react" syncpack fix --dependencies 'react' # Substring match for "react" syncpack fix --dependencies '**react**' # All dependencies under the AWS SDK scope syncpack fix --dependencies '@aws-sdk/**' # Exact match for "react" or "webpack" (2 approaches) syncpack fix --dependencies 'react' --dependencies 'webpack' syncpack fix --dependencies '{react,webpack}' # Substring match for "react" or "webpack" (2 approaches) syncpack fix --dependencies '**react**' --dependencies '**webpack**' syncpack fix --dependencies '**{react,webpack}**' ``` -------------------------------- ### Syncpack fix --sort option examples Source: https://jamiemason.github.io/syncpack/command/fix Shows how to change the order in which dependencies are displayed using the --sort option, such as sorting by count or name. ```bash # Sort by count, in descending order syncpack fix --sort count # Sort A-Z by name syncpack fix --sort name ``` -------------------------------- ### Syncpack Update --dependencies Option Examples Source: https://jamiemason.github.io/syncpack/command/update Illustrates how to use the --dependencies option with glob patterns to filter which dependencies are considered for updates. It covers exact matches, substring matches, scope-based matching, and using multiple --dependencies flags or brace expansion for OR conditions. ```bash # Exact match for "react" syncpack update --dependencies 'react' # Substring match for "react" syncpack update --dependencies '**react**' # All dependencies under the AWS SDK scope syncpack update --dependencies '@aws-sdk/**' # Exact match for "react" or "webpack" (2 approaches) syncpack update --dependencies 'react' --dependencies 'webpack' syncpack update --dependencies '{react,webpack}' # Substring match for "react" or "webpack" (2 approaches) syncpack update --dependencies '**react**' --dependencies '**webpack**' syncpack update --dependencies '**{react,webpack}**' ``` -------------------------------- ### Display Help Information with -h and --help Source: https://jamiemason.github.io/syncpack/command/fix The -h and --help options provide access to Syncpack's command-line help. Use -h for a concise summary of commands and options, and --help for detailed information including examples of usage. ```bash syncpack fix -h syncpack fix --help ``` -------------------------------- ### Display Help Information with --help Source: https://jamiemason.github.io/syncpack/command/update The --help option provides assistance for using the Syncpack CLI. You can use the short form (-h) to display a summary of commands and options, or the full --help flag for more detailed information, including examples. ```bash # Display a short summary of commands and options syncpack update -h # Display full help with examples syncpack update --help ``` -------------------------------- ### Syncpack --help Option Source: https://jamiemason.github.io/syncpack/command/fix The `--help` option displays information about Syncpack's commands and options. You can use `-h` for a short summary or `--help` for full details with examples. ```APIDOC ## --help ### Description Display a list of CLI options and other help information. ### Method CLI Command ### Endpoint N/A (CLI Option) ### Parameters #### Query Parameters - **-h** (boolean) - Optional - Display a short summary of commands and options. - **--help** (boolean) - Optional - Display full help with examples. ### Request Example ```bash # Display a short summary of commands and options syncpack fix -h # Display full help with examples syncpack fix --help ``` ### Response N/A (CLI Operation) ``` -------------------------------- ### Sort Dependency List Output Source: https://jamiemason.github.io/syncpack/command/list Explains how to change the order of the dependency list using the '--sort' option. It provides examples for sorting by the count of usage and alphabetically by name. ```bash # Sort by count, in descending order syncpack list --sort count # Sort A-Z by name syncpack list --sort name ``` -------------------------------- ### Syncpack Lint: Dependency Name Patterns Source: https://jamiemason.github.io/syncpack/command/lint Provides examples of using glob patterns with the --dependencies option to match specific dependencies, including exact matches, substring matches, and matching dependencies within a scope. It also demonstrates alternative syntaxes for matching multiple dependencies. ```bash # Exact match for "react" syncpack lint --dependencies 'react' # Substring match for "react" syncpack lint --dependencies '**react**' # All dependencies under the AWS SDK scope syncpack lint --dependencies '@aws-sdk/**' # Exact match for "react" or "webpack" (2 approaches) syncpack lint --dependencies 'react' --dependencies 'webpack' syncpack lint --dependencies '{react,webpack}' # Substring match for "react" or "webpack" (2 approaches) syncpack lint --dependencies '**react**' --dependencies '**webpack**' syncpack lint --dependencies '**{react,webpack}**' ``` -------------------------------- ### Example package.json for Package Naming Source: https://jamiemason.github.io/syncpack/config/dependency-groups This JSON snippet shows a minimal `package.json` structure focusing on the `name` and `version` fields. This is relevant when configuring package matching in syncpack, where the `name` property is used to identify specific packages. ```json { "name": "HERE", "version": "1.0.2" } ``` -------------------------------- ### Match Packages by Name and Scope (JavaScript) Source: https://jamiemason.github.io/syncpack/semver-groups/with-range This JavaScript snippet demonstrates how to match packages based on their names using glob patterns. It includes examples for matching any package, packages within a scope, specific packages, and excluding packages. ```javascript // ✅ match any package name packages: ["**"] // ✅ match any package name with this scope packages: ["@my-repo/**"] // ✅ match specific packages by name packages: ["my-server", "my-client"] // ✅ match all packages except negated ones packages: ["!my-server", "!@my-repo/**] // ❌ no mixing of specific and negated packages packages: ["my-client", "!@my-repo/**"] // ❌ not file system paths, name properties of package.json files packages: ["packages/my-client"] // ❌ not file system globs, name properties of package.json files packages: ["packages/**"] ``` -------------------------------- ### Syncpack fix --dependency-types option examples Source: https://jamiemason.github.io/syncpack/command/fix Demonstrates using the --dependency-types option to filter which dependency types (e.g., prod, dev, peer) are included or excluded from the fix operation. ```bash # devDependencies only syncpack fix --dependency-types dev # dependencies and devDependencies only syncpack fix --dependency-types dev,prod # everything except peerDependencies syncpack fix --dependency-types '!peer' ``` -------------------------------- ### Example package.json Structure for Versioning Source: https://jamiemason.github.io/syncpack/config/dependency-groups This JSON structure represents a `package.json` file, highlighting various fields where dependency versions can be defined or overridden. It includes common sections like `dependencies`, `devDependencies`, `overrides`, and `resolutions`. ```json { "name": "HERE", "dependencies": { "HERE": "0.0.0" }, "devDependencies": { "HERE": "0.0.0" }, "overrides": { "HERE": "0.0.0" }, "peerDependencies": { "HERE": "0.0.0" }, "pnpm": { "overrides": { "HERE": "0.0.0" } }, "resolutions": { "HERE": "0.0.0" } } ``` -------------------------------- ### Syncpack Configuration in TypeScript Source: https://jamiemason.github.io/syncpack/config/syncpackrc Shows how to define Syncpack configuration using TypeScript. This example exports a default object that satisfies the Syncpack RcFile type, setting the 'indent' property. ```typescript export default { indent: " ", } satisfies import("syncpack").RcFile; ``` -------------------------------- ### Define Package Matching Patterns Source: https://jamiemason.github.io/syncpack/version-groups/same-minor These examples show how to specify which packages should be included in a version group using exact names or glob patterns for the 'packages' property. It also demonstrates valid and invalid combinations of negated and specific package matching. ```javascript // ✅ match any package name packages: ["**"] ``` ```javascript // ✅ match any package name with this scope packages: ["@my-repo/**"] ``` ```javascript // ✅ match specific packages by name packages: ["my-server", "my-client"] ``` ```javascript // ✅ match all packages except negated ones packages: ["!my-server", "!@my-repo/**] ``` ```javascript // ❌ no mixing of specific and negated packages packages: ["my-client", "!@my-repo/**"] ``` ```javascript // ❌ not file system paths, name properties of package.json files packages: ["packages/my-client"] ``` ```javascript // ❌ not file system globs, name properties of package.json files packages: ["packages/**"] ``` -------------------------------- ### Syncpack 'name@version' Strategy Example Source: https://jamiemason.github.io/syncpack/config/custom-types Illustrates the 'name@version' strategy for Syncpack custom types, where package name and version are combined in a single string. This is commonly found in package manager specifications. ```json { "packageManager": "pnpm@7.27.0" } ``` -------------------------------- ### Syncpack Lint: Dependency Types Filtering Source: https://jamiemason.github.io/syncpack/command/lint Demonstrates how to filter dependencies based on their type (e.g., 'dev', 'prod') using the --dependency-types option. It includes examples for selecting specific types, multiple types, and excluding certain types. ```bash # devDependencies only syncpack lint --dependency-types dev # dependencies and devDependencies only syncpack lint --dependency-types dev,prod # everything except peerDependencies syncpack lint --dependency-types '!peer' ``` -------------------------------- ### Match Dependencies by Name and Scope (JavaScript) Source: https://jamiemason.github.io/syncpack/semver-groups/with-range This JavaScript snippet illustrates how to specify dependencies to be included in a semver group. It shows examples of matching all dependencies, dependencies within a specific scope (e.g., '@aws-sdk/**'), and specific dependency names. ```javascript // match any dependency dependencies: ["**"] // match all dependencies with a certain scope dependencies: ["@aws-sdk/**"] // match specific dependencies by name dependencies: ["react", "react-dom"] ``` -------------------------------- ### Syncpack Update --dependency-types Option Examples Source: https://jamiemason.github.io/syncpack/command/update Shows how to use the --dependency-types option to include or exclude specific types of dependencies (e.g., devDependencies, peerDependencies). You can specify a comma-separated list or use a '!' prefix to exclude types. ```bash # devDependencies only syncpack update --dependency-types dev # dependencies and devDependencies only syncpack update --dependency-types dev,prod # everything except peerDependencies syncpack update --dependency-types '!peer' ``` -------------------------------- ### Syncpack Update --log-levels Option Examples Source: https://jamiemason.github.io/syncpack/command/update Demonstrates how to control the verbosity of syncpack's output using the --log-levels option. You can specify which levels of logs (info, warn, error, debug) to display, or turn logging off completely. ```bash # Turn off logging completely syncpack update --log-levels off # Only show verbose debugging logs syncpack update --log-levels debug # Show everything syncpack update --log-levels error,warn,info,debug ``` -------------------------------- ### Control log output levels for syncpack format Source: https://jamiemason.github.io/syncpack/command/format Manage the verbosity of syncpack's log output. Options include 'info' (standard UI output), 'warn' (setup mistakes), 'error' (fatal exceptions), and 'debug' (verbose detail). Logging can be turned off completely with 'off'. ```bash # Turn off logging completely syncpack format --log-levels off # Only show verbose debugging logs syncpack format --log-levels debug # Show everything syncpack format --log-levels error,warn,info,debug ``` -------------------------------- ### Syncpack Lint: Log Levels Control Source: https://jamiemason.github.io/syncpack/command/lint Shows how to manage the verbosity of the 'syncpack lint' output using the --log-levels option. Examples include turning off logging, enabling only debug logs, and displaying all log levels. ```bash # Turn off logging completely syncpack lint --log-levels off # Only show verbose debugging logs syncpack lint --log-levels debug # Show everything syncpack lint --log-levels error,warn,info,debug ``` -------------------------------- ### List Dependencies with Various Filters and Options Source: https://jamiemason.github.io/syncpack/command/list Demonstrates how to use the 'syncpack list' command with different flags to customize output. This includes sorting by usage count, showing detailed instances, filtering ignored dependencies, specifying dependency types, and using glob patterns for dependency names. ```bash syncpack list --sort count syncpack list --show instances syncpack list --show ignored syncpack list --show all syncpack list --show hints,statuses syncpack list --dependency-types peer syncpack list --dependencies '@types/**' syncpack list --specifier-types exact --show instances --dependency-types peer syncpack list --help syncpack list -h ``` -------------------------------- ### Syncpack Lint: Configuration File and Help Source: https://jamiemason.github.io/syncpack/command/lint Shows how to specify a custom configuration file for 'syncpack lint' and how to access help information for the command and its options. ```bash syncpack lint --config ./config/syncpack.json syncpack lint --help syncpack lint -h ``` -------------------------------- ### Control Detail Level with --show Option Source: https://jamiemason.github.io/syncpack/command/list Demonstrates the basic usage of the '--show' option, which controls the level of detail displayed in the output. Further customization can be achieved by providing specific detail names. ```bash syncpack list --show ``` -------------------------------- ### Syncpack fix --no-ansi option example Source: https://jamiemason.github.io/syncpack/command/fix Demonstrates how to disable ANSI escape codes for color and hyperlinks in the terminal output using the --no-ansi option. ```bash syncpack fix --no-ansi ``` -------------------------------- ### Syncpack Lint: Basic Usage and Filtering Source: https://jamiemason.github.io/syncpack/command/lint Demonstrates fundamental ways to use the 'syncpack lint' command, including specifying dependency types, targeting specific dependencies by name or pattern, and excluding certain dependency types. It also shows how to use glob patterns for scoped packages. ```bash syncpack lint --dependency-types prod,dev syncpack lint --dependencies react syncpack lint --dependencies '**react**' syncpack lint --dependencies '@types/**' syncpack lint --dependency-types '!peer' ``` -------------------------------- ### Filter Dependencies by Type Source: https://jamiemason.github.io/syncpack/command/list Demonstrates how to use the '--dependency-types' option to include or exclude specific types of dependencies (e.g., 'dev', 'prod', 'peer'). It shows how to select multiple types or exclude specific ones. ```bash # devDependencies only syncpack list --dependency-types dev # dependencies and devDependencies only syncpack list --dependency-types dev,prod # everything except peerDependencies syncpack list --dependency-types '!peer' ``` -------------------------------- ### Configure Version Groups with snapTo Source: https://jamiemason.github.io/syncpack/version-groups/snapped-to This configuration snippet demonstrates how to define version groups where dependencies are pinned to follow specific packages. The `snapTo` array lists packages whose versions will be used as the reference for the dependencies in the group. This is useful for ensuring that core libraries like React and React Native are consistently versioned across your monorepo. ```json { "versionGroups": [ { "dependencies": ["react", "react-native"], "snapTo": ["mobile-app"] } ] } ``` -------------------------------- ### Syncpack Lint: Controlling Output Details Source: https://jamiemason.github.io/syncpack/command/lint Illustrates how to customize the information displayed in the terminal output using the --show option. This includes options to display dependency instances, development hints, status codes, or to show all or no details. ```bash # Only opt into showing status codes syncpack lint --show statuses # Show all instances, not just their names syncpack lint --show instances # Show highest level of detail syncpack lint --show all # Show lowest level of detail syncpack lint --show none ``` -------------------------------- ### Filter Dependencies by Name Pattern Source: https://jamiemason.github.io/syncpack/command/list Illustrates using the '--dependencies' option with glob patterns to include or exclude specific dependencies. It covers exact matches, substring matches, scoped packages, and using OR logic for multiple dependency names. ```bash # Exact match for "react" syncpack list --dependencies 'react' # Substring match for "react" syncpack list --dependencies '**react**' # All dependencies under the AWS SDK scope syncpack list --dependencies '@aws-sdk/**' # Exact match for "react" or "webpack" (2 approaches) syncpack list --dependencies 'react' --dependencies 'webpack' syncpack list --dependencies '{react,webpack}' # Substring match for "react" or "webpack" (2 approaches) syncpack list --dependencies '**react**' --dependencies '**webpack**' syncpack list --dependencies '**{react,webpack}**' ``` -------------------------------- ### Configure package.json field order with sortFirst (JSON) Source: https://jamiemason.github.io/syncpack/config/sort-first The 'sortFirst' configuration option in syncpack's package.json determines the order of specific fields that will appear at the top of the file when using the 'format' command. This example shows the default order. ```json { "sortFirst": ["name", "description", "version", "author"] } ``` -------------------------------- ### Syncpack Lint: Version Specifier Types and Sorting Source: https://jamiemason.github.io/syncpack/command/lint Illustrates how to use 'syncpack lint' to enforce specific version specifier types (e.g., exact versions) and how to sort the dependency output based on criteria like usage count or name. ```bash syncpack lint --specifier-types exact syncpack lint --sort count syncpack lint --sort name ``` -------------------------------- ### Configure sortAz for Alphabetical Sorting in package.json Source: https://jamiemason.github.io/syncpack/config/sort-az The sortAz configuration option in Syncpack determines which fields within package.json files are sorted alphabetically. When a field's value is an object, its keys are sorted. When it's an array, its values are sorted. This example shows a common default configuration. ```json { "sortAz": [ "bin", "contributors", "dependencies", "devDependencies", "keywords", "peerDependencies", "resolutions", "scripts" ] } ``` -------------------------------- ### Syncpack Update --help Source: https://jamiemason.github.io/syncpack/command/update Displays CLI options and help information for the `syncpack update` command. ```APIDOC ## GET /syncpack/update/help ### Description Display a list of CLI options and other help information for the `syncpack update` command. ### Method GET ### Endpoint /syncpack/update/help ### Parameters #### Query Parameters - **full** (boolean) - Optional - If true, displays full help with examples. Defaults to false for a short summary. ### Response #### Success Response (200) - **helpText** (string) - The help information text. #### Response Example ```json { "helpText": "Usage: syncpack update [options]\n\nOptions:\n -h, --help Output usage information\n --source <...> Only run syncpack update on package.json files matching the provided pattern(s).\n --specifier-types <...> Include only instances whose version specifiers are of the given specifier types.\n --target <...> Limit updates to only those within the given semver portion.\n ..." } ``` ``` -------------------------------- ### Filter Packages with --source CLI Option Source: https://jamiemason.github.io/syncpack/command/update The --source option allows you to specify glob patterns to filter which package.json files Syncpack operates on. It checks for matches in a specific order of precedence, starting with CLI options, then configuration files, workspace definitions, and finally defaults. This enables precise control over the scope of Syncpack operations. ```bash # only the root package syncpack update --source 'package.json' # only packages matching a glob syncpack update --source 'packages/beta-*' # multiple values can be provided syncpack update --source 'package.json' --source 'packages/beta-*' ``` -------------------------------- ### Configure formatRepository Default Value Source: https://jamiemason.github.io/syncpack/config/format-repository Demonstrates the default configuration for the formatRepository setting. This setting is a boolean value that defaults to false, meaning the 'repository' field in package.json will not be formatted into a shorthand format by default when using the 'format' command. ```json { "formatRepository": false } ``` -------------------------------- ### List Packages by Source Glob Pattern Source: https://jamiemason.github.io/syncpack/command/list Lists packages that match a specified glob pattern. Multiple source patterns can be provided to include packages from different locations. ```bash syncpack list --source 'packages/beta-*' ``` ```bash syncpack list --source 'package.json' --source 'packages/beta-*' ``` -------------------------------- ### Control Log Verbosity with Log Levels Source: https://jamiemason.github.io/syncpack/command/list Explains how to manage the detail level of the output using the '--log-levels' option. This allows users to see everything from errors to verbose debug information, or to turn logging off completely. ```bash # Turn off logging completely syncpack list --log-levels off # Only show verbose debugging logs syncpack list --log-levels debug # Show everything syncpack list --log-levels error,warn,info,debug ``` -------------------------------- ### Syncpack Configuration in JavaScript Source: https://jamiemason.github.io/syncpack/config/syncpackrc Illustrates how to configure Syncpack using a JavaScript file. It includes JSDoc type checking and exports a configuration object with the 'indent' property set. ```javascript // @ts-check /** @type {import("syncpack").RcFile} */ const config = { indent: " ", }; module.exports = config; ``` -------------------------------- ### Specify Package Sources with --source in Syncpack v14 Source: https://jamiemason.github.io/syncpack/guide/migrate-v14 This command demonstrates the updated syntax for specifying package locations using the repeatable `--source` option in Syncpack v14. This replaces the older method of using positional arguments for package.json files. ```bash # v14 syncpack list --source './package.json' --source './packages/*/package.json' ``` -------------------------------- ### Specify Custom Syncpack Configuration File Path Source: https://jamiemason.github.io/syncpack/config/syncpackrc Demonstrates how to specify a custom configuration file path for Syncpack using the --config flag. This allows users to define the location and name of their configuration file. ```bash syncpack list --config ./config/syncpack.json ``` -------------------------------- ### Configure Version Group Pinning in Syncpack Source: https://jamiemason.github.io/syncpack/version-groups/pinned This configuration snippet demonstrates how to set up a version group in Syncpack to pin the version of specified dependencies. It requires the 'versionGroups' array and the 'pinVersion' property to define the target version. ```json { "versionGroups": [ { "dependencies": ["@types/node"], "pinVersion": "18.14.2" } ] } ``` -------------------------------- ### Configure Semver Groups with Dependency Ranges (JSON) Source: https://jamiemason.github.io/syncpack/semver-groups/with-range This JSON configuration snippet demonstrates how to define semver groups. It specifies an array of dependency patterns and the desired semver range ('~' in this case) to be applied to them. ```json { "semverGroups": [ { "dependencies": ["@alpha/**"], "range": "~" } ] } ``` -------------------------------- ### Perform formatting checks and fixes with Syncpack CLI Source: https://jamiemason.github.io/syncpack/guide/migrate-v14 Use `syncpack format` commands to check for formatting issues (`--check`), preview fixes (`--dry-run`), or apply fixes directly to disk. ```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 ``` -------------------------------- ### Default Value Configuration (JSON) Source: https://jamiemason.github.io/syncpack/config/strict This snippet shows the default configuration for the 'strict' setting, which is set to false. This configuration is likely used to control strict mode behavior within the project. ```json { "strict": false } ``` -------------------------------- ### Specify Source Files for Syncpack List Source: https://jamiemason.github.io/syncpack/command/list Details how to use the '--source' option to limit the 'syncpack list' command to specific 'package.json' files matching provided glob patterns. It outlines the precedence order for determining source files. ```bash # only the root package syncpack list --source 'package.json' ``` -------------------------------- ### Syncpack Command Line Filtering with Dependency Types Source: https://jamiemason.github.io/syncpack/dependency-types Demonstrates how to use the `--dependency-types` option in the Syncpack CLI to filter dependencies. This allows targeting specific dependency types like 'prod' and 'dev', or excluding types like 'peer'. ```bash # Only check production dependencies syncpack lint --dependency-types prod # Check both production and development dependencies syncpack lint --dependency-types prod,dev # Check everything except peer dependencies syncpack lint --dependency-types '!peer' ``` -------------------------------- ### Format package.json files in a monorepo Source: https://jamiemason.github.io/syncpack/command/format This command formats package.json files in a monorepo, sorting fields into a consistent order and alphabetizing nested fields. It ensures readable, diff-friendly package.json files without altering version numbers. Use `--check` to lint formatting issues without making changes. ```bash syncpack format syncpack format --check syncpack format --check --source 'packages/pingu/package.json' syncpack format --help syncpack format -h ```