Skip to content

Commit 866674f

Browse files
authored
[migrate] upgrade to Next.js 16 & deploy to NorthFlank.com (#90)
1 parent 71a3e3c commit 866674f

File tree

8 files changed

+167
-165
lines changed

8 files changed

+167
-165
lines changed

.github/workflows/deploy-production.yml

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ on:
77
push:
88
tags:
99
- v*
10-
env:
11-
ARTIFACT_PATH: /tmp/artifact.tar
12-
BOX_NAME: web-server
13-
BOX_URL: idea2app/web-server
14-
1510
jobs:
1611
deploy_docker_image:
1712
name: Deploy Docker image
@@ -20,48 +15,41 @@ jobs:
2015
packages: write
2116
contents: read
2217
steps:
23-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
2419

2520
- name: Inject Environment variables
2621
run: |
27-
echo "BOX_NAME=${BOX_NAME@L}" >> "${GITHUB_ENV}"
28-
echo "BOX_URL=${BOX_URL@L}" >> "${GITHUB_ENV}"
2922
cat > .env.local <<EOF
3023
${{ secrets.ENV_FILE }}
3124
EOF
32-
- uses: docker/setup-qemu-action@v3
33-
- uses: docker/setup-buildx-action@v3
25+
cp .env .env.personal.local
3426
35-
- name: Build Image
36-
uses: docker/build-push-action@v6
27+
- uses: docker/[email protected]
3728
with:
38-
context: .
39-
platforms: linux/amd64
40-
tags: ${{ env.BOX_URL }}:latest
41-
outputs: type=docker,dest=${{ env.ARTIFACT_PATH }}
42-
43-
- name: Pick Docker Compose
44-
run: |
45-
mkdir ./build
46-
mv ${{ env.ARTIFACT_PATH }} ./docker-compose.yml ./start.sh ./build
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ github.token }}
4732

