@@ -606,6 +606,11 @@ function createPublishTasks(ctx: Ctx, options: {otp?: string}) {
606606 task : async ( _ctx , subtask ) => {
607607 const publishArgs = [ '--access' , 'public' ]
608608 if ( options . otp ) publishArgs . push ( '--otp' , options . otp )
609+ if ( rhsPackageJson && semver . prerelease ( rhsPackageJson . version ) ) {
610+ const first = semver . prerelease ( rhsPackageJson . version ) ?. [ 0 ]
611+ const tag = typeof first === 'string' ? first : 'next'
612+ publishArgs . push ( '--tag' , tag )
613+ }
609614 await pipeExeca ( subtask , 'pnpm' , [ 'publish' , ...publishArgs ] , {
610615 cwd : path . dirname ( packageJsonFilepath ( pkg , RHS_FOLDER ) ) ,
611616 env : {
@@ -647,6 +652,11 @@ export const ReleaseNotesInput = z.object({
647652 `Only relevant in a monorepo - 'unified' mode drafts one release with all packages' changes, 'individual' drafts one release per package.` ,
648653 )
649654 . default ( 'unified' ) ,
655+ scope : z
656+ . string ( )
657+ . regex ( / ^ @ [ \w - _ . ] + $ / )
658+ . describe ( 'check for packages with this scope too' )
659+ . optional ( ) ,
650660} )
651661
652662export type ReleaseNotesInput = z . infer < typeof ReleaseNotesInput >
@@ -1161,17 +1171,28 @@ export async function releaseNotes(input: ReleaseNotesInput) {
11611171 const packageJson = await pullRegistryPackage ( subtask , pkg , {
11621172 version : pullable . str ,
11631173 folder : pullable . folder ,
1164- } ) . catch ( async e => {
1165- if ( `${ e } ` . includes ( 'No matching version found' ) ) {
1166- // if the version doesn't exist on the registry, we might have passed a comparison string from before it existed (can happen with fixed versioning)
1167- const versions = await getRegistryVersions ( pkg )
1168- return pullRegistryPackage ( subtask , pkg , {
1169- version : pullable . side === 'left' ? versions [ 0 ] : versions . at ( - 1 ) ! ,
1170- folder : pullable . folder ,
1171- } )
1172- }
1173- throw e
11741174 } )
1175+ . catch ( e => {
1176+ if ( `${ e } ` . includes ( 'No matching version found' ) && input . scope ) {
1177+ const scopedPkg = { ...pkg , name : `${ input . scope } /${ pkg . name } ` }
1178+ return pullRegistryPackage ( subtask , scopedPkg , {
1179+ version : pullable . str ,
1180+ folder : pullable . folder ,
1181+ } )
1182+ }
1183+ throw e
1184+ } )
1185+ . catch ( async e => {
1186+ if ( `${ e } ` . includes ( 'No matching version found' ) ) {
1187+ // if the version doesn't exist on the registry, we might have passed a comparison string from before it existed (can happen with fixed versioning)
1188+ const versions = await getRegistryVersions ( pkg )
1189+ return pullRegistryPackage ( subtask , pkg , {
1190+ version : pullable . side === 'left' ? versions [ 0 ] : versions . at ( - 1 ) ! ,
1191+ folder : pullable . folder ,
1192+ } )
1193+ }
1194+ throw e
1195+ } )
11751196 pkg . shas ||= { } as never
11761197 pkg . shas [ pullable . side ] = await getPackageJsonGitSha ( pkg , packageJson )
11771198 } else if ( / ^ [ \d a - f ] + / . test ( pullable . str ) ) {
0 commit comments