@@ -34,7 +34,29 @@ const appendSummary = value => {
3434 }
3535}
3636
37- const report = ( { publishable, candidateRef, registryCount = 0 , disallowedCount = 0 , reason } ) => {
37+ const scriptBuildOutputPathPrefixes = [ 'dist/' , 'src/' , 'webpack/' ]
38+ const scriptBuildOutputFiles = new Set ( [
39+ '.browserslistrc' ,
40+ 'package.json' ,
41+ 'pnpm-lock.yaml' ,
42+ 'tsconfig.json' ,
43+ 'tsconfig.type-check.json' ,
44+ ] )
45+
46+ const affectsScriptBuildOutput = path => {
47+ return (
48+ scriptBuildOutputFiles . has ( path ) ||
49+ scriptBuildOutputPathPrefixes . some ( prefix => path . startsWith ( prefix ) )
50+ )
51+ }
52+
53+ const report = ( {
54+ publishable,
55+ candidateRef,
56+ safeCount = 0 ,
57+ scriptBuildOutputCount = 0 ,
58+ reason,
59+ } ) => {
3860 appendOutput ( 'base_ref' , baseRef )
3961 appendOutput ( 'publishable' , String ( publishable ) )
4062 appendOutput ( 'reason' , reason )
@@ -43,8 +65,8 @@ const report = ({ publishable, candidateRef, registryCount = 0, disallowedCount
4365
4466- Base: \`${ baseRef } \`
4567- Candidate: \`${ candidateRef || 'none' } \`
46- - Registry source changes: \`${ registryCount } \`
47- - Blocked changes: \`${ disallowedCount } \`
68+ - Safe changes: \`${ safeCount } \`
69+ - Script build output changes: \`${ scriptBuildOutputCount } \`
4870
4971\`\`\`text
5072${ reason }
@@ -102,46 +124,30 @@ for (const range of rangesByBaseRef[baseRef] ?? []) {
102124 . forEach ( line => diffEntries . add ( line ) )
103125}
104126
105- const allowedEntries = [ ]
106- const disallowedEntries = [ ]
107- const registryEntries = [ ]
127+ const safeEntries = [ ]
128+ const scriptBuildOutputEntries = [ ]
108129
109130for ( const entry of [ ...diffEntries ] . sort ( ) ) {
110131 const [ status , first , second ] = entry . split ( '\t' )
111132 const paths = status . startsWith ( 'R' ) || status . startsWith ( 'C' ) ? [ first , second ] : [ first ]
112133
113- let isAllowed = true
114- let isRegistry = false
115- for ( const path of paths ) {
116- if ( path . startsWith ( 'registry/lib/components/' ) || path . startsWith ( 'registry/lib/plugins/' ) ) {
117- isRegistry = true
118- continue
119- }
120- isAllowed = false
121- }
122-
123134 const displayEntry = `${ status } ${ paths . join ( ' ' ) } `
124- if ( isAllowed ) {
125- allowedEntries . push ( displayEntry )
135+ if ( paths . some ( affectsScriptBuildOutput ) ) {
136+ scriptBuildOutputEntries . push ( displayEntry )
126137 } else {
127- disallowedEntries . push ( displayEntry )
128- }
129- if ( isRegistry ) {
130- registryEntries . push ( displayEntry )
138+ safeEntries . push ( displayEntry )
131139 }
132140}
133141
134- const publishable = registryEntries . length > 0 && disallowedEntries . length === 0
135- const reasonEntries = publishable
136- ? registryEntries
137- : disallowedEntries . length > 0
138- ? disallowedEntries
139- : allowedEntries
140- const reasonHeader = publishable
141- ? 'publishable branch diff'
142- : disallowedEntries . length > 0
143- ? 'blocked branch diff'
144- : 'no registry source changes'
142+ const publishable = safeEntries . length > 0 && scriptBuildOutputEntries . length === 0
143+ let reasonEntries = safeEntries
144+ let reasonHeader = 'no safe changes'
145+ if ( publishable ) {
146+ reasonHeader = 'publishable branch diff'
147+ } else if ( scriptBuildOutputEntries . length > 0 ) {
148+ reasonEntries = scriptBuildOutputEntries
149+ reasonHeader = 'script build output branch diff'
150+ }
145151const visibleEntries = reasonEntries . slice ( 0 , 20 )
146152const overflow = Math . max ( 0 , reasonEntries . length - visibleEntries . length )
147153const reasonLines = [
@@ -155,7 +161,7 @@ if (overflow > 0) {
155161report ( {
156162 publishable,
157163 candidateRef,
158- registryCount : registryEntries . length ,
159- disallowedCount : disallowedEntries . length ,
164+ safeCount : safeEntries . length ,
165+ scriptBuildOutputCount : scriptBuildOutputEntries . length ,
160166 reason : reasonLines . join ( '\n' ) ,
161167} )
0 commit comments