Skip to content

Commit

Permalink
Merge branch 'canary' into shu/d9e1
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Jul 14, 2022
2 parents 02ef013 + 2473280 commit f1069e7
Show file tree
Hide file tree
Showing 40 changed files with 1,075 additions and 263 deletions.
79 changes: 56 additions & 23 deletions .github/actions/issue-validator/index.js
Expand Up @@ -8699,57 +8699,90 @@
const t = 'please verify canary'
const r = 'template: bug'
const s = 'please add a complete reproduction'
const i = !!process.env.DEBUG
async function run() {
try {
const {
payload: { issue: p, pull_request: d },
repo: i,
repo: o,
} = e.context
if (d || !p?.body) return
const { body: o, labels: n, number: l } = p
const m = n.some((e) => e.name === t)
const u = n.some((e) => e.name === r)
const { body: n, labels: l, number: m } = p
const u = l.some((e) => e.name === r)
const c = l.some((e) => e.name === t)
if (!u || !c) {
return a.info(
`issue ${m} is ignored, because it is not a bug report or is not manually labeled`
)
}
if (!process.env.GITHUB_TOKEN) {
return a.setFailed('GITHUB_TOKEN is not set')
throw new Error('GITHUB_TOKEN is not set')
}
const c = e.getOctokit(process.env.GITHUB_TOKEN).rest
const v = e.getOctokit(process.env.GITHUB_TOKEN).rest
function notifyOnIssue(e, p) {
const a = { ...i, issue_number: l }
const d = { ...o, issue_number: m }
if (i) {
a.info('Skipping comment/label because we are in DEBUG mode')
a.info(JSON.stringify({ label: e, comment: p }, null, 2))
return
}
return Promise.all([
c.issues.addLabels({ ...a, labels: [e] }),
c.issues.createComment({ ...a, body: p }),
v.issues.addLabels({ ...d, labels: [e] }),
v.issues.createComment({ ...d, body: p }),
])
}
const v = o.includes(
const h = n.includes(
'- [X] I verified that the issue exists in Next.js canary release'
)
if (!v || m) {
return await notifyOnIssue(
if (!h || c) {
await notifyOnIssue(
t,
'Please verify your issue reproduces with `next@canary`. The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running `npm install next@canary`. If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.'
)
return a.info(
`Commented on issue ${m}, because it was ${
c ? 'manually labeled' : 'not verified against canary'
}`
)
}
if (!u) return
const h = o
const g = n
.match(/### Link to reproduction\n\n(?<url>.*)\n/)
?.groups?.url.trim()
if (!h || !(await (await fetch(h)).ok)) {
return await notifyOnIssue(
if (!g || !(await fetch(g)).ok) {
await notifyOnIssue(
s,
'The link to the reproduction appears to be incorrect/unreachable. Please add a link to the reproduction of the issue. This is a required field.'
'The link to the reproduction appears to be incorrect/unreachable. Please add a link to the reproduction of the issue. This is a required field. If your project is private, you can invite @balazsorban44 to the repository so the Next.js team can investigate further.'
)
return a.info(
`Commented on issue ${m}, because it the reproduction url (${g}) was not reachable.`
)
}
const w = [
'Operating System:',
'Binaries:',
'Relevant packages:',
].every((e) => n.includes(e))
if (!w) {
return a.info(
'Could not detect `next info` output, skipping as version detection might be unreliable'
)
}
const g = o.match(
const _ = n.match(
/Relevant packages:\n next: (?<version>\d+\.\d+\.\d+)/
)?.groups?.version
if (!g) {
a.info(`Reported Next.js version: ${_}`)
if (!_) {
return
}
const { tag_name: w } = await (await c.repos.listReleases(i)).data[0]
if (w.includes('canary') && g !== w) {
return await notifyOnIssue(
const { tag_name: T } = await (await v.repos.listReleases(o)).data[0]
a.info(`Last Next.js version, based on GitHub releases: ${T}`)
if (T.includes('canary') && _ !== T) {
await notifyOnIssue(
t,
`The reported Next.js version did not match the latest \`next@canary\` version (${w}). The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running \`npm install next@canary\`. If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.`
`The reported Next.js version did not match the latest \`next@canary\` version (${T}). The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running \`npm install next@canary\`. If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.`
)
return a.info(
`Commented on issue ${m}, because it was not verified against canary.`
)
}
} catch (e) {
Expand Down
62 changes: 48 additions & 14 deletions .github/actions/issue-validator/src/index.js
Expand Up @@ -5,6 +5,7 @@ import * as core from '@actions/core'
const verifyCanaryLabel = 'please verify canary'
const bugReportLabel = 'template: bug'
const addReproductionLabel = 'please add a complete reproduction'
const debug = !!process.env.DEBUG

async function run() {
try {
Expand All @@ -17,17 +18,22 @@ async function run() {

const { body, labels, number: issueNumber } = issue

const isBugReport = labels.some((label) => label.name === bugReportLabel)

const isManuallyLabeled = labels.some(
(label) => label.name === verifyCanaryLabel
)

const isBugReport = labels.some((label) => label.name === bugReportLabel)
if (!isBugReport || !isManuallyLabeled) {
return core.info(
`issue ${issueNumber} is ignored, because it is not a bug report or is not manually labeled`
)
}

if (!process.env.GITHUB_TOKEN) {
return core.setFailed('GITHUB_TOKEN is not set')
throw new Error('GITHUB_TOKEN is not set')
}

// @ts-ignore
const client = github.getOctokit(process.env.GITHUB_TOKEN).rest

/**
Expand All @@ -37,6 +43,12 @@ async function run() {
function notifyOnIssue(label, comment) {
const issueCommon = { ...repo, issue_number: issueNumber }

if (debug) {
core.info('Skipping comment/label because we are in DEBUG mode')
core.info(JSON.stringify({ label, comment }, null, 2))
return
}

return Promise.all([
client.issues.addLabels({ ...issueCommon, labels: [label] }),
client.issues.createComment({ ...issueCommon, body: comment }),
Expand All @@ -47,33 +59,50 @@ async function run() {
'- [X] I verified that the issue exists in Next.js canary release'
)

if (
!isVerifyCanaryChecked || // This can happen if the issue was from a comment in another issue or discussion.
isManuallyLabeled
) {
return await notifyOnIssue(
if (!isVerifyCanaryChecked || isManuallyLabeled) {
await notifyOnIssue(
verifyCanaryLabel,
'Please verify your issue reproduces with `next@canary`. The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running `npm install next@canary`. If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.'
)
return core.info(
`Commented on issue ${issueNumber}, because it was ${
isManuallyLabeled ? 'manually labeled' : 'not verified against canary'
}`
)
}

if (!isBugReport) return

const reproductionUrl = body
.match(/### Link to reproduction\n\n(?<url>.*)\n/)
?.groups?.url.trim()

if (!reproductionUrl || !(await (await fetch(reproductionUrl)).ok)) {
return await notifyOnIssue(
if (!reproductionUrl || !(await fetch(reproductionUrl)).ok) {
await notifyOnIssue(
addReproductionLabel,
'The link to the reproduction appears to be incorrect/unreachable. Please add a link to the reproduction of the issue. This is a required field.'
'The link to the reproduction appears to be incorrect/unreachable. Please add a link to the reproduction of the issue. This is a required field. If your project is private, you can invite @balazsorban44 to the repository so the Next.js team can investigate further.'
)
return core.info(
`Commented on issue ${issueNumber}, because it the reproduction url (${reproductionUrl}) was not reachable.`
)
}

const containsNextInfoOutput = [
'Operating System:',
'Binaries:',
'Relevant packages:',
].every((i) => body.includes(i))

if (!containsNextInfoOutput) {
return core.info(
'Could not detect `next info` output, skipping as version detection might be unreliable'
)
}

const reportedNextVersion = body.match(
/Relevant packages:\n next: (?<version>\d+\.\d+\.\d+)/
)?.groups?.version

core.info(`Reported Next.js version: ${reportedNextVersion}`)

if (!reportedNextVersion) {
// REVIEW: Should we add a label here?
return
Expand All @@ -83,11 +112,16 @@ async function run() {
await client.repos.listReleases(repo)
).data[0]

core.info(`Last Next.js version, based on GitHub releases: ${lastVersion}`)

if (lastVersion.includes('canary') && reportedNextVersion !== lastVersion) {
return await notifyOnIssue(
await notifyOnIssue(
verifyCanaryLabel,
`The reported Next.js version did not match the latest \`next@canary\` version (${lastVersion}). The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running \`npm install next@canary\`. If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.`
)
return core.info(
`Commented on issue ${issueNumber}, because it was not verified against canary.`
)
}
} catch (error) {
core.setFailed(error.message)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_test_deploy.yml
Expand Up @@ -8,7 +8,7 @@ name: Build, test, and deploy

env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.3.1
TURBO_VERSION: 1.3.2-canary.1
RUST_TOOLCHAIN: nightly-2022-02-23
PNPM_VERSION: 7.2.1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_stats.yml
Expand Up @@ -6,7 +6,7 @@ name: Generate Pull Request Stats

env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.3.1
TURBO_VERSION: 1.3.2-canary.1
RUST_TOOLCHAIN: nightly-2022-02-23
PNPM_VERSION: 7.2.1

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validate_issue.yml
Expand Up @@ -11,3 +11,4 @@ jobs:
- uses: ./.github/actions/issue-validator
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: 1
24 changes: 24 additions & 0 deletions errors/invalid-next-config.md
@@ -0,0 +1,24 @@
# Invalid next.config.js

#### Why This Error Occurred

In your `next.config.js` file you passed invalid options that either are the incorrect type or an unknown field.

#### Possible Ways to Fix It

Fixing the listed config errors will remove this warning. You can also leverage the `NextConfig` type by importing from `next` to help ensure your config is correct.

```ts
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
/* config options here */
}

module.exports = nextConfig
```

### Useful Links

- [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/introduction)
4 changes: 4 additions & 0 deletions errors/manifest.json
Expand Up @@ -711,6 +711,10 @@
{
"title": "node-module-in-edge-runtime",
"path": "/errors/node-module-in-edge-runtime.md"
},
{
"title": "invalid-next-config",
"path": "/errors/invalid-next-config.md"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion examples/with-cookie-auth-fauna/utils/fauna-auth.js
Expand Up @@ -10,7 +10,8 @@ export const serverClient = new faunadb.Client({
// Used for any authed requests.
export const faunaClient = (secret) =>
new faunadb.Client({
secret,
secret: secret,
domain: process.env.FAUNA_DB_DOMAIN ?? 'db.fauna.com',
})

export const serializeFaunaCookie = (userSecret) => {
Expand Down
6 changes: 5 additions & 1 deletion examples/with-fauna/scripts/setup.js
Expand Up @@ -140,7 +140,11 @@ const findImportError = (msg) => {

const main = async () => {
const adminKey = await resolveAdminKey()
const client = new Client({ secret: adminKey })

const client = new Client({
secret: adminKey,
domain: process.env.FAUNA_DB_DOMAIN ?? 'db.fauna.com',
})

if (await isDatabasePrepared({ client })) {
return console.info(
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "12.2.3-canary.5"
"version": "12.2.3-canary.6"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -196,7 +196,7 @@
"taskr": "1.1.0",
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "1.3.1",
"turbo": "1.3.2-canary.1",
"typescript": "4.6.3",
"wait-port": "0.2.2",
"webpack": "link:node_modules/webpack5",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "12.2.3-canary.5",
"version": "12.2.3-canary.6",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "12.2.3-canary.5",
"version": "12.2.3-canary.6",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
"directory": "packages/eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "12.2.3-canary.5",
"@next/eslint-plugin-next": "12.2.3-canary.6",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.21.0",
"eslint-import-resolver-node": "^0.3.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "12.2.3-canary.5",
"version": "12.2.3-canary.6",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "12.2.3-canary.5",
"version": "12.2.3-canary.6",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "12.2.3-canary.5",
"version": "12.2.3-canary.6",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "12.2.3-canary.5",
"version": "12.2.3-canary.6",
"keywords": [
"react",
"next",
Expand Down

0 comments on commit f1069e7

Please sign in to comment.