Skip to content

Commit

Permalink
Merge branch 'canary' into fix-52935
Browse files Browse the repository at this point in the history
  • Loading branch information
domdomegg authored Apr 4, 2024
2 parents 97a8e66 + 2ab4a44 commit 132a960
Show file tree
Hide file tree
Showing 955 changed files with 42,432 additions and 20,500 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ packages/next-bundle-analyzer/index.d.ts
examples/with-typescript-graphql/lib/gql/
test/development/basic/hmr/components/parse-error.js
packages/next-swc/docs/assets/**/*
test/lib/amp-validator-wasm.js
test/production/pages-dir/production/fixture/amp-validator-wasm.js
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ Cargo.toml @timneutkens @i
Cargo.lock @timneutkens @ijjk @shuding @huozhi @vercel/turbopack
/.cargo/config.toml @timneutkens @ijjk @shuding @huozhi @vercel/turbopack
/.config/nextest.toml @timneutkens @ijjk @shuding @huozhi @vercel/turbopack
/test/build-turbopack-tests-manifest.js @timneutkens @ijjk @shuding @huozhi @vercel/turbopack
/test/turbopack-tests-manifest.json @timneutkens @ijjk @shuding @huozhi @vercel/turbopack
/test/build-turbopack-dev-tests-manifest.js @timneutkens @ijjk @shuding @huozhi @vercel/turbopack
/test/turbopack-dev-tests-manifest.json @timneutkens @ijjk @shuding @huozhi @vercel/turbopack
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ contact_links:
- name: Feature request
url: https://github.com/vercel/next.js/discussions/new?category=ideas
about: Feature requests should be opened as discussions
- name: Next.js Learn course
url: https://github.com/vercel/next-learn/issues/new
about: Next.js Lean course-related issues should be reported in their respective repository
2 changes: 1 addition & 1 deletion .github/actions/next-repo-info/dist/issues/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/next-repo-info/dist/prs/index.mjs

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions .github/actions/next-repo-info/lib/util.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// format date to <month|short> <day|numeric>, <year|numeric>
export function formattedDate(createdAt) {
const date = new Date(createdAt)

return date.toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})
}

// Get the date 90 days ago (YYYY-MM-DD)
export function ninetyDaysAgo() {
const date = new Date()
date.setDate(date.getDate() - 90)
return date.toISOString().split('T')[0]
}
15 changes: 6 additions & 9 deletions .github/actions/next-repo-info/src/popular-issues.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// @ts-check
import { context, getOctokit } from '@actions/github'
import { setFailed, info } from '@actions/core'
import { info, setFailed } from '@actions/core'
import { WebClient } from '@slack/web-api'
import { formattedDate, ninetyDaysAgo } from '../lib/util.mjs'

function generateBlocks(issues) {
const blocks = [
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*A list of the top 15 issues sorted by most :+1: reactions over the last 90 days.*\n_Note: This :github2: workflow will run every Monday at 1PM UTC (9AM EST)._',
text: '*A list of the top 15 issues sorted by most :+1: reactions over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/issue_popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-info/src/popular-issues.mjs|action> will run every Monday at 1PM UTC (9AM EST)._',
},
},
{
Expand All @@ -18,10 +19,11 @@ function generateBlocks(issues) {
]

let text = ''

issues.forEach((issue, i) => {
text += `${i + 1}. [<${issue.html_url}|#${issue.number}>, :+1: ${
issue.reactions['+1']
}]: ${issue.title}\n`
}, ${formattedDate(issue.created_at)}]: ${issue.title}\n`
})

blocks.push({
Expand All @@ -43,16 +45,11 @@ async function run() {
const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)

// Get the date 90 days ago (YYYY-MM-DD)
const date = new Date()
date.setDate(date.getDate() - 90)
const ninetyDaysAgo = date.toISOString().split('T')[0]

const { owner, repo } = context.repo
const { data } = await octoClient.rest.search.issuesAndPullRequests({
order: 'desc',
per_page: 15,
q: `repo:${owner}/${repo} is:issue is:open created:>=${ninetyDaysAgo}`,
q: `repo:${owner}/${repo} is:issue is:open created:>=${ninetyDaysAgo()}`,
sort: 'reactions-+1',
})

Expand Down
12 changes: 4 additions & 8 deletions .github/actions/next-repo-info/src/popular-prs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { context, getOctokit } from '@actions/github'
import { setFailed, info } from '@actions/core'
import { WebClient } from '@slack/web-api'
import { formattedDate, ninetyDaysAgo } from '../lib/util.mjs'

function generateBlocks(prs) {
let text = ''
Expand All @@ -17,7 +18,7 @@ function generateBlocks(prs) {
if (pr.reactions['+1'] > 1) {
text += `${i + 1}. [<${pr.html_url}|#${pr.number}>, :+1: ${
pr.reactions['+1']
}]: ${pr.title}\n`
}, ${formattedDate(pr.created_at)}]: ${pr.title}\n`
count++
}
})
Expand All @@ -26,7 +27,7 @@ function generateBlocks(prs) {
type: 'section',
text: {
type: 'mrkdwn',
text: `*A list of the top ${count} PRs sorted by most :+1: reactions (> 1) over the last 90 days.*\n_Note: This :github2: workflow will run every Monday at 1PM UTC (9AM EST)._`,
text: `*A list of the top ${count} PRs sorted by most :+1: reactions (> 1) over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/pull_request_popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-info/src/popular-prs.mjs|action> will run every Monday at 1PM UTC (9AM EST)._`,
},
})

