Skip to content

Commit 9858d7a

Browse files
authored
build: migrate to Next.js 13, React 18, Github Action v4 (#109)
* build: upgrage to next.js 13 react 18 * chore: change import for next/image * fix: use legacy behavior for links * ci: use Node.js 18 * ci: upgrade Github Actions to v4 * feat: use new Image component and fix icon issue * style: fix typo * refactor: migrate to the new Link * fix: fix hydration error on listing page * chore: increase large data threashold to 1 MB * ci: upgrade await action to v2 * ci: fix incorrect Vercel deployment URL * ci: pass new secret fot Vercel Team
1 parent 69c1eec commit 9858d7a

20 files changed

+3203
-17643
lines changed

.github/workflows/failsafe.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]')
2121
secrets:
2222
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
23+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
24+
VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}
2325

2426
failsafe-generation-stage:
2527
name: Failsafe Page Generation (Stage Deployment)
@@ -31,11 +33,11 @@ jobs:
3133
VERCEL_URL: ${{ needs.wait-for-deployment.outputs.vercel-deployment-url }}
3234
steps:
3335
- name: Checkout project source
34-
uses: actions/checkout@v2
36+
uses: actions/checkout@v4
3537
- name: Use Node.js
36-
uses: actions/setup-node@v2
38+
uses: actions/setup-node@v4
3739
with:
38-
node-version: 16.x
40+
node-version: 18.x
3941
- name: Install dependency
4042
run: npm install --legacy-peer-deps
4143
- name: Run failsafe generation
@@ -44,7 +46,7 @@ jobs:
4446
run: npx playwright install --with-deps
4547
- name: Run failsafe e2e tests
4648
run: npm run test:e2e:failsafe
47-
- uses: actions/upload-artifact@v2
49+
- uses: actions/upload-artifact@v4
4850
if: always()
4951
with:
5052
name: stage-deployment-failsafe-test-report
@@ -62,11 +64,11 @@ jobs:
6264
NEXT_PUBLIC_APP_ENV: production
6365
steps:
6466
- name: Checkout project source
65-
uses: actions/checkout@v2
67+
uses: actions/checkout@v4
6668
- name: Use Node.js
67-
uses: actions/setup-node@v2
69+
uses: actions/setup-node@v4
6870
with:
69-
node-version: 16.x
71+
node-version: 18.x
7072
- name: Install dependency
7173
run: npm install --legacy-peer-deps
7274
- name: Run failsafe generation
@@ -75,7 +77,7 @@ jobs:
7577
run: npx playwright install --with-deps
7678
- name: Run failsafe e2e tests
7779
run: npm run test:e2e:failsafe
78-
- uses: actions/upload-artifact@v2
80+
- uses: actions/upload-artifact@v4
7981
if: always()
8082
with:
8183
name: production-deployment-failsafe-test-report
@@ -93,11 +95,11 @@ jobs:
9395
NEXT_PUBLIC_APP_ENV: production
9496
steps:
9597
- name: Checkout project source
96-
uses: actions/checkout@v2
98+
uses: actions/checkout@v4
9799
- name: Use Node.js
98-
uses: actions/setup-node@v2
100+
uses: actions/setup-node@v4
99101
with:
100-
node-version: 16.x
102+
node-version: 18.x
101103
- name: Install dependency
102104
run: npm install --legacy-peer-deps
103105
- name: Run failsafe generation
@@ -106,7 +108,7 @@ jobs:
106108
run: npx playwright install --with-deps
107109
- name: Run failsafe e2e tests
108110
run: npm run test:e2e:failsafe
109-
- uses: actions/upload-artifact@v2
111+
- uses: actions/upload-artifact@v4
110112
if: always()
111113
with:
112114
name: production-schedule-failsafe-test-report

.github/workflows/playwright.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]')
1515
secrets:
1616
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
17+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
18+
VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}
1719

