Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Latest commit

 

History

History
106 lines (78 loc) · 3.95 KB

README.md

File metadata and controls

106 lines (78 loc) · 3.95 KB

yarn-plugin-semver-up

Discord

Yarn Berry plugin to update dependencies.

Installation

yarn plugin import https://raw.githubusercontent.com/tophat/yarn-plugin-semver-up/master/bundles/%40yarnpkg/plugin-semver-up.js

Usage

yarn semver up --config semver-up.json

Define a semver-up.json config file like so:

{
    "rules": [
        ["@babel/*", {
            "maxPackageUpdates": false,
            "preserveSemVerRange": true
        }]
    ],
    "maxRulesApplied": 1,
    "skipManifestOnlyChanges": false
}

"rules" takes an array of tuples of the form [Package Name Glob, Config]. You can set a default rule group via a wildcard like so:

{
    "rules": [
        ["@babel/*", {
            "preserveSemVerRange": false
        }],
        ["*", {
            "preserveSemVerRange": true
        }],
    ],
    "maxRulesApplied": 1
}

The rules are ordered by precedence. The first rule that matches is used when grouping packages.

If you set maxPackageUpdates for a group, you can limit the number of packages within that group that are allowed to be updated. It defaults to "false" which means no limit.

If you set maxRulesApplied, you can limit how many groups to update. It defaults to 1 with the idea that we want to keep pull requests constrainted to related dependencies. You can disable it by setting maxRulesApplied to false, thus removing the limit.

If you set skipManifestOnlyChanges to true, changes that would only raise the version in the package.json but not the yarn.lock (because the resolved version has already been updated), will be skipped.

You can use dry run mode to not commit changes to the package.jsons.

yarn semver up --config semver-up.json --dry-run

You can specify a changeset output file that'll output what's been changed.

yarn semver up --config semver-up.json --changeset out.json

Use - to output the changeset to stdout:

yarn semver up --config semver-up.json --changeset=-

If you don't specify a semver-up, you can pass rule globs into the command line. This overrides the config.

yarn semver up --dry-run --no-preserve-semver "react*" "@babel/*"

Contributors

Daniel Basilio
Daniel Basilio

🤔 💻
Noah
Noah

💻 🚇
Marc Cataford
Marc Cataford

🚇 🚧

To add a contributor to the README, signal the all-contributors bot by adding comments in your PRs like so:

@all-contributors please add <username> for <contribution type>