Expand All @@ -49,16 +50,11 @@ async function run() {
const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)

// Get the date 90 days ago (YYYY-MM-DD)
const date = new Date()
date.setDate(date.getDate() - 90)
const ninetyDaysAgo = date.toISOString().split('T')[0]

const { owner, repo } = context.repo
const { data } = await octoClient.rest.search.issuesAndPullRequests({
order: 'desc',
per_page: 15,
q: `repo:${owner}/${repo} is:pr is:open created:>=${ninetyDaysAgo}`,
q: `repo:${owner}/${repo} is:pr is:open created:>=${ninetyDaysAgo()}`,
sort: 'reactions-+1',
})

Expand Down
11 changes: 9 additions & 2 deletions .github/actions/next-stats-action/src/prepare/repo-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,20 @@ module.exports = (actionInfo) => {
}
}

const { stdout } = await execa('pnpm', ['pack'], {
const options = {
cwd: pkgPath,
env: {
...process.env,
COREPACK_ENABLE_STRICT: '0',
},
})
}
let execResult
try {
execResult = await execa('pnpm', ['pack'], options)
} catch {
execResult = await execa('pnpm', ['pack'], options)
}
const { stdout } = execResult

const packedFileName = stdout.trim()

Expand Down
163 changes: 131 additions & 32 deletions .github/actions/upload-turboyet-data/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/upload-turboyet-data/dist/index.js.map

Large diffs are not rendered by default.

139 changes: 119 additions & 20 deletions .github/actions/upload-turboyet-data/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,93 @@ const path = require('path')

const { createClient } = require('@vercel/kv')

async function main() {
try {
const file = path.join(process.cwd(), 'test/turbopack-tests-manifest.json')
async function collectExamplesResult(manifestFile) {
const file = path.join(process.cwd(), manifestFile)
const contents = await fs.readFile(file, 'utf-8')
const results = JSON.parse(contents)

let failingCount = 0
let passingCount = 0

const currentDate = new Date()
const isoString = currentDate.toISOString()
const timestamp = isoString.slice(0, 19).replace('T', ' ')

for (const isPassing of Object.values(results)) {
if (isPassing) {
passingCount += 1
} else {
failingCount += 1
}
}
const status = `${process.env.GITHUB_SHA}\t${timestamp}\t${passingCount}/${
passingCount + failingCount
}`

return {
status,
// Uses JSON.stringify to create minified JSON, otherwise whitespace is preserved.
data: JSON.stringify(results),
}
}

async function collectResults(manifestFile) {
const file = path.join(process.cwd(), manifestFile)
const contents = await fs.readFile(file, 'utf-8')
const results = JSON.parse(contents)

let passingTests = ''
let failingTests = ''
let passCount = 0
let failCount = 0

const currentDate = new Date()
const isoString = currentDate.toISOString()
const timestamp = isoString.slice(0, 19).replace('T', ' ')

if (results.version === 2) {
for (const [testFileName, result] of Object.entries(results.suites)) {
let suitePassCount = 0
let suiteFailCount = 0

suitePassCount += result.passed.length
suiteFailCount += result.failed.length

let passingTests = ''
let failingTests = ''
let passCount = 0
let failCount = 0
if (suitePassCount > 0) {
passingTests += `${testFileName}\n`
}

const contents = await fs.readFile(file, 'utf-8')
const results = JSON.parse(contents)
if (suiteFailCount > 0) {
failingTests += `${testFileName}\n`
}

const currentDate = new Date()
const isoString = currentDate.toISOString()
const timestamp = isoString.slice(0, 19).replace('T', ' ')
for (const passed of result.passed) {
const passedName = passed.replaceAll('`', '\\`')
passingTests += `* ${passedName}\n`
}

for (const passed of result.failed) {
const failedName = passed.replaceAll('`', '\\`')
failingTests += `* ${failedName}\n`
}

passCount += suitePassCount
failCount += suiteFailCount

if (suitePassCount > 0) {
passingTests += `\n`
}

if (suiteFailCount > 0) {
failingTests += `\n`
}
}

const testRun = `${process.env.GITHUB_SHA}\t${timestamp}\t${passCount}/${
passCount + failCount
}`
return { testRun, passingTests, failingTests }
} else {
for (const [testFileName, result] of Object.entries(results)) {
let suitePassCount = 0
let suiteFailCount = 0
Expand Down Expand Up @@ -55,27 +126,55 @@ async function main() {
failingTests += `\n`
}
}
const testRun = `${process.env.GITHUB_SHA}\t${timestamp}\t${passCount}/${
passCount + failCount
}`

return { testRun, passingTests, failingTests }
}
}

async function main() {
try {
const developmentResult = await collectResults(
'test/turbopack-dev-tests-manifest.json'
)
const productionResult = await collectResults(
'test/turbopack-build-tests-manifest.json'
)
const developmentExamplesResult = await collectExamplesResult(
'test/turbopack-dev-examples-manifest.json'
)

const kv = createClient({
url: process.env.TURBOYET_KV_REST_API_URL,
token: process.env.TURBOYET_KV_REST_API_TOKEN,
})

const testRun = `${process.env.GITHUB_SHA}\t${timestamp}\t${passCount}/${
passCount + failCount
}`
console.log('TEST RESULT DEVELOPMENT')
console.log(developmentResult.testRun)

console.log('TEST RESULT PRODUCTION')
console.log(productionResult.testRun)

console.log('TEST RESULT')
console.log(testRun)
console.log('EXAMPLES RESULT')
console.log(developmentExamplesResult.status)

await kv.rpush('test-runs', testRun)
await kv.rpush('test-runs', developmentResult.testRun)
await kv.rpush('test-runs-production', productionResult.testRun)
await kv.rpush('examples-runs', developmentExamplesResult.status)
console.log('SUCCESSFULLY SAVED RUNS')

await kv.set('passing-tests', passingTests)
await kv.set('passing-tests', developmentResult.passingTests)
await kv.set('passing-tests-production', productionResult.passingTests)
console.log('SUCCESSFULLY SAVED PASSING')

await kv.set('failing-tests', failingTests)
await kv.set('failing-tests', developmentResult.failingTests)
await kv.set('failing-tests-production', productionResult.failingTests)
console.log('SUCCESSFULLY SAVED FAILING')

await kv.set('examples-data', developmentExamplesResult.data)
console.log('SUCCESSFULLY SAVED EXAMPLES')
} catch (error) {
console.log(error)
}
Expand Down
2 changes: 2 additions & 0 deletions .github/labeler.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
"created-by: Next.js team": [
{ "type": "user", "pattern": "acdlite" },
{ "type": "user", "pattern": "balazsorban44" },
{ "type": "user", "pattern": "eps1lon" },
{ "type": "user", "pattern": "Ethan-Arrowood" },
{ "type": "user", "pattern": "feedthejim" },
{ "type": "user", "pattern": "gnoff" },
{ "type": "user", "pattern": "huozhi" },
{ "type": "user", "pattern": "ijjk" },
{ "type": "user", "pattern": "javivelasco" },
{ "type": "user", "pattern": "kikobeats" },
{ "type": "user", "pattern": "lubieowoce" },
{ "type": "user", "pattern": "samcx" },
{ "type": "user", "pattern": "schniz" },
{ "type": "user", "pattern": "sebmarkbage" },
Expand Down
Loading

0 comments on commit 132a960

Please sign in to comment.