Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Upgrade vite. Fix readme. Enable dependabot.
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann committed Oct 17, 2023
1 parent bb476c7 commit 1c1b985
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 47 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

- package-ecosystem: "npm"
directory: "/ui/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
41 changes: 22 additions & 19 deletions ui/ui-app/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
# React + TypeScript + Vite
# Apicurio API Designer UI

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Apicurio API Designer UI is a React based Single Page Application based on Patternfly 5.

Currently, two official plugins are available:
## Requirements
This project requires node version 16.x.x and npm version > 8.3.x.
Prior to building this project make sure you have these applications installed.

- [@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
## Development Scripts

## Expanding the ESLint configuration
Install development/build dependencies
`npm install`

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
Run a full build
`npm run build`

- Configure the top-level `parserOptions` property like this:
Initialize config.js
`./init-dev.sh none`

```js
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
```
Note: the init-dev.sh script just copies an appropriate file from config/config-*.js to the right place. You can either specify `none` or `keycloakjs` as the argument to the script. The choice depends on how you are running the back-end component.

- 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
Start the development server
`npm run dev`

Once the development server is running you can access the UI via http://localhost:8888

Note that you will need a registry back-end running for the UI to actually work. The easiest way to do this is using
docker, but you could also run the registry from maven or any other way you choose. Here is how you do it with Docker:

`docker run -it -p 8080:8080 apicurio/apicurio-api-designer-mem:latest-snapshot`
4 changes: 2 additions & 2 deletions ui/ui-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/ico" href="/favicon.ico">
<meta id="appName" name="application-name" content="Apicurio API Designer">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Apicurio : API Designer</title>
<title>Apicurio API Designer</title>
<script type="text/javascript" src="/config.js"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<!-- <link rel="stylesheet" href="/patternfly.css"> -->
</body>
</html>
16 changes: 16 additions & 0 deletions ui/ui-app/init-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

echo "----"
echo "Initializing development environment for UI-only development."
echo "----"

CONFIG_TYPE=$1

if [ "x$CONFIG_TYPE" = "x" ]
then
CONFIG_TYPE="none"
fi

cp configs/$CONFIG_TYPE/config.js config.js

echo "Done. Try: 'npm run dev'"
15 changes: 8 additions & 7 deletions ui/ui-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 18 additions & 19 deletions ui/ui-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,24 @@
"clean": "rimraf dist",
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives"
},
"devDependencies": {
"@apicurio/eslint-config": "0.2.0",
"@monaco-editor/react": "4.6.0",
"@types/react": "18.2.24",
"@types/react-dom": "18.2.8",
"@types/uuid": "8.3.4",
"@typescript-eslint/eslint-plugin": "6.7.4",
"@typescript-eslint/parser": "6.7.4",
"@vitejs/plugin-react-swc": "3.4.0",
"eslint": "8.50.0",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"rimraf": "3.0.2",
"typescript": "5.2.2",
"vite": "4.4.11",
"vite-tsconfig-paths": "4.2.1"
},
"dependencies": {
"@monaco-editor/react": "4.6.0",
Expand All @@ -31,22 +47,5 @@
"use-resize-observer": "9.1.0",
"uuid": "8.3.2",
"yaml": "2.3.2"
},
"devDependencies": {
"@apicurio/eslint-config": "0.2.0",
"@monaco-editor/react": "4.6.0",
"@types/react": "18.2.24",
"@types/react-dom": "18.2.8",
"@types/uuid": "8.3.4",
"@typescript-eslint/eslint-plugin": "6.7.4",
"@typescript-eslint/parser": "6.7.4",
"@vitejs/plugin-react-swc": "3.4.0",
"eslint": "8.50.0",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"rimraf": "3.0.2",
"typescript": "5.2.2",
"vite": "4.4.9",
"vite-tsconfig-paths": "4.2.1"
}
}

0 comments on commit 1c1b985

Please sign in to comment.