Skip to content

Commit a5b8047

Browse files
fix: support appDir (#1638)
* chore: update canary demo * chore: add app-dir demo * fix: resolve page deps in app dir * fix: patch duplicate declaration * fix: resolve nft deps * feat: add support for appdir edge runtime * chore: update next canary and react (and change APIs) * fix: update patch syntax * fix: include file itself in deps * chore: upgrade next and remove workaround * chore: move app-dir site to canary * chore: update snapshot * chore: add initial app-dir tests * chore: use correct site for canary tests * chore: enable plugin * ci: use vitest for canary e2e tests * chore: re-enable plugin * chore: setup playwright * chore: wait longer when first using playwright * chore: run tests headless * chore: install chromium * chore: longer timeout * chore: use undici * chore: enable remaining tests * chore: fix test syntax * chore: update demos * chore: update canary * chore: fix 404 test * chore: disable test that depends on an upstream fix * chore: fix handling of "self" object * chore: update packages * chore: update canary * chore: tidy and add license for next.js code * chore: handle empty static manifest * chore: downgrasde canary because of regression * chore: logging for windows * Apply suggestions from code review Co-authored-by: Erica Pisani <[email protected]> * chore: update next canary * chore: remove npmrc * chore: update next and react * chore: update test site * chore: update tests * chore: add back npmrc This reverts commit 40480f4. * fix: use globby not tiny-glob * chore: update fixtures * chore: deps * chore: update tests and demo * fix: correct request types * fix: skip generating lambda for edge api routes * chore: log request * chore: add runtime as dep * chore: pre-version * chore: add canary to ws * chore: fix build * chore: fix monorepo setup * chore: upgrade * chore: react no-longer pre-bundled * chore: remove deliberately broken demo pages * fix: move pre-rendered appdir files * fix: correct manifest path * chore: update demo * chore: update tests * chore: add sass test * chore: update demo config * chore: skip test that also fails upstream * chore: update next canary * chore: update use usage * chore: update canary * fix: support loading static files for both pages and app * chore: update canary * chore: update canary * chore: final canary! * chore(deps): update demos and deps to Next 13 * chore: add swc * chore: switch old node tests to use node 14 * fix: correct requestdata type * chore: update next/link syntax * chore: use legacy image component for now * chore: update demo * chore: update canary demo * chore: all the tests * chore: fix eslint * chore: parallelise e2e tests * chore: don't fail fast * chore: unignore modules and use node-fetch * chore: very parallel * chore: don't mock fetch 🤦 * chore: remove disabled tests * chore: test with node 18 * chore: switchable fetch * chore: remove irrelevant tests * chore: remove disabled test * chore: add reporter * chore: no concurrency * chore: try to fix jest * chore: fix test command * chore: artifact file path * chore: use site build command * chore: download artifacts * chore: report per-chunk * chore: update syntax * chore: report to summary * chore: do annotate * chore: update and add summary * chore: rearrange * chore: combine tests * chore: fix test * chore: rearrange and disable failing suites * chore: skip broken ntl and fail faster * chore: disable suite * chore: skip failing tests * chore: add ability to run disabled tests * chore: add comments to workflow file * chore: one worker per file * chore: oops * chore: make path relative to test dir * chore: conditionally skip * chore: enable middleware-responses test * chore: run all tests once * chore: don't run disabled tests * fix: ensure responses are Responses * chore: re-enable test * chore: run all tests * chore: enable another suite * fix: better headers.getAll polyfill * chore: enable middleware-redirects suite * chore: conditionally enable req body tests * chore: disable failing tests * chore: add test readme doc * chore: remove eslint changes * chore: add new appdir tests * chore: use canary for appdir tests * chore: use extended matchers * chore: increase timeout * chore: enable tests that were disabled upstream * chore: don't clobber package.json in tests * chore: set EdgeRuntime name globally * chore: remove logs * chore: update tests * chore: test updates * chore: increase timeout * chore: increase timeout for site deploy * chore: include step annotations * chore: don't use canary demo for this * chore: increase timeout * chore: add rewrite-to-edge demo * chore: deploy edge functions after cache * chore: refresh lockfile * chore: enable rewrite tests * chore: update tests * chore: update tests * chore: enable rsc tests * chore: skip tests * chore: re-enable dev check * chore: update lockfile * chore: run workflows only on new pr and pr sync * chore: add log about testing appdir * chore: only use cache: manual if site uses appDir * chore: changes from review * ci: fix e2e test * fix: correctly match static files against rewrites * chore: upgrade next * chore: increase timeout * chore: extend timeout * fix: handle prefetch correctly * chore: rmeove log * chore: log env * chore: enough with these rules * chore: fix base url * chore: try with all tests * chore: don't run disabled tests * fix: vary on prefetch Co-authored-by: Erica Pisani <[email protected]>
1 parent 9aa4c38 commit a5b8047

File tree

598 files changed

+11828
-1178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

598 files changed

+11828
-1178
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = {
2929
'unicorn/filename-case': 0,
3030
'unicorn/no-array-push-push': 0,
3131
'unicorn/numeric-separators-style': 0,
32+
'max-lines': 0,
3233
},
3334
parserOptions: {
3435
sourceType: 'module',

.github/workflows/cypress-canary.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run e2e (canary demo)
22
on:
33
pull_request:
4-
types: [opened, labeled, unlabeled, synchronize]
4+
types: [opened, synchronize]
55
push:
66
branches:
77
- main

.github/workflows/cypress-demo-nx.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run e2e (Nx monorepo)
22
on:
33
pull_request:
4-
types: [opened, labeled, unlabeled, synchronize]
4+
types: [opened, synchronize]
55
push:
66
branches:
77
- main

.github/workflows/cypress-demo-static.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run e2e (static root)
22
on:
33
pull_request:
4-
types: [opened, labeled, unlabeled, synchronize]
4+
types: [opened, synchronize]
55
push:
66
branches:
77
- main

.github/workflows/cypress-demo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run e2e (default demo)
22
on:
33
pull_request:
4-
types: [opened, labeled, unlabeled, synchronize]
4+
types: [opened, synchronize]
55
push:
66
branches:
77
- main

.github/workflows/cypress-middleware.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run e2e (middleware demo)
22
on:
33
pull_request:
4-
types: [opened, labeled, unlabeled, synchronize]
4+
types: [opened, synchronize]
55
push:
66
branches:
77
- main

.github/workflows/e2e-appdir.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Next.js appdir test suite
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
setup:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
test-files: ${{ steps['set-test-files'].outputs['test-files'] }}
14+
steps:
15+
- uses: actions/checkout@v3
16+
- run: npm install
17+
- id: set-test-files
18+
name: Get test files
19+
# Extracts the list of all test files as JSON and trims to be relative to the test dir to be easier to read
20+
run:
21+
echo "test-files=$(npx jest -c test/e2e/jest.config.appdir.js --listTests --json | jq -cM 'map(.[env.PWD |
22+
length + 10:])')" >> $GITHUB_OUTPUT
23+
# echo "test-files=$(npx jest -c test/e2e/jest.config.all.js --listTests --json | jq -cM 'map(.[env.PWD | length
24+
# + 10:])')" >> $GITHUB_OUTPUT
25+
26+
test:
27+
runs-on: ubuntu-latest
28+
name: test (${{ matrix.test-file }})
29+
needs:
30+
- setup
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
# Creates a job for each chunk ID. This will be assigned one or more test files to run
35+
test-file: ${{ fromJson(needs.setup.outputs['test-files']) }}
36+
steps:
37+
- uses: actions/checkout@v3
38+
- run: npm install
39+
- name: Run tests
40+
run: npx jest --reporters=jest-junit --reporters=default -c test/e2e/jest.config.all.js ${{ matrix.test-file }}
41+
env:
42+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_BOT_AUTH_TOKEN }}
43+
NETLIFY_SITE_ID: 1d5a5c76-d445-4ae5-b694-b0d3f2e2c395
44+
NEXT_TEST_VERSION: canary
45+
- uses: actions/upload-artifact@v3
46+
if: ${{ always() }}
47+
name: Upload test results
48+
with:
49+
name: test-results
50+
path: reports/jest-*.xml
51+
report:
52+
name: Report appDir e2e test results
53+
runs-on: ubuntu-latest
54+
if: ${{ always() }}
55+
needs:
56+
- test
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: actions/download-artifact@v3
60+
with:
61+
path: reports
62+
- name: Combine reports
63+
# The test reporter can handle multiple files, but these have random filenames so the output is better when combined
64+
run: npx junit-report-merger test-results.xml reports/**/*.xml
65+
- uses: phoenix-actions/test-reporting@v10
66+
with:
67+
name: Jest Tests
68+
output-to: 'step-summary'
69+
path: 'test-results.xml'
70+
max-annotations: 49
71+
reporter: jest-junit