1820
playwright-e2e-test-stage:
1921
name: Playwright E2E Tests (Stage Deployment)
@@ -25,17 +27,17 @@ jobs:
2527
NEXT_PUBLIC_APP_ENV: stage
2628
VERCEL_URL: ${{ needs.wait-for-deployment.outputs.vercel-deployment-url }}
2729
steps:
28-
- uses: actions/checkout@v2
29-
- uses: actions/setup-node@v2
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
3032
with:
31-
node-version: '16.x'
33+
node-version: 18.x
3234
- name: Install dependencies
3335
run: npm ci --legacy-peer-deps
3436
- name: Install Playwright Browsers
3537
run: npx playwright install --with-deps
3638
- name: Run Playwright tests
3739
run: npm run test:e2e:page; npm run test:e2e:api;
38-
- uses: actions/upload-artifact@v2
40+
- uses: actions/upload-artifact@v4
3941
if: always()
4042
with:
4143
name: stage-deployment-page-api-test-report
@@ -54,17 +56,17 @@ jobs:
5456
env:
5557
NEXT_PUBLIC_APP_ENV: production
5658
steps:
57-
- uses: actions/checkout@v2
58-
- uses: actions/setup-node@v2
59+
- uses: actions/checkout@v4
60+
- uses: actions/setup-node@v4
5961
with:
60-
node-version: '16.x'
62+
node-version: 18.x
6163
- name: Install dependencies
6264
run: npm ci --legacy-peer-deps
6365
- name: Install Playwright Browsers
6466
run: npx playwright install --with-deps
6567
- name: Run Playwright tests
6668
run: npm run test:e2e:page; npm run test:e2e:api;
67-
- uses: actions/upload-artifact@v2
69+
- uses: actions/upload-artifact@v4
6870
if: always()
6971
with:
7072
name: production-deployment-page-api-test-report
@@ -82,17 +84,17 @@ jobs:
8284
env:
8385
NEXT_PUBLIC_APP_ENV: production
8486
steps:
85-
- uses: actions/checkout@v2
86-
- uses: actions/setup-node@v2
87+
- uses: actions/checkout@v4
88+
- uses: actions/setup-node@v4
8789
with:
88-
node-version: '16.x'
90+
node-version: 18.x
8991
- name: Install dependencies
9092
run: npm ci --legacy-peer-deps
9193
- name: Install Playwright Browsers
9294
run: npx playwright install --with-deps
9395
- name: Run Playwright tests
9496
run: npm run test:e2e:page; npm run test:e2e:api;
95-
- uses: actions/upload-artifact@v2
97+
- uses: actions/upload-artifact@v4
9698
if: always()
9799
with:
98100
name: production-schedule-page-api-test-report

.github/workflows/release-note.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
HUSKY: 0
1414
steps:
1515
- name: Checkout project source
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
- name: Use Node.js
18-
uses: actions/setup-node@v2
18+
uses: actions/setup-node@v4
1919
with:
20-
node-version: 16.x
20+
node-version: 18.x
2121
- name: Install dependency
2222
run: npm ci --legacy-peer-deps
2323
- name: Release Note

.github/workflows/semgrep-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
if: (github.actor != 'dependabot[bot]')
2626
steps:
2727
# Checkout project source
28-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v4
2929

3030
# Scan code using project's configuration on https://semgrep.dev/manage
3131
- name: Semgrep Scan

.github/workflows/vercel-deployment.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
secrets:
1010
VERCEL_TOKEN:
1111
required: true
12+
VERCEL_PROJECT_ID:
13+
required: true
14+
VERCEL_TEAM_ID:
15+
required: true
1216

1317
env:
1418
VERCEL_FETCH_DEPLOYMENTS_API_ENDPOINT: https://api.vercel.com/v6/deployments
@@ -28,14 +32,15 @@ jobs:
2832
echo "Fetching Vercel deployments using API endpoint: " $VERCEL_FETCH_DEPLOYMENTS_API_ENDPOINT
2933
3034
# Fetch all Vercel deployment from this project
31-
ALL_VERCEL_DEPLOYMENTS=`curl -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}' $VERCEL_FETCH_DEPLOYMENTS_API_ENDPOINT`
35+
API_ENDPOINT="${VERCEL_FETCH_DEPLOYMENTS_API_ENDPOINT}?projectId=${{ secrets.VERCEL_PROJECT_ID }}&teamId=${{ secrets.VERCEL_TEAM_ID }}"
36+
ALL_VERCEL_DEPLOYMENTS=`curl -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}' $API_ENDPOINT`
3237
echo "Vercel deployments: " $ALL_VERCEL_DEPLOYMENTS
3338
3439
# Parse the deployments (as json) to find the latest deployment url, while stripping the double quotes
3540
VERCEL_DEPLOYMENT_URL=`echo $ALL_VERCEL_DEPLOYMENTS | jq '.deployments [0].url' | tr -d \"`
3641
echo "VERCEL_DEPLOYMENT_URL=$VERCEL_DEPLOYMENT_URL" >> $GITHUB_ENV
3742
- name: Wait for Vercel deployment to be ready
38-
uses: UnlyEd/github-action-await-vercel@v1
43+
uses: UnlyEd/github-action-await-vercel@v2
3944
id: await-vercel
4045
env:
4146
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
@@ -44,6 +49,6 @@ jobs:
4449
timeout: 240 # Wait for 4 mins before failing
4550
- name: Expose Vercel deployment info
4651
id: expose-vercel-deployment
47-
run: echo "::set-output name=vercel-deployment-url::${{ env.VERCEL_DEPLOYMENT_URL }}"
52+
run: echo "vercel-deployment-url=${{ env.VERCEL_DEPLOYMENT_URL }}" >> $GITHUB_OUTPUT
4853
- name: Display Vercel deployment status
4954
run: 'echo The deployment at ${{ fromJson(steps.await-vercel.outputs.deploymentDetails).url }} is ${{ fromJson(steps.await-vercel.outputs.deploymentDetails).readyState }}'

next.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ module.exports = withBundleAnalyzer({
5252
domains: ['images.unsplash.com', 'www.notion.so', 'dazedbear.notion.site'],
5353
},
5454

55+
experimental: {
56+
largePageDataBytes: 1000000, // 1 MB
57+
},
58+
5559
async rewrites() {
5660
return {
5761
beforeFiles: [

0 commit comments

Comments
 (0)