Skip to content

Commit 617579f

Browse files
committed
Merge branch 'preview-fixes' into preview-features
2 parents f7fb2c6 + 7353684 commit 617579f

2 files changed

Lines changed: 44 additions & 37 deletions

File tree

.github/scripts/auto-publish-classify.mjs

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -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

109130
for (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+
}
145151
const visibleEntries = reasonEntries.slice(0, 20)
146152
const overflow = Math.max(0, reasonEntries.length - visibleEntries.length)
147153
const reasonLines = [
@@ -155,7 +161,7 @@ if (overflow > 0) {
155161
report({
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
})

registry/lib/components/video/player/show-upload-time/mediaListVideo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import Vue from 'vue'
22
import { ComponentMetadata } from '@/components/types'
33
import { getFormatStr, Video } from './video'
4-
import { getVue2Data } from '@/core/utils'
4+
import { getVue2Data, matchUrlPattern } from '@/core/utils'
55
import { getComponentSettings } from '@/core/settings'
66
import { VideoInfo } from '@/components/video/video-info'
7+
import { watchlaterUrls } from '@/core/utils/urls'
78

89
interface RecommendListUgc extends Vue {
910
isFolded: boolean
@@ -108,7 +109,7 @@ export class MediaListVideo implements Video {
108109
const relist = recoList.$children.filter(video =>
109110
this.videoClasses.includes(video.$el.className),
110111
)
111-
this.showUploadTime(relist)
112+
this.showUploadTime(relist, watchlaterUrls.some(matchUrlPattern))
112113
},
113114
{ deep: true, immediate: true },
114115
)

0 commit comments

Comments
 (0)