Skip to content

Commit e549553

Browse files
committed
fix: remove custom node-workspace plugin
release-please now has all the fixes we need and we can use the upstream plugin
1 parent 3749b91 commit e549553

File tree

3 files changed

+24
-117
lines changed

3 files changed

+24
-117
lines changed

lib/release/node-workspace-format.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = class extends ManifestPlugin {
1111

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

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

34+
#replaceWorkspace ({ name, versionRange }) {
35+
const version = versionRange.replace(/^[\^~]/, '')
36+
const { path, component } = this.#releasesByPackage.get(name)
37+
const { tagSeparator, includeVInTag } = this.repositoryConfig[path]
38+
const { repository: { owner, repo } } = this.github
39+
const tag = new TagName(version, component, tagSeparator, includeVInTag).toString()
40+
const url = `https://github.com/${owner}/${repo}/releases/tag/${tag}`
41+
return `${link('workspace', url)}: ${wrapSpecs(`${name}@${version}`)}`
42+
}
43+
3544
// I don't like how release-please formats workspace changelog entries
3645
// so this rewrites them to look like the rest of our changelog. This can't
3746
// be part of the changelog plugin since they are written after that by the
@@ -42,16 +51,20 @@ module.exports = class extends ManifestPlugin {
4251
for (const release of candidate.pullRequest.body.releaseData) {
4352
// Update notes with a link to each workspaces release notes
4453
// now that we have all of the releases in a single pull request
45-
release.notes =
46-
release.notes.replace(this.#WORKSPACE_SCOPE, (...args) => {
47-
const { scope, name, version } = args.pop()
48-
const { path, component } = this.#releasesByPackage.get(name)
49-
const { tagSeparator, includeVInTag } = this.repositoryConfig[path]
50-
const { repository: { owner, repo } } = this.github
51-
const tag = new TagName(version, component, tagSeparator, includeVInTag).toString()
52-
const url = `https://github.com/${owner}/${repo}/releases/tag/${tag}`
53-
return `${link(scope, url)}: ${wrapSpecs(`${name}@${version}`)}`
54-
})
54+
release.notes = release.notes
55+
.replace(/^\* The following workspace dependencies were updated\n/gm, '')
56+
.replace(/^\s{2}\* dependencies\n/gm, '')
57+
.replace(/^\s{2}\* devDependencies\n/gm, '')
58+
.replace(/^\s{2}\* peerDependencies\n/gm, '')
59+
.replace(/^\s{2}\* optionalDependencies\n/gm, '')
60+
.replace(
61+
/^\s{4}\* (?<name>[^\s]+) bumped to (?<versionRange>[^\s]+)/gm,
62+
(...args) => this.#replaceWorkspace(args.at(-1))
63+
)
64+
.replace(
65+
/^\s{4}\* (?<name>[^\s]+) bumped from (?:[^\s]+) to (?<versionRange>[^\s]+)/gm,
66+
(...args) => this.#replaceWorkspace(args.at(-1))
67+
)
5568

5669
// Find the associated changelog and update that too
5770
const path = this.#pathsByComponent.get(release.component)

lib/release/node-workspace.js

Lines changed: 0 additions & 103 deletions
This file was deleted.

lib/release/release-please.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const assert = require('assert')
1111
const core = require('@actions/core')
1212
const omit = require('just-omit')
1313
const ChangelogNotes = require('./changelog.js')
14-
const NodeWorkspace = require('./node-workspace.js')
1514
const NodeWorkspaceFormat = require('./node-workspace-format.js')
1615
const { getPublishTag, noop } = require('./util.js')
1716

@@ -69,8 +68,6 @@ class ReleasePlease {
6968
new ChangelogNotes(github, o))
7069
RP.registerVersioningStrategy('default', (o) =>
7170
o.prerelease ? new PrereleaseVersioningStrategy(o) : new DefaultVersioningStrategy(o))
72-
RP.registerPlugin('node-workspace', ({ github, targetBranch, repositoryConfig, ...o }) =>
73-
new NodeWorkspace(github, targetBranch, repositoryConfig, o))
7471
RP.registerPlugin('node-workspace-format', ({ github, targetBranch, repositoryConfig, ...o }) =>
7572
new NodeWorkspaceFormat(github, targetBranch, repositoryConfig, o))
7673

0 commit comments

Comments
 (0)