Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[legacy-framework] Upgrade next.js to 11.1.0 #2656

Merged
merged 18 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ eslint.config.*
/nextjs/packages/next-codemod/**/*.js
/nextjs/packages/next-codemod/**/*.d.ts
/nextjs/packages/next-env/**/*.d.ts
/nextjs/packages/next/build/swc/tests/fixture/**
/nextjs/test/integration/async-modules/**
/nextjs/test/integration/eslint/**
/nextjs/test/integration/babel/**
/nextjs/test-timings.json
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
parser: "babel-eslint",
parser: "@babel/eslint-parser",
env: {
browser: true,
commonjs: true,
Expand All @@ -8,10 +8,18 @@ module.exports = {
},
parserOptions: {
ecmaVersion: 6,
requireConfigFile: false,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
babelOptions: {
presets: ["@babel/preset-env", "@babel/preset-react"],
caller: {
// Eslint supports top level await when a parser for it is included. We enable the parser by default for Babel.
supportsTopLevelAwait: true,
},
},
},
plugins: ["import", "unicorn", "simple-import-sort"],
extends: ["react-app"],
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
run: yarn manypkg check
env:
CI: true
- name: Build next.js
run: yarn build:nextjs
- name: Build packages
run: yarn build
env:
CI: true
- name: yarn lint
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}
- run: ./check-pre-compiled.sh
- run: ./scripts/check-pre-compiled.sh

testUnit:
name: Nextjs - Test Unit
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ db.sqlite-journal
test/integration/**/db.json
test/**/*/out
.blitz**

42 changes: 39 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
6. Resolve all merge conflicts and complete merge
7. Run `yarn` and make sure all builds complete
8. Run `yarn lint` and fix any issues
9. `git push`
4. Run `yarn pull next-nextjs`
9. Commit all changes to finish merge
10. `git push`
4. Run `yarn pull-nextjs`
5. Run `yarn`
6. Run `yarn manypkg check` and optionally `yarn manypkg fix` to fix any issues
7. Under `nextjs/`, run `./check-pre-compiled.sh` and commit the changes
7. Under `nextjs/`, run `./scripts/check-pre-compiled.sh` and commit the changes
8. Run `yarn build:nextjs`
9. Run `yarn lint` - fix any issues
10. Run `yarn build` - fix any issues
Expand All @@ -33,3 +34,38 @@
14. Any doc updates needed?
15. Merge PR
16. `yarn push-nextjs`

#### Troubleshooting

##### yarn lint - Failed to load parser

Caused by invalid version of `@babel/eslint-parser`. `7.13.14` is a working version. I think it may be an incompatibility between this version and the version of eslint?

- change version of eslint-parser
- run `yarn --check-files`
- run `./scripts/check-pre-compiled.sh` from `./nextjs/`
- run `yarn build:nextjs` from root
- Try linting again