.github/workflows/e2e-next.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Next.js e2e test suite
22

33
on:
44
pull_request:
5+
types: [opened, synchronize]
56
push:
67
branches: [main]
78

@@ -41,17 +42,6 @@ jobs:
4142
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_BOT_AUTH_TOKEN }}
4243
NETLIFY_SITE_ID: 1d5a5c76-d445-4ae5-b694-b0d3f2e2c395
4344
# RUN_SKIPPED_TESTS: true
44-
# - uses: phoenix-actions/test-reporting@v10
45-
# if: ${{ always() }}
46-
# name: Report Test Results
47-
# # Generates annotations for the test failures
48-
# id: test-report
49-
# with:
50-
# name: E2E Test chunk ${{ matrix.chunk }}
51-
# path: 'reports/**/*.xml' # Path to test results (inside artifact .zip)
52-
# output-to: 'checks'
53-
# max-annotations: 49 # Maximum number of annotations to be created
54-
# reporter: jest-junit # Format of test results
5545

5646
- uses: actions/upload-artifact@v3
5747
# upload test results
@@ -61,6 +51,7 @@ jobs:
6151
name: test-results
6252
path: reports/jest-*.xml
6353
report:
54+
name: Report Next.js e2e test results
6455
runs-on: ubuntu-latest
6556
if: ${{ always() }}
6657
needs:

