Skip to content

Commit

Permalink
fix: make prerelease config switch versioning strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Nov 28, 2023
1 parent 26c9641 commit c963541
Show file tree
Hide file tree
Showing 4 changed files with 373 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/release/release-please.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
const RP = require('release-please')
const {
DefaultVersioningStrategy,
} = require('release-please/build/src/versioning-strategies/default.js')
const {
PrereleaseVersioningStrategy,
} = require('release-please/build/src/versioning-strategies/prerelease.js')
const { ROOT_PROJECT_PATH } = require('release-please/build/src/manifest.js')
const { CheckpointLogger, logger } = require('release-please/build/src/util/logger.js')
const assert = require('assert')
Expand Down Expand Up @@ -60,6 +66,8 @@ class ReleasePlease {
async init () {
RP.registerChangelogNotes('default', ({ github, ...o }) =>
new ChangelogNotes(github, o))
RP.registerVersioningStrategy('default', (o) =>
o.prerelease ? new PrereleaseVersioningStrategy(o) : new DefaultVersioningStrategy(o))
RP.registerPlugin('node-workspace', ({ github, targetBranch, repositoryConfig, ...o }) =>
new NodeWorkspace(github, targetBranch, repositoryConfig, o))
RP.registerPlugin('node-workspace-format', ({ github, targetBranch, repositoryConfig, ...o }) =>
Expand Down
352 changes: 352 additions & 0 deletions tap-snapshots/test/release/release-please-cases-prerelease.js.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,352 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/release/release-please.js TAP cases prerelease > pr feat!: update all packages 1`] = `
Object {
"baseBranchName": "template-oss-mock-testing-branch-do-not-delete",
"body": String(
:robot: I have created a release *beep* *boop*
---
<details><summary>2013.0.0-pre</summary>
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/v2012.0.4...v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
### Dependencies
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg6-v2013.0.0-pre): \`@npmcli/pkg6@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg1-v2013.0.0-pre): \`pkg1@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg2-v2013.0.0-pre): \`pkg2@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg4-v2013.0.0-pre): \`pkg4@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg5-v2013.0.0-pre): \`pkg5@2013.0.0-pre\`
</details>
<details><summary>pkg1: 2013.0.0-pre</summary>
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg1-v2012.0.4...pkg1-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
### Dependencies
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg2-v2013.0.0-pre): \`pkg2@2013.0.0-pre\`
</details>
<details><summary>pkg2: 2013.0.0-pre</summary>
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg2-v2012.0.4...pkg2-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
### Dependencies
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg3-v2013.0.0-pre): \`@npmcli/pkg3@2013.0.0-pre\`
</details>
<details><summary>pkg3: 2013.0.0-pre</summary>
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg3-v2012.0.4...pkg3-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
</details>
<details><summary>pkg5: 2013.0.0-pre</summary>
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg5-v2012.0.2...pkg5-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
</details>
<details><summary>pkg4: 2013.0.0-pre</summary>
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg4-v2012.0.2...pkg4-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
</details>
<details><summary>pkg6: 2013.0.0-pre</summary>
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg6-v2012.0.2...pkg6-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
</details>
---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
),
"files": Array [],
"headBranchName": "release-please--branches--template-oss-mock-testing-branch-do-not-delete",
"labels": Array [
"autorelease: pending",
],
"number": 252,
"sha": "f234d8c51db0f508dddd009f649a3bae9bbd0868",
"title": "chore: release 2013.0.0-pre",
}
`

exports[`test/release/release-please.js TAP cases prerelease > releases prerelease all 1`] = `
Array [
Object {
"draft": false,
"id": 131825078,
"major": 2013,
"minor": 0,
"name": "v2013.0.0-pre",
"notes": String(
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/v2012.0.4...v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
### Dependencies
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg6-v2013.0.0-pre): \`@npmcli/pkg6@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg1-v2013.0.0-pre): \`pkg1@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg2-v2013.0.0-pre): \`pkg2@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg4-v2013.0.0-pre): \`pkg4@2013.0.0-pre\`
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg5-v2013.0.0-pre): \`pkg5@2013.0.0-pre\`
),
"patch": 0,
"path": ".",
"pkgName": "npm-cli-release-please",
"prNumber": 252,
"publishTag": "prerelease-2013",
"sha": "513b3571193a864bedb98a926208a73717b25752",
"tagName": "v2013.0.0-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/131825078/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/v2013.0.0-pre",
"version": "2013.0.0-pre",
},
Object {
"draft": false,
"id": 131825083,
"major": 2013,
"minor": 0,
"name": "pkg1: v2013.0.0-pre",
"notes": String(
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg1-v2012.0.4...pkg1-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
### Dependencies
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg2-v2013.0.0-pre): \`pkg2@2013.0.0-pre\`
),
"patch": 0,
"path": "pkg1",
"pkgName": "pkg1",
"prNumber": 252,
"publishTag": "prerelease-2013",
"sha": "513b3571193a864bedb98a926208a73717b25752",
"tagName": "pkg1-v2013.0.0-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/131825083/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/pkg1-v2013.0.0-pre",
"version": "2013.0.0-pre",
},
Object {
"draft": false,
"id": 131825087,
"major": 2013,
"minor": 0,
"name": "pkg2: v2013.0.0-pre",
"notes": String(
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg2-v2012.0.4...pkg2-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
### Dependencies
* [workspace](https://github.com/npm/npm-cli-release-please/releases/tag/pkg3-v2013.0.0-pre): \`@npmcli/pkg3@2013.0.0-pre\`
),
"patch": 0,
"path": "pkg2",
"pkgName": "pkg2",
"prNumber": 252,
"publishTag": "prerelease-2013",
"sha": "513b3571193a864bedb98a926208a73717b25752",
"tagName": "pkg2-v2013.0.0-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/131825087/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/pkg2-v2013.0.0-pre",
"version": "2013.0.0-pre",
},
Object {
"draft": false,
"id": 131825090,
"major": 2013,
"minor": 0,
"name": "pkg3: v2013.0.0-pre",
"notes": String(
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg3-v2012.0.4...pkg3-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
),
"patch": 0,
"path": "pkg3",
"pkgName": "@npmcli/pkg3",
"prNumber": 252,
"publishTag": "prerelease-2013",
"sha": "513b3571193a864bedb98a926208a73717b25752",
"tagName": "pkg3-v2013.0.0-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/131825090/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/pkg3-v2013.0.0-pre",
"version": "2013.0.0-pre",
},
Object {
"draft": false,
"id": 131825091,
"major": 2013,
"minor": 0,
"name": "pkg5: v2013.0.0-pre",
"notes": String(
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg5-v2012.0.2...pkg5-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
),
"patch": 0,
"path": "workspaces/arbitrary-name",
"pkgName": "pkg5",
"prNumber": 252,
"publishTag": "prerelease-2013",
"sha": "513b3571193a864bedb98a926208a73717b25752",
"tagName": "pkg5-v2013.0.0-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/131825091/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/pkg5-v2013.0.0-pre",
"version": "2013.0.0-pre",
},
Object {
"draft": false,
"id": 131825093,
"major": 2013,
"minor": 0,
"name": "pkg4: v2013.0.0-pre",
"notes": String(
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg4-v2012.0.2...pkg4-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
),
"patch": 0,
"path": "workspaces/not-the-name",
"pkgName": "pkg4",
"prNumber": 252,
"publishTag": "prerelease-2013",
"sha": "513b3571193a864bedb98a926208a73717b25752",
"tagName": "pkg4-v2013.0.0-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/131825093/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/pkg4-v2013.0.0-pre",
"version": "2013.0.0-pre",
},
Object {
"draft": false,
"id": 131825095,
"major": 2013,
"minor": 0,
"name": "pkg6: v2013.0.0-pre",
"notes": String(
## [2013.0.0-pre](https://github.com/npm/npm-cli-release-please/compare/pkg6-v2012.0.2...pkg6-v2013.0.0-pre) (2023-11-28)
### ⚠️ BREAKING CHANGES
* update all packages
### Features
* [\`517625d\`](https://github.com/npm/npm-cli-release-please/commit/517625ddf26e01b72c1351e4fae1da831ff3d271) update all packages (@lukekarrys)
),
"patch": 0,
"path": "workspaces/pkg6",
"pkgName": "@npmcli/pkg6",
"prNumber": 252,
"publishTag": "prerelease-2013",
"sha": "513b3571193a864bedb98a926208a73717b25752",
"tagName": "pkg6-v2013.0.0-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/131825095/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/pkg6-v2013.0.0-pre",
"version": "2013.0.0-pre",
},
]
`
1 change: 1 addition & 0 deletions test/fixtures/nocks/release-please-cases-prerelease.json

Large diffs are not rendered by default.

Loading

0 comments on commit c963541

Please sign in to comment.