Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
generated from tophat/new-project-kit

Yarn plugin to update dependencies while respecting range restrictions

License

Notifications You must be signed in to change notification settings

tophat/yarn-plugin-semver-up

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0989086 Β· Nov 9, 2023

History

21 Commits
Nov 9, 2023
May 13, 2021
May 13, 2021
Nov 9, 2023
Nov 9, 2023
Jul 30, 2021
Nov 9, 2023
May 13, 2021
Mar 28, 2023
May 13, 2021
Nov 9, 2023
Nov 9, 2023
May 13, 2021
May 13, 2021
Mar 28, 2023
Nov 9, 2023
May 13, 2021
May 13, 2021
Mar 28, 2023
May 13, 2021
Jun 17, 2022
Jun 17, 2022
Nov 9, 2023
May 14, 2021
Nov 9, 2023
Nov 9, 2023
Nov 9, 2023

Repository files navigation

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>