```
~/c/blitz> yarn lint
yarn run v1.22.10
$ eslint --ext ".js,.ts,.tsx" .

Oops! Something went wrong! :(

ESLint: 7.21.0

Error: Failed to load parser './parser.js' declared in 'examples/auth/.eslintrc.js » eslint-config-blitz » eslint-config-next': Cannot find module '@babel/parser'
at webpackEmptyContext (/Users/b/c/blitz/nextjs/packages/next/dist/compiled/babel/bundle.js:1:33258)
at Object.73139 (/Users/b/c/blitz/nextjs/packages/next/dist/compiled/babel/bundle.js:2194:783181)
at __nccwpck_require__ (/Users/b/c/blitz/nextjs/packages/next/dist/compiled/babel/bundle.js:2194:1065271)
at Object.eslintParser (/Users/b/c/blitz/nextjs/packages/next/dist/compiled/babel/bundle.js:1:43676)
at Object.<anonymous> (/Users/b/c/blitz/nextjs/packages/next/dist/compiled/babel/eslint-parser.js:1:100)
at Module._compile (/Users/b/c/blitz/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
error Command failed with exit code 2.
```
1 change: 0 additions & 1 deletion examples/fauna/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@testing-library/react-hooks": "^4.0.1",
"@types/react": "17.0.2",
"@types/secure-password": "3.1.0",
"babel-eslint": "~10.1.0",
"eslint": "7.21.0",
"eslint-config-react-app": "~6.0.0",
"eslint-plugin-flowtype": "~5.2.0",
Expand Down
1 change: 0 additions & 1 deletion examples/no-prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
},
"devDependencies": {
"@types/react": "17.0.2",
"babel-eslint": "~10.1.0",
"eslint": "7.21.0",
"eslint-config-react-app": "~6.0.0",
"eslint-plugin-flowtype": "~5.2.0",
Expand Down
1 change: 0 additions & 1 deletion examples/plain-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"react-dom": "0.0.0-experimental-6a589ad71"
},
"devDependencies": {
"babel-eslint": "~10.1.0",
"eslint": "7.21.0",
"eslint-config-react-app": "~6.0.0",
"eslint-plugin-flowtype": "~5.2.0",
Expand Down
2 changes: 0 additions & 2 deletions nextjs/.alexignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
CODE_OF_CONDUCT.md
docs/
errors/
examples/
21 changes: 21 additions & 0 deletions nextjs/.alexrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"allow": [
"attacks",
"color",
"dead",
"execute",
"executed",
"executes",
"execution",
"executions",
"failed",
"failure",
"failures",
"fire",
"fires",
"hook",
"hooks",
"host-hostess",
"invalid"
]
}
5 changes: 5 additions & 0 deletions nextjs/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ e2e-tests/**
examples/with-eslint/**
examples/with-typescript-eslint-jest/**
examples/with-kea/**
examples/with-custom-babel-config/**
examples/with-flow/**
examples/with-mobx-state-tree/**
examples/with-mobx/**
packages/next/bundles/webpack/packages/*.runtime.js
packages/next/compiled/**/*
packages/react-refresh-utils/**/*.js
Expand All @@ -21,3 +25,4 @@ packages/create-next-app/templates/**
test/integration/async-modules/**
test/integration/eslint/**
test-timings.json
packages/next/build/swc/tests/fixture/**
11 changes: 9 additions & 2 deletions nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"plugins": ["react", "react-hooks", "jest", "import"],
"env": {
"browser": true,
Expand All @@ -9,10 +9,17 @@
"node": true
},
"parserOptions": {
"ecmaVersion": 2018,
"requireConfigFile": false,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"babelOptions": {
"presets": ["@babel/preset-env", "@babel/preset-react"],
"caller": {
// Eslint supports top level await when a parser for it is included. We enable the parser by default for Babel.
"supportsTopLevelAwait": true
}
}
},
"settings": {
Expand Down
6 changes: 3 additions & 3 deletions nextjs/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Learn how to add code owners here:
# https://help.github.com/en/articles/about-code-owners

* @timneutkens @ijjk @lfades @divmain @shuding
/docs/ @timneutkens @ijjk @lfades @divmain @shuding @leerob
/examples/ @timneutkens @ijjk @lfades @divmain @shuding @leerob
* @timneutkens @ijjk @shuding @styfle @huozhi @padmaia
/docs/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @lfades
/examples/ @timneutkens @ijjk @shuding @leerob @lfades
8 changes: 6 additions & 2 deletions nextjs/.github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,17 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
logger(`Running initial build for ${dir}`)
if (!actionInfo.skipClone) {
let buildCommand = `cd ${dir}${
!statsConfig.skipInitialInstall ? ' && yarn install' : ''
!statsConfig.skipInitialInstall
? ' && yarn install --network-timeout 1000000'
: ''
}`

if (statsConfig.initialBuildCommand) {
buildCommand += ` && ${statsConfig.initialBuildCommand}`
}
await exec(buildCommand)
// allow 5 minutes node_modules install + building all packages
// in case of noisy environment slowing down initial repo build
await exec(buildCommand, false, { timeout: 5 * 60 * 1000 })
}

logger(`Linking packages in ${dir}`)
Expand Down
15 changes: 13 additions & 2 deletions nextjs/.github/labeler.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@
"packages/react-refresh-utils/**",
"packages/next-codemod/**"
],
"type: chrome": [
"created-by: Chrome Aurora": [
{ "type": "user", "pattern": "spanicker" },
{ "type": "user", "pattern": "housseindjirdeh" },
{ "type": "user", "pattern": "devknoll" },
{ "type": "user", "pattern": "janicklas-ralph" },
{ "type": "user", "pattern": "atcastle" },
{ "type": "user", "pattern": "Joonpark13" }
{ "type": "user", "pattern": "kyliau" },
{ "type": "user", "pattern": "kara" }
],
"created-by: Next.js team": [
{ "type": "user", "pattern": "ijjk" },
{ "type": "user", "pattern": "padmaia" },
{ "type": "user", "pattern": "huozhi" },
{ "type": "user", "pattern": "shuding" },
{ "type": "user", "pattern": "sokra" },
{ "type": "user", "pattern": "styfle" },
{ "type": "user", "pattern": "leerob" },
{ "type": "user", "pattern": "timneutkens" }
]
}
}
2 changes: 2 additions & 0 deletions nextjs/.github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Choose the right checklist for the change that you're making:

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

Expand All @@ -16,6 +17,7 @@ Choose the right checklist for the change that you're making:
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

Expand Down
Loading