48-
- name: Transport Image
49-
uses: appleboy/[email protected]
33+
- uses: docker/[email protected]
34+
id: meta
5035
with:
51-
source: ./build/*.*
52-
target: /tmp
53-
host: ${{ secrets.HOST }}
54-
username: ${{ secrets.USER }}
55-
password: ${{ secrets.SSH_KEY }}
56-
strip_components: 1
36+
images: ghcr.io/${{ github.repository }}
5737

58-
- name: Run Image
59-
uses: garygrossgarten/github-action-ssh@release
38+
- uses: docker/build-push-action@v6
39+
id: push
6040
with:
61-
host: ${{ secrets.HOST }}
62-
username: ${{ secrets.USER }}
63-
password: ${{ secrets.SSH_KEY }}
64-
command: |
65-
mv /tmp/docker-compose.yml /tmp/start.sh ~/
66-
chmod +x ~/start.sh
67-
echo '${{ secrets.SSH_KEY }}' | sudo -S ~/start.sh ${{ env.ARTIFACT_PATH }}
41+
context: .
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}
45+
46+
- name: deploy to NorthFlank
47+
env:
48+
PROJECT_ID: idea2app-service
49+
SERVICE_ID: idea2app-web
50+
run: |
51+
curl --request POST \
52+
--header "Authorization: Bearer ${{ secrets.NORTHFLANK_API_KEY }}" \
53+
--header "Content-Type: application/json" \
54+
--data '{"docker":{"configType":"default"},"external":{"credentials":"idea2app-github","imagePath":"ghcr.io/${{ github.repository }}:latest"}}' \
55+
https://api.northflank.com/v1/projects/$PROJECT_ID/services/$SERVICE_ID/deployment

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
## Technology stack
1111

1212
- Language: [TypeScript v5][2] + [MDX v3][10]
13-
- Component engine: [Next.js v15][3]
13+
- Component engine: [Next.js v16][3]
1414
- Component suite: [Bootstrap v5][4]
1515
- PWA framework: [Workbox v6][5]
1616
- State management: [MobX v6][11]
@@ -20,7 +20,6 @@
2020
## Best practice
2121

2222
1. Install GitHub apps in your organization or account:
23-
2423
1. [Probot settings][15]: set up Issue labels & Pull Request rules
2524
2. [PR badge][16]: set up Online [VS Code][17] editor entries in Pull Request description
2625

components/Project/PrototypeGenerator.tsx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ export class PrototypeGenerator extends ObservedComponent<PrototypeGeneratorProp
3434
}
3535

3636
async pollStatusCheck() {
37-
const { props, version } = this,
38-
rootElement = this.root.current;
37+
const rootElement = this.root.current;
3938

40-
while (version?.status === 'pending' || version?.status === 'processing') {
39+
while (this.version?.status === 'pending' || this.version?.status === 'processing') {
4140
if (!rootElement?.isConnected) break;
4241

43-
if (inViewport(rootElement))
44-
this.version = await this.versionStore.getOne(props.prototype!.id);
42+
if (inViewport(rootElement)) this.version = await this.versionStore.getOne(this.version.id);
4543

4644
await sleep(3);
4745
}
@@ -91,34 +89,28 @@ export class PrototypeGenerator extends ObservedComponent<PrototypeGeneratorProp
9189
return (
9290
<Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap' }}>
9391
{previewLink && (
94-
<Link
92+
<Button
9593
href={previewLink}
9694
target="_blank"
9795
rel="noopener noreferrer"
98-
sx={{
99-
textDecoration: 'none',
100-
fontSize: '0.875rem',
101-
fontWeight: 500,
102-
color: 'primary.main',
103-
}}
96+
variant="contained"
97+
color="success"
98+
size="small"
10499
>
105100
{t('view_preview')}
106-
</Link>
101+
</Button>
107102
)}
108103
{gitLogsLink && (
109-
<Link
104+
<Button
110105
href={gitLogsLink}
111106
target="_blank"
112107
rel="noopener noreferrer"
113-
sx={{
114-
textDecoration: 'none',
115-
fontSize: '0.875rem',
116-
fontWeight: 500,
117-
color: 'text.secondary',
118-
}}
108+
variant="contained"
109+
color="warning"
110+
size="small"
119111
>
120112
{t('view_ai_log')}
121-
</Link>
113+
</Button>
122114
)}
123115
</Box>
124116
);

eslint.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export default tsEslint.config(
4747
warnOnUnsupportedTypeScriptVersion: false,
4848
},
4949
},
50-
// @ts-expect-error https://github.com/vercel/next.js/issues/81695
5150
rules: {
5251
// spellchecker
5352
'@cspell/spellchecker': [

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference path="./.next/types/routes.d.ts" />
3+
import './.next/dev/types/routes.d.ts';
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"mobx-react": "^9.2.1",
3535
"mobx-react-helper": "^0.5.1",
3636
"mobx-restful": "^2.1.4",
37-
"next": "^15.5.6",
37+
"next": "^16.0.0",
3838
"next-pwa": "~5.6.0",
3939
"next-ssr-middleware": "^1.0.3",
4040
"react": "^19.2.0",
@@ -50,7 +50,7 @@
5050
"@eslint/compat": "^1.4.0",
5151
"@eslint/js": "^9.38.0",
5252
"@idea2app/data-server": "^1.0.0-rc.3",
53-
"@next/eslint-plugin-next": "^15.5.6",
53+
"@next/eslint-plugin-next": "^16.0.0",
5454
"@stylistic/eslint-plugin": "^5.5.0",
5555
"@tailwindcss/postcss": "^4.1.15",
5656
"@tailwindcss/typography": "^0.5.19",
@@ -62,7 +62,7 @@
6262
"@types/node": "^22.18.12",
6363
"@types/react": "^19.2.2",
6464
"eslint": "^9.38.0",
65-
"eslint-config-next": "^15.5.6",
65+
"eslint-config-next": "^16.0.0",
6666
"eslint-config-prettier": "^10.1.8",
6767
"eslint-plugin-react": "^7.37.5",
6868
"eslint-plugin-simple-import-sort": "^12.1.1",
@@ -109,12 +109,10 @@
109109
"e": "pnpx @dotenvx/dotenvx run -f .env.personal.local -- pnpm",
110110
"prepare": "husky || true",
111111
"install": "xgit download https://github.com/idea2app/key-vault main idea2app.github.io || true",
112-
"dev": "next dev",
113-
"build": "next build",
114-
"export": "next build && next export",
112+
"dev": "next dev --webpack",
113+
"build": "next build --webpack",
115114
"start": "next start",
116-
"lint": "next lint --fix && git add . && tsc --noEmit",
117-
"test": "lint-staged && npm run lint",
115+
"test": "lint-staged && tsc --noEmit",
118116
"pack-image": "docker build -t idea2app/web-server .",
119117
"container": "docker rm -f web-server && docker run --name web-server -p 3000:3000 -d idea2app/web-server"
120118
}

0 commit comments

Comments
 (0)