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

Commit

Permalink
feat: initial implementation (#1)
Browse files Browse the repository at this point in the history
* feat: initial implementation

Co-authored-by: Noah Negin-Ulster <[email protected]>
  • Loading branch information
dbasilio and Noah Negin-Ulster authored May 14, 2021
1 parent bc2ab42 commit c5ad547
Show file tree
Hide file tree
Showing 9 changed files with 398 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint",
"version": "7.19.0-pnpify",
"version": "7.26.0-pnpify",
"main": "./lib/api.js",
"type": "commonjs"
}
2 changes: 1 addition & 1 deletion .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript",
"version": "4.2.2-pnpify",
"version": "4.2.4-pnpify",
"main": "./lib/typescript.js",
"type": "commonjs"
}
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ npmRegistries:
npmAuthToken: "${NPM_PUBLISH_TOKEN:-invalid}"

yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs

plugins:
- ./bundles/@yarnpkg/plugin-semver-up.js
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,54 @@

Yarn Berry plugin to update dependencies.

## Usage

```sh
yarn semver up --config semver-up.json
```

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

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

"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:

```json
{
"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.

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

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

## Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
Expand Down
23 changes: 22 additions & 1 deletion bundles/@yarnpkg/plugin-semver-up.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@tophat/conventional-changelog-config": "^0.0.9",
"@tophat/eslint-config": "^0.7.0",
"@types/jest": "^26.0.20",
"@types/micromatch": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"@yarnpkg/builder": "^3.0.0-rc.2",
Expand Down Expand Up @@ -75,10 +76,14 @@
},
"dependencies": {
"@types/node": "^14.0.0",
"@yarnpkg/cli": "^3.0.0-rc.2",
"@yarnpkg/core": "^3.0.0-rc.2",
"@yarnpkg/fslib": "^2.5.0-rc.2",
"@yarnpkg/libzip": "^2.2.1",
"@yarnpkg/plugin-essentials": "^3.0.0-rc.2",
"@yarnpkg/plugin-npm": "^2.5.0-rc.2",
"clipanion": "^3.0.0-rc.12",
"micromatch": "^4.0.4",
"typescript": "~4.2.4"
}
}
9 changes: 9 additions & 0 deletions semver-up.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"rules": [
["@babel/*", {
"maxPackageUpdates": false,
"preserveSemVerRange": true
}]
],
"maxRulesApplied": 1
}
Loading

0 comments on commit c5ad547

Please sign in to comment.