cypress/integration/nx/general.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ describe('Default site', () => {
1010
cy.url().should('eq', `${Cypress.config().baseUrl}/`)
1111
})
1212

13-
it('serves generated public files', async () => {
14-
cy.request('service-worker.js').then((res) => {
13+
it('serves generated public files', () => {
14+
cy.request('favicon.ico').then((res) => {
1515
expect(res.status).to.eq(200)
16-
expect(res.headers['content-type']).to.match(/javascript/)
16+
expect(res.headers['content-type']).to.match(/image/)
1717
})
1818
})
1919

demos/base-path/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"typescript": "^4.6.3"
1515
},
1616
"dependencies": {
17-
"next": "^13.0.3"
17+
"next": "^13.0.6"
1818
},
1919
"scripts": {
2020
"test": "echo \"Error: no test specified\" && exit 1"

demos/custom-routes/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"typescript": "^4.7.4"
1616
},
1717
"dependencies": {
18-
"next": "^13.0.3"
18+
"next": "^13.0.6"
1919
},
2020
"scripts": {
2121
"build": "next build",

demos/default/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@reach/dialog": "^0.16.2",
2323
"@reach/visually-hidden": "^0.16.0",
2424
"@vercel/og": "^0.0.21",
25-
"next": "^13.0.3",
25+
"next": "^13.0.6",
2626
"react": "^18.2.0",
2727
"react-dom": "^18.2.0"
2828
},

demos/middleware/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@netlify/next": "*",
1313
"@netlify/plugin-nextjs": "*",
1414
"isomorphic-unfetch": "^3.1.0",
15-
"next": "^13.0.3",
15+
"next": "^13.0.6",
1616
"react": "^18.2.0",
1717
"react-dom": "^18.2.0"
1818
},

demos/next-auth/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
],
2424
"license": "MIT",
2525
"dependencies": {
26-
"next": "^13.0.3",
26+
"next": "^13.0.6",
2727
"next-auth": "^4.15.0",
2828
"nodemailer": "^6.6.3",
2929
"react": "^18.2.0",

demos/next-export/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "",
55
"dependencies": {
6-
"next": "^13.0.3"
6+
"next": "^13.0.6"
77
},
88
"devDependencies": {
99
"@netlify/next": "*",

demos/next-i18next/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"next": "^13.0.3",
12+
"next": "^13.0.6",
1313
"next-i18next": "^11.0.0",
1414
"react": "^18.2.0",
1515
"react-dom": "^18.2.0"
Binary file not shown.

0 commit comments

Comments
 (0)