Skip to content

Commit

Permalink
Replace CreateReactApp with Vite (#153)
Browse files Browse the repository at this point in the history
This commit updates libraries and replaces CreateReactApp with Vite.
Currently dashboard uses React 17, and after being in use for
approximately two years, there is a need to upgrade the stack.
CreateReactApp is not the recommended approach by React team for now,
and Vite is considered the most direct alternative to replace it.
Additionally, Jest is replaced by Vitest to align with the technology
upgrade.

---------

Co-authored-by: Yourim Cha <yourim.cha@navercorp.com>
  • Loading branch information
hackerwins and chacha912 committed Jun 25, 2024
1 parent 7c44e7c commit e79e391
Show file tree
Hide file tree
Showing 47 changed files with 6,486 additions and 29,304 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Common Environment Variables
REACT_APP_JS_SDK_VERSION=0.4.23
VITE_JS_SDK_VERSION=0.4.23
6 changes: 3 additions & 3 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Development Environment Variables
REACT_APP_SERVICE_URL=https://yorkie.dev
REACT_APP_API_ADDR=http://localhost:8080
REACT_APP_SITE_URL=https://localhost:3000/dashboard/
VITE_SERVICE_URL=https://yorkie.dev
VITE_API_ADDR=http://localhost:8080
VITE_SITE_URL=http://localhost:3000/dashboard/
6 changes: 3 additions & 3 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Production Environment Variables
REACT_APP_SERVICE_URL=https://yorkie.dev
REACT_APP_API_ADDR=https://api.yorkie.dev
REACT_APP_SITE_URL=https://yorkie.dev/dashboard/
VITE_SERVICE_URL=https://yorkie.dev
VITE_API_ADDR=https://api.yorkie.dev
VITE_SITE_URL=https://yorkie.dev/dashboard/
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Node 🔧
uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'
cache: 'npm'
cache-dependency-path: package-lock.json

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ghpages-publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: GitHub Page Publish
on:
push:
branches: [ main ]
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand All @@ -12,16 +12,16 @@ jobs:
- name: Setup Node 🔧
uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install and Build 🔧
- name: Install and Build 🔧
run: |
npm install
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
with:
branch: gh-pages
folder: build
folder: dist
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/dist

# misc
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Updating and Deploying Dashboard

1. Update `version` in [package.json](https://github.com/yorkie-team/dashboard/blob/main/package.json#L36).
2. Update `REACT_APP_JS_SDK_VERSION` in [.env](https://github.com/yorkie-team/dashboard/blob/main/.env#L2).
2. Update `VITE_JS_SDK_VERSION` in [.env](https://github.com/yorkie-team/dashboard/blob/main/.env#L2).
3. Update version of Yorkie image in [docker/docker-compose.yml](https://github.com/yorkie-team/dashboard/blob/main/docker/docker-compose.yml#L26).
4. Check that there are no errors when running the dashboard, and review the sample code for any necessary modifications.
5. Create Pull Request and merge it into main.
51 changes: 1 addition & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,9 @@ $ docker-compose -f docker/docker-compose.yml up --build -d
In the project directory, you can run:

```
$ npm start
$ npm run dev
```

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using the [Redux](https://redux.js.org/) and [Redux Toolkit](https://redux-toolkit.js.org/) template.

<details>

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br />
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.<br />
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.<br />
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/).

</details>

## Contributing

See [CONTRIBUTING](CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
19 changes: 10 additions & 9 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon-512x512.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="apple-touch-icon" href="/favicon-512x512.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="theme-color" content="#000000" />
<title>Dashboard · Yorkie</title>
Expand All @@ -15,16 +15,16 @@
content="Yorkie Dashboard is an administrative tool that allows user to manage projects and documents."
/>
<meta property="og:type" content="website" />
<meta property="og:image" content="%PUBLIC_URL%/og.png" />
<meta property="og:url" content="%REACT_APP_SITE_URL%" />
<meta property="og:image" content="%VITE_SITE_URL%og.png" />
<meta property="og:url" content="%VITE_SITE_URL%" />
<meta property="og:title" content="Yorkie Dashboard" />
<meta
property="og:description"
content="Yorkie Dashboard is an administrative tool that allows user to manage projects and documents."
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@team_yorkie" />
<meta property="twitter:image" content="%PUBLIC_URL%/og.png" />
<meta property="twitter:image" content="%VITE_SITE_URL%og.png" />
<meta property="twitter:title" content="Yorkie Dashboard" />
<meta
property="twitter:description"
Expand Down Expand Up @@ -71,5 +71,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit e79e391

Please sign in to comment.