Skip to content

Commit 01a7ee4

Browse files
authored
migrate to nextjs (#7)
* nextjs * unnecessary content * google analytics * CI settings * add frontend build test * add heading tag for SEO * add label for seo * add 'lang' attribute for seo
1 parent 5f013f7 commit 01a7ee4

31 files changed

+1044
-6403
lines changed

.github/workflows/nodejs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,30 @@ jobs:
1111

1212
- name: test server
1313
run: docker-compose -f docker-compose.test.yml up --exit-code-from pict_api_test
14+
15+
frontend_test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v1
20+
21+
- name: Use Node.js v12.13.1
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: '12.13.1'
25+
26+
- name: Cache node modules
27+
uses: actions/cache@v1
28+
with:
29+
path: web/node_modules
30+
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.OS }}-build-${{ env.cache-name }}-
33+
${{ runner.OS }}-build-
34+
${{ runner.OS }}-
35+
36+
- name: build frontend
37+
run: |
38+
cd front
39+
yarn
40+
yarn export

docker-compose.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ services:
1717
pict_react:
1818
image: node:12.12.0-alpine
1919
container_name: pict_react
20-
environment:
21-
- CHOKIDAR_USEPOLLING=true
22-
- CHOKIDAR_INTERVAL=1000
2320
volumes:
2421
- ./front:/root/front
2522
- /root/front/node_modules/
2623
working_dir: /root/front
2724
ports:
2825
- '3000:3000'
29-
command: sh -c 'yarn && yarn start'
26+
command: sh -c 'yarn && yarn dev'

front/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_API_URL=http://localhost:8080
1+
NEXT_PUBLIC_API_URL=http://localhost:8080

front/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_API_URL=https://pairwise-api.yuuniworks.com
1+
NEXT_PUBLIC_API_URL=https://pairwise-api.yuuniworks.com

front/.gitignore

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,27 @@
88
# testing
99
/coverage
1010

11+
# next.js
12+
/.next/
13+
/out/
14+
1115
# production
1216
/build
1317

1418
# misc
1519
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
1628
.env.local
1729
.env.development.local
1830
.env.test.local
1931
.env.production.local
2032

21-
npm-debug.log*
22-
yarn-debug.log*
23-
yarn-error.log*
33+
# vercel
34+
.vercel

front/README.md

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,30 @@
1-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
22

3-
## Available Scripts
3+
## Getting Started
44

5-
In the project directory, you can run:
5+
First, run the development server:
66

7-
### `yarn start`
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
812

9-
Runs the app in the development mode.<br />
10-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
1114

12-
The page will reload if you make edits.<br />
13-
You will also see any lint errors in the console.
14-
15-
### `yarn test`
16-
17-
Launches the test runner in the interactive watch mode.<br />
18-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19-
20-
### `yarn build`
21-
22-
Builds the app for production to the `build` folder.<br />
23-
It correctly bundles React in production mode and optimizes the build for the best performance.
24-
25-
The build is minified and the filenames include the hashes.<br />
26-
Your app is ready to be deployed!
27-
28-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29-
30-
### `yarn eject`
31-
32-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33-
34-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35-
36-
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37-
38-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
15+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
3916

4017
## Learn More
4118

42-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43-
44-
To learn React, check out the [React documentation](https://reactjs.org/).
45-
46-
### Code Splitting
47-
48-
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49-
50-
### Analyzing the Bundle Size
51-
52-
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53-
54-
### Making a Progressive Web App
55-
56-
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57-
58-
### Advanced Configuration
19+
To learn more about Next.js, take a look at the following resources:
5920

60-
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
21+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
22+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
6123

62-
### Deployment
24+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
6325

64-
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
26+
## Deploy on Vercel
6527

66-
### `yarn build` fails to minify
28+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
6729

68-
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
30+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

front/next-env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />

front/package.json

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
{
2-
"name": "pairwise-pict-online-front",
2+
"name": "pairsise-pict-online-front",
33
"version": "0.1.0",
44
"private": true,
5-
"dependencies": {
6-
"react": "^16.13.1",
7-
"react-dom": "^16.13.1",
8-
"react-scripts": "3.4.1"
9-
},
105
"scripts": {
11-
"start": "react-scripts start",
12-
"build": "react-scripts build",
13-
"test": "react-scripts test",
14-
"eject": "react-scripts eject"
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"export": "next build && next export"
1510
},
16-
"eslintConfig": {
17-
"extends": "react-app"
11+
"dependencies": {
12+
"next": "9.5.0",
13+
"normalize.css": "^8.0.1",
14+
"react": "16.13.1",
15+
"react-dom": "16.13.1"
1816
},
19-
"browserslist": {
20-
"production": [
21-
">0.2%",
22-
"not dead",
23-
"not op_mini all"
24-
],
25-
"development": [
26-
"last 1 chrome version",
27-
"last 1 firefox version",
28-
"last 1 safari version"
29-
]
17+
"devDependencies": {
18+
"@types/node": "^14.0.27",
19+
"@types/react": "^16.9.43",
20+
"typescript": "^3.9.7"
3021
}
3122
}
File renamed without changes.

front/public/index.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)