Skip to content

Commit

Permalink
Merge branch 'canary' into kdy1/acorn-bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Apr 26, 2024
2 parents c22b75a + f945d83 commit b2c108e
Show file tree
Hide file tree
Showing 671 changed files with 61,245 additions and 70,552 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
/**/*image*/** @timneutkens @ijjk @shuding @styfle @huozhi @ztanner @vercel/devex
/**/*img* @timneutkens @ijjk @shuding @styfle @huozhi @ztanner @vercel/devex
/packages/next/client/use-intersection.tsx @timneutkens @ijjk @shuding @styfle
/packages/next/server/lib/squoosh/ @timneutkens @ijjk @shuding @styfle
/packages/next/server/serve-static.ts @timneutkens @ijjk @shuding @styfle @huozhi @ztanner
/packages/next/server/config.ts @timneutkens @ijjk @shuding @styfle @huozhi @ztanner

Expand Down
17 changes: 17 additions & 0 deletions .github/actions/next-repo-info/dist/feature-requests/index.mjs

Large diffs are not rendered by default.

1,001 changes: 1,001 additions & 0 deletions .github/actions/next-repo-info/dist/feature-requests/licenses.txt

Large diffs are not rendered by default.

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.

5 changes: 3 additions & 2 deletions .github/actions/next-repo-info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"private": true,
"description": "Notify Next.js team about pending PRs and popular issues",
"scripts": {
"build": "pnpm build-issues && pnpm build-prs",
"build": "pnpm build-issues && pnpm build-prs && pnpm build-feature-requests",
"build-issues": "ncc build src/popular-issues.mjs -m -o dist/issues --license licenses.txt",
"build-prs": "ncc build src/popular-prs.mjs -m -o dist/prs --license licenses.txt"
"build-prs": "ncc build src/popular-prs.mjs -m -o dist/prs --license licenses.txt",
"build-feature-requests": "ncc build src/feature-requests.mjs -m -o dist/feature-requests --license licenses.txt"
},
"dependencies": {
"@actions/core": "^1.10.1",
Expand Down
113 changes: 113 additions & 0 deletions .github/actions/next-repo-info/src/feature-requests.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// @ts-check
import { context, getOctokit } from '@actions/github'
import { info, setFailed } from '@actions/core'
import { WebClient } from '@slack/web-api'

import { formattedDate, ninetyDaysAgo } from '../lib/util.mjs'

/**
* @typedef Search
* @property {Node[]} nodes
*
* @typedef Node
* @property {number} number
* @property {string} title
* @property {string} url
* @property {number} upvoteCount
* @property {string} createdAt
*
* @typedef {{ search: Search }} GraphQLResponse
*
* @typedef Item
* @property {string} title
* @property {number} number
* @property {string} html_url
* @property {string} created_at
* @property {number} reactions
*/

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

let text = ''

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

blocks.push({
type: 'section',
text: {
type: 'mrkdwn',
text: text,
},
})

return blocks
}

async function run() {
try {
if (!process.env.GITHUB_TOKEN) throw new TypeError('GITHUB_TOKEN not set')
if (!process.env.SLACK_TOKEN) throw new TypeError('SLACK_TOKEN not set')

const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)

const { owner, repo } = context.repo

/** @type {GraphQLResponse} */
const { search } = await octoClient.graphql(`{
search(
type: DISCUSSION
first: 15
query: "repo:${owner}/${repo} is:open category:Ideas sort:top created:>=${ninetyDaysAgo()}"
) {
nodes {
... on Discussion {
number
title
url
upvoteCount
createdAt
}
}
}
}`)

const items = search.nodes.map((node) => ({
title: node.title,
number: node.number,
html_url: node.url,
created_at: formattedDate(node.createdAt),
reactions: node.upvoteCount,
}))

await slackClient.chat.postMessage({
blocks: generateBlocks(items),
channel: '#team-next-js',
icon_emoji: ':github:',
username: 'GitHub Notifier',
})

info(`Posted to Slack!`)
} catch (error) {
setFailed(error)
}
}

run()
2 changes: 1 addition & 1 deletion .github/actions/next-repo-info/src/popular-issues.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function generateBlocks(issues) {
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: <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)._',
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/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 Down
4 changes: 2 additions & 2 deletions .github/actions/next-repo-info/src/popular-prs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,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: <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)._`,
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/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 @@ -54,7 +54,7 @@ async function run() {
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:draft is:pr is:open created:>=${ninetyDaysAgo()}`,
sort: 'reactions-+1',
})

Expand Down
47 changes: 43 additions & 4 deletions .github/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions .github/workflows/issue_popular.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/popular.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days

on:
schedule:
- cron: '0 13 * * 1' # Every Monday at 1PM UTC (9AM EST)
workflow_dispatch:

jobs:
run:
if: github.repository_owner == 'vercel'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: corepack enable
- name: 'Issues: Send notification to Slack'
run: node ./.github/actions/next-repo-info/dist/issues/index.mjs
continue-on-error: true
- name: 'PRs: Send notification to Slack'
run: node ./.github/actions/next-repo-info/dist/prs/index.mjs
continue-on-error: true
- name: 'Feature requests: Send notification to Slack'
run: node ./.github/actions/next-repo-info/dist/feature-requests/index.mjs
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
22 changes: 0 additions & 22 deletions .github/workflows/pull_request_popular.yml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/01-getting-started/01-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Create an `app/` folder, then add a `layout.tsx` and `page.tsx` file. These will
height="363"
/>

Create a [root layout](/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required) inside `app/layout.tsx` with the required `<html>` and `<body>` tags:
Create a [root layout](/docs/app/building-your-application/routing/layouts-and-templates#root-layout-required) inside `app/layout.tsx` with the required `<html>` and `<body>` tags:

```tsx filename="app/layout.tsx" switcher
export default function RootLayout({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Learn how to create your first route in Next.js.
related:
description: Learn more about creating pages and layouts.
links:
- app/building-your-application/routing/pages-and-layouts
- app/building-your-application/routing/pages
---

> We recommend reading the [Routing Fundamentals](/docs/app/building-your-application/routing) page before continuing.
Expand All @@ -25,7 +25,7 @@ Each folder represents a [**route** segment](/docs/app/building-your-application
height="594"
/>

A special [`page.js` file](/docs/app/building-your-application/routing/pages-and-layouts#pages) is used to make route segments publicly accessible.
A special [`page.js` file](/docs/app/building-your-application/routing/pages) is used to make route segments publicly accessible.

<Image
alt="Defining Routes"
Expand All @@ -41,7 +41,7 @@ In this example, the `/dashboard/analytics` URL path is _not_ publicly accessibl
## Creating UI

[Special file conventions](/docs/app/building-your-application/routing#file-conventions) are used to create UI for each route segment. The most common are [pages](/docs/app/building-your-application/routing/pages-and-layouts#pages) to show UI unique to a route, and [layouts](/docs/app/building-your-application/routing/pages-and-layouts#layouts) to show UI that is shared across multiple routes.
[Special file conventions](/docs/app/building-your-application/routing#file-conventions) are used to create UI for each route segment. The most common are [pages](/docs/app/building-your-application/routing/pages) to show UI unique to a route, and [layouts](/docs/app/building-your-application/routing/layouts-and-templates#layouts) to show UI that is shared across multiple routes.

For example, to create your first page, add a `page.js` file inside the `app` directory and export a React component:

Expand Down
Loading

0 comments on commit b2c108e

Please sign in to comment.