Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: bump release-please from 16.3.1 to 16.10.2 #432

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions lib/release/node-workspace-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ const { ManifestPlugin } = require('release-please/build/src/plugin.js')
const { addPath } = require('release-please/build/src/plugins/workspace.js')
const { TagName } = require('release-please/build/src/util/tag-name.js')
const { ROOT_PROJECT_PATH } = require('release-please/build/src/manifest.js')
const { DEPS, link, wrapSpecs } = require('./util.js')
const { DEPS, link, wrapSpecs, list } = require('./util.js')

/* istanbul ignore next: TODO fix flaky tests and enable coverage */
module.exports = class extends ManifestPlugin {
static WORKSPACE_MESSAGE = (name, version) => `${DEPS}(workspace): ${name}@${version}`

#releasesByPackage = new Map()
#pathsByComponent = new Map()
#WORKSPACE_SCOPE = /(?<scope>workspace): `?(?<name>\S+?)[@\s](?<version>\S+?)`?$/gm

async preconfigure (strategiesByPath) {
// First build a list of all releases that will happen based on
Expand All @@ -32,6 +31,16 @@ module.exports = class extends ManifestPlugin {
return candidates
}

#replaceWorkspace ({ name, versionRange }) {
const version = versionRange.replace(/^[\^~]/, '')
const { path, component } = this.#releasesByPackage.get(name)
const { tagSeparator, includeVInTag } = this.repositoryConfig[path]
const { repository: { owner, repo } } = this.github
const tag = new TagName(version, component, tagSeparator, includeVInTag).toString()
const url = `https://github.com/${owner}/${repo}/releases/tag/${tag}`
return list(`${link('workspace', url)}: ${wrapSpecs(`${name}@${version}`)}`)
}

// I don't like how release-please formats workspace changelog entries
// so this rewrites them to look like the rest of our changelog. This can't
// be part of the changelog plugin since they are written after that by the
Expand All @@ -42,16 +51,20 @@ module.exports = class extends ManifestPlugin {
for (const release of candidate.pullRequest.body.releaseData) {
// Update notes with a link to each workspaces release notes
// now that we have all of the releases in a single pull request
release.notes =
release.notes.replace(this.#WORKSPACE_SCOPE, (...args) => {
const { scope, name, version } = args.pop()
const { path, component } = this.#releasesByPackage.get(name)
const { tagSeparator, includeVInTag } = this.repositoryConfig[path]
const { repository: { owner, repo } } = this.github
const tag = new TagName(version, component, tagSeparator, includeVInTag).toString()
const url = `https://github.com/${owner}/${repo}/releases/tag/${tag}`
return `${link(scope, url)}: ${wrapSpecs(`${name}@${version}`)}`
})
release.notes = release.notes
.replace(/^\* The following workspace dependencies were updated\n/gm, '')
.replace(/^\s{2}\* dependencies\n/gm, '')
.replace(/^\s{2}\* devDependencies\n/gm, '')
.replace(/^\s{2}\* peerDependencies\n/gm, '')
.replace(/^\s{2}\* optionalDependencies\n/gm, '')
.replace(
/^\s{4}\* (?<name>[^\s]+) bumped to (?<versionRange>[^\s]+)/gm,
(...args) => this.#replaceWorkspace(args.at(-1))
)
.replace(
/^\s{4}\* (?<name>[^\s]+) bumped from (?:[^\s]+) to (?<versionRange>[^\s]+)/gm,
(...args) => this.#replaceWorkspace(args.at(-1))
)

// Find the associated changelog and update that too
const path = this.#pathsByComponent.get(release.component)
Expand Down
103 changes: 0 additions & 103 deletions lib/release/node-workspace.js

This file was deleted.

3 changes: 0 additions & 3 deletions lib/release/release-please.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const assert = require('assert')
const core = require('@actions/core')
const omit = require('just-omit')
const ChangelogNotes = require('./changelog.js')
const NodeWorkspace = require('./node-workspace.js')
const NodeWorkspaceFormat = require('./node-workspace-format.js')
const { getPublishTag, noop } = require('./util.js')

Expand Down Expand Up @@ -69,8 +68,6 @@ class ReleasePlease {
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 }) =>
new NodeWorkspaceFormat(github, targetBranch, repositoryConfig, o))

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"minimatch": "^9.0.2",
"npm-package-arg": "^11.0.1",
"proc-log": "^4.0.0",
"release-please": "16.3.1",
"release-please": "16.10.2",
"semver": "^7.3.5",
"undici": "^6.7.0",
"yaml": "^2.1.1"
Expand Down
Loading