Skip to content

Commit bf8ab26

Browse files
committed
chore: Watch for changes in more relevant files in Next.js core
1 parent a3e1311 commit bf8ab26

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

packages/scripts/next-release-analyser.mjs

+26-17
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ async function main() {
4747
const compareURL = `https://api.github.com/repos/vercel/next.js/compare/v${previousVersion}...v${thisVersion}`
4848
const compare = await fetch(compareURL).then(res => res.json())
4949
const files = z.array(fileSchema).parse(compare.files)
50-
const appRouterFile = files.find(
51-
file =>
52-
file.filename === 'packages/next/src/client/components/app-router.tsx'
50+
const relevantFiles = files.filter(file =>
51+
[
52+
'packages/next/src/client/components/app-router.tsx',
53+
'packages/next/src/client/components/search-params.ts',
54+
'packages/next/src/client/components/navigation.ts'
55+
].includes(file.filename)
5356
)
54-
if (!appRouterFile) {
55-
console.log('No changes in app-router.tsx')
57+
if (relevantFiles.length === 0) {
58+
console.log('No relevant changes')
5659
process.exit(0)
5760
}
58-
await sendNotificationEmail(thisVersion, appRouterFile)
61+
await sendNotificationEmail(thisVersion, relevantFiles)
5962
}
6063

6164
// --
@@ -78,28 +81,34 @@ function getPreviousVersion(version) {
7881
/**
7982
*
8083
* @param {string} thisVersion
81-
* @param {z.infer<typeof fileSchema>} appRouterFile
84+
* @param {z.infer<typeof fileSchema>[]} files
8285
* @returns
8386
*/
84-
async function sendNotificationEmail(thisVersion, appRouterFile) {
87+
async function sendNotificationEmail(thisVersion, files) {
8588
const client = new MailPace.DomainClient(env.MAILPACE_API_TOKEN)
8689
const release = await fetch(
8790
`https://api.github.com/repos/vercel/next.js/releases/tags/v${thisVersion}`
8891
).then(res => res.json())
89-
const subject = `[nuqs] Next.js ${thisVersion} has app router changes`
92+
const subject = `[nuqs] Next.js ${thisVersion} has relevant core changes`
93+
const patchSection = files
94+
.map(file => {
95+
if (!file.patch) {
96+
return `${file.filename}: no patch available`
97+
}
98+
return `${file.filename}:
99+
\`\`\`diff
100+
${file.patch}
101+
\`\`\`
102+
`
103+
})
104+
.join('\n')
105+
90106
const body = `Release: ${release.html_url}
91107
92108
${release.body}
93109
---
94110
95-
${
96-
appRouterFile.patch
97-
? `App router changes:
98-
\`\`\`diff
99-
${appRouterFile.patch}
100-
\`\`\``
101-
: 'No patch available'
102-
}
111+
${patchSection}
103112
`
104113
console.info('Sending email:', subject)
105114
console.info(body)

0 commit comments

Comments
 (0)