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

Feat/add ci pipeline #1

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
6cd7903
feat: init
emily40830 Sep 10, 2022
b78b553
fix: add sass and remove node-sass
emily40830 Dec 11, 2022
8bfa9fb
feat: add router
emily40830 Oct 1, 2022
226d656
feat: add header props
emily40830 Oct 1, 2022
a840581
feat: add todo input props
emily40830 Oct 1, 2022
3322bf1
feat: add props for todo item and collection
emily40830 Oct 1, 2022
24ecfc5
feat: put todo data by props
emily40830 Oct 1, 2022
180703e
style: add isDone style at todo item
emily40830 Oct 2, 2022
2e3dabe
feat: add state to store todo input
emily40830 Oct 2, 2022
7edf286
feat: add state to store todos
emily40830 Oct 2, 2022
cd81756
feat: add save button event handler
emily40830 Oct 2, 2022
ba57a62
feat: add enter key press event handler
emily40830 Oct 2, 2022
03f329c
style: add active class when input value length > 0
emily40830 Oct 2, 2022
65dd176
refactor: modify handler naming
emily40830 Oct 2, 2022
032aa05
feat: toggle todo is done or not
emily40830 Oct 2, 2022
7baa4d2
feat: add change mode handler
emily40830 Oct 2, 2022
34830b2
feat: add key down event when editing todo item
emily40830 Oct 2, 2022
36576fa
feat: add save handler
emily40830 Oct 2, 2022
e978b80
fix: replace value with defaultValue
emily40830 Oct 2, 2022
5beb00b
feat: add delete handler
emily40830 Oct 2, 2022
0c32ca5
feat: add todo numbers at todo page
ellenlee Nov 10, 2022
40493a6
fix: remove unnecessary line
emily40830 Oct 2, 2022
8c73b1d
feat: add json-server
emily40830 Oct 2, 2022
168d4a0
feat: setup json-server
emily40830 Oct 3, 2022
9f7db65
feat: install axios
emily40830 Oct 3, 2022
77f91fb
feat: add todo crud function
emily40830 Oct 3, 2022
6ab3616
feat: implement get todos
emily40830 Oct 3, 2022
e6fa745
feat: implement create todo
emily40830 Oct 3, 2022
c5b9bdc
feat: add useEffect to get todos from api
emily40830 Oct 3, 2022
d2d0856
fix: fix import to relative path
emily40830 Dec 15, 2022
d7db2ea
feat: use create api
emily40830 Oct 5, 2022
8c63dd5
feat: add update todo api
emily40830 Oct 5, 2022
32f8158
feat: add delete todo api
emily40830 Oct 5, 2022
a6f6a1a
feat: use update api at save and toggle done
emily40830 Oct 5, 2022
9131502
feat: use delete todo api
emily40830 Oct 5, 2022
79749a3
feat: add auth input props
emily40830 Nov 2, 2022
6a83fec
feat: add authinput props at signup page
emily40830 Nov 2, 2022
93f86ff
feat: add authinput props at login page
emily40830 Nov 2, 2022
e18e47d
feat: add router link at login and signup pages
emily40830 Nov 2, 2022
b201622
feat: login api function
emily40830 Nov 2, 2022
78a7f57
fix: add the same return type
emily40830 Dec 15, 2022
7f23a40
feat: add login funciton to login page
emily40830 Nov 2, 2022
8a26994
feat: install sweetalert2
emily40830 Nov 2, 2022
e569b0c
feat: show info alerts
emily40830 Nov 2, 2022
da1ff5d
feat: register api function
emily40830 Nov 2, 2022
1b95343
feat: add register function to signup page
emily40830 Nov 2, 2022
5551a96
feat: add navigate for switching to todo page
emily40830 Nov 2, 2022
4bd3f1b
feat: add logout
emily40830 Nov 2, 2022
acdc41c
feat: add check permission function for test-token api
emily40830 Nov 2, 2022
e929fcf
feat: add check permission for navigation at pages
emily40830 Nov 2, 2022
573dfcb
feat: add default auth context
emily40830 Nov 2, 2022
691375c
feat: install package json web token
emily40830 Nov 2, 2022
d346c37
feat: add auth function to context
emily40830 Nov 2, 2022
2f26fc0
feat: add check permission to context
emily40830 Nov 2, 2022
0f5ebe9
feat: export context hook
emily40830 Nov 2, 2022
2c86eff
feat: add auth provider to app
emily40830 Nov 2, 2022
bedbb6e
refactor: add use auth to each page
emily40830 Nov 2, 2022
4e87f7e
feat: add home page navigation
emily40830 Nov 2, 2022
d24ce89
feat: add current member at todo page
ellenlee Nov 10, 2022
eb3cb8b
refactor: add logout from context
emily40830 Nov 2, 2022
a0bb648
fix: add the same return type
emily40830 Dec 16, 2022
6d3d27f
fix: fix import to relative path
emily40830 Dec 16, 2022
5a00786
feat: write deploy scripts
emily40830 Dec 16, 2022
0b68a5a
feat: add router basename
emily40830 Dec 16, 2022
e216e7b
feat: add 404 redirect
emily40830 Dec 16, 2022
aebca59
fix: remove deploy trigger when pull request occur
emily40830 Dec 25, 2022
8acb0b5
test: add app initialize
emily40830 Dec 25, 2022
beed6db
test: add test cased follow user story
emily40830 Dec 25, 2022
b99d796
update: ci trigger branch
emily40830 Dec 25, 2022
3d9e144
update ci
emily40830 Dec 25, 2022
f073b6e
update ci
emily40830 Dec 25, 2022
eb1d605
test: remove build and ci
emily40830 Dec 25, 2022
e179da0
fix ci pipeline
emily40830 Dec 25, 2022
136d12e
fix: coding style fix
emily40830 Dec 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_PUBLIC_URL="/todolist-react-demo"
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: TodoList testing

on:
push:
branches: [main, feat/add-ci-pipeline]

jobs:
mac-test-job:
runs-on: macos-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm install

- name: npm test
run: |
npm test

window-test-job:
runs-on: windows-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm install

- name: npm test
run: |
npm test
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy to GitHub pages

on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Deploy
run: |
git config --global user.name $user_name
git config --global user.email $user_email
git remote set-url origin https://${github_token}@github.com/${repository}
npm run deploy
env:
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
github_token: ${{ secrets.DEPLOY_SECRET }}
repository: ${{ github.repository }}
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
25 changes: 25 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.markdownlint": true
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
82 changes: 20 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,28 @@
# Getting Started with Create React App
# Todo List X MVC with React

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
- A starter project for react tutorial
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts
## User story

In the project directory, you can run:
- 使用者可以查看自己的所有 todo
- 使用者可以新增 todo
- 使用者可以刪除 todo
- 使用者可以標記完成/未完成的 todo
- 使用者可以雙擊清單上的特定 todo 編輯內容
- 使用者可以註冊 / 登入 / 登出

### `npm start`
## Set up

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
```
npm install
npm run start
```

The page will reload when you make changes.\
You may also see any lint errors in the console.
## Set up json server

### `npm test`
have to run `npm install` first

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

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.

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.

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.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
```
npm run dev-server
```
24 changes: 24 additions & 0 deletions db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"todos": [
{
"title": "Learn react-router",
"isDone": true,
"id": 1
},
{
"title": "Learn to create custom hooks",
"isDone": false,
"id": 2
},
{
"title": "Learn to use context",
"isDone": true,
"id": 3
},
{
"title": "Learn to implement auth",
"isDone": false,
"id": 4
}
]
}
6 changes: 6 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
Loading