Skip to content

Commit

Permalink
FIO-7733: React Updates (#78)
Browse files Browse the repository at this point in the history
* complete refactor to vite, typescript, new react updates

* update dependent PR version

* uncomment copyblock; add favicon
  • Loading branch information
brendanbond authored Jul 19, 2024
1 parent 7677240 commit 43417ee
Show file tree
Hide file tree
Showing 52 changed files with 1,798 additions and 9,858 deletions.
19 changes: 19 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"prettier",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
};
41 changes: 21 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

23 changes: 0 additions & 23 deletions .prettierignore

This file was deleted.

4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"tabWidth": 4
}
60 changes: 21 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,30 @@
# Form.io React Starter Application
# React + TypeScript + Vite

---
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

This is a starter application that uses React, Bootstrap, Webpack, and Form.io to create a powerful Serverless application.
This example uses Contexts and hooks to manage application state.
Currently, two official plugins are available:

## Installation
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

- Download this application within your local machine and then type the following.
## Expanding the ESLint configuration

```
npm install
```

### Running

---

You can develop within this application by typing the following

```
npm start
```

This will launch the application locally @ https://localhost:3000. Now, whenever you make changes, those will be directly reflected within the launched application.
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

### Building
- Configure the top-level `parserOptions` property like this:

---

Once you have your application developed, it is now time to build the application for deployment. This can be done by typing the following.

```
npm run build
```js
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
};
```

This will generate the **build** folder which you can then use to install within any webserver, Github Page, an Amazon S3 bucket, etc.

### Commands

---

To see all available commands type the following

```
npm run
```
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Form.io React App Starter Kit</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
92 changes: 35 additions & 57 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,37 @@
{
"name": "react-starterkit-app",
"version": "0.1.0",
"private": true,
"homepage": "/react-app-starterkit/#",
"dependencies": {
"@formio/contrib": "^2.0.0",
"@formio/js": "^5.0.0-rc.33",
"@formio/react": "^5.3.0-rc.2",
"@microlink/react-json-view": "^1.23.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
"bootstrap": "^5.2.0",
"react": "^18.1.0",
"react-bootstrap": "^2.4.0",
"react-code-blocks": "0.0.9-0",
"react-dom": "^18.1.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy": "yarn build; cd build; git init; git remote add origin [email protected]:formio/react-app-starterkit.git; git checkout -b gh-pages; git add -A; git commit -m 'Update demo application'; git push -f origin gh-pages;",
"prepare": "husky install"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest",
"prettier"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint-config-prettier": "^8.8.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.1",
"prettier": "^2.8.8"
},
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
}
"name": "react-app-starterkit",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@formio/js": "5.0.0-dev.5621.91bd945",
"@formio/react": "6.0.0-dev.568.ced0fbd",
"@microlink/react-json-view": "^1.23.0",
"bootstrap": "^5.3.3",
"react": "^18.2.0",
"react-bootstrap": "^2.10.2",
"react-code-blocks": "^0.1.6",
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.1"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"prettier": "^3.3.0",
"typescript": "^5.2.2",
"vite": "^5.2.0"
}
}
Binary file removed public/favicon.ico
Binary file not shown.
Binary file added public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 0 additions & 40 deletions public/index.html

This file was deleted.

Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

26 changes: 13 additions & 13 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
@import "~bootstrap/dist/css/bootstrap.css";
@import "~@formio/js/dist/formio.full.min.css";
@import "bootstrap/dist/css/bootstrap.css";
@import "@formio/js/dist/formio.full.min.css";

.nav-link a {
color: inherit;
text-decoration: none;
color: inherit;
text-decoration: none;
}

.formio-brand {
font-size: 1rem;
display: flex;
align-items: center;
font-size: 1rem;
display: flex;
align-items: center;
}

.formio-brand > * {
margin-right: 5px;
margin-right: 5px;
}

.navbar-brand a {
color: inherit;
text-decoration: none;
color: inherit;
text-decoration: none;
}

.react-logo {
color: #0a7ea3;
color: #0a7ea3;
}

div.spacer {
margin: 0.5rem 0;
line-height: 0;
margin: 0.5rem 0;
line-height: 0;
}
Loading

0 comments on commit 43417ee

Please sign in to comment.