@@ -11,7 +11,6 @@ module.exports = class extends ManifestPlugin {
1111
1212 #releasesByPackage = new Map ( )
1313 #pathsByComponent = new Map ( )
14- #WORKSPACE_SCOPE = / (?< scope > w o r k s p a c e ) : ` ? (?< 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 ( / ^ \* T h e f o l l o w i n g w o r k s p a c e d e p e n d e n c i e s w e r e u p d a t e d \n / gm, '' )
56+ . replace ( / ^ \s { 2 } \* d e p e n d e n c i e s \n / gm, '' )
57+ . replace ( / ^ \s { 2 } \* d e v D e p e n d e n c i e s \n / gm, '' )
58+ . replace ( / ^ \s { 2 } \* p e e r D e p e n d e n c i e s \n / gm, '' )
59+ . replace ( / ^ \s { 2 } \* o p t i o n a l D e p e n d e n c i e s \n / gm, '' )
60+ . replace (
61+ / ^ \s { 4 } \* (?< name > [ ^ \s ] + ) b u m p e d t o (?< versionRange > [ ^ \s ] + ) / gm,
62+ ( ...args ) => this . #replaceWorkspace( args . at ( - 1 ) )
63+ )
64+ . replace (
65+ / ^ \s { 4 } \* (?< name > [ ^ \s ] + ) b u m p e d f r o m (?: [ ^ \s ] + ) t o (?< 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 )
0 commit comments