diff --git a/autobuild-docs/setup/dev-env-setup.md b/autobuild-docs/setup/dev-env-setup.md index 41e3f17d..0632fa33 100644 --- a/autobuild-docs/setup/dev-env-setup.md +++ b/autobuild-docs/setup/dev-env-setup.md @@ -13,7 +13,7 @@ Ensure you have atleast JAVA 17, Node 22 and Apache Maven 3.9 installed and conf npm ci ``` See [Local Backend Execution](./backend/local-backend-execution.md) for running the application locally. -See [Running Backend Container](./backend/running-backend-containers.md) for running containerized backend with db. +See [Running Containers](./running-fullstack-containers.md) for running the full containerized stack. For the ease of local development install [VS Code](https://code.visualstudio.com/) and the following extensions, 1. [JAVA Extension Pack](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) diff --git a/pipeline-ui/.env.local b/pipeline-ui/.env.local deleted file mode 100644 index c75efeaf..00000000 --- a/pipeline-ui/.env.local +++ /dev/null @@ -1,5 +0,0 @@ -VITE_API_BASE_URL=http://pipeline-app:8080/api/v1 -VITE_IDP=keycloak -VITE_KC_URL=http://auth-service:8080 -VITE_KC_REALM=SpringBootRealm -VITE_KC_CLIENTID=pipeline-app diff --git a/pipeline-ui/.env.local-with-mock b/pipeline-ui/.env.local-with-mock index 6a1812af..64fc3ee9 100644 --- a/pipeline-ui/.env.local-with-mock +++ b/pipeline-ui/.env.local-with-mock @@ -1,4 +1,5 @@ VITE_ENV=local VITE_API_BASE_URL=http://127.0.0.1:4010 +VITE_IDP=mock VITE_MOCK_USER=dummy VITE_MOCK_USER_EMAIL=dummy@dummy.com \ No newline at end of file diff --git a/pipeline-ui/.nvmrc b/pipeline-ui/.nvmrc new file mode 100644 index 00000000..2bd5a0a9 --- /dev/null +++ b/pipeline-ui/.nvmrc @@ -0,0 +1 @@ +22 diff --git a/pipeline-ui/README.md b/pipeline-ui/README.md index 4dcad1f9..b0a85278 100644 --- a/pipeline-ui/README.md +++ b/pipeline-ui/README.md @@ -1,72 +1,68 @@ -# React + TypeScript + Vite +# Pipeline UI -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. +React + TypeScript + Vite frontend for the AutoBuild pipeline service. -Currently, two official plugins are available: +## Prerequisites -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh +- Node.js 22 (see [.nvmrc](.nvmrc)) +- npm -## React Compiler +## Getting Started -The React Compiler is currently not compatible with SWC. See [this issue](https://github.com/vitejs/vite-plugin-react/issues/428) for tracking the progress. +> **Prerequisite:** Java must be installed — the API client generator (`openapi-generator-cli`) requires a JVM to run. -## Expanding the ESLint configuration +```bash +npm install +npm run generate:clean-client-code +``` + +## Running Locally + +| Command | Description | +|---|---| +| `npm run local-e2e` | Vite dev server using `.env.local-e2e` (connects to real local backend + Keycloak) | +| `npm run local-with-mock` | Vite dev server with mocked API (no backend required) | +| `npm run production` | Build + preview with production settings (requires `VITE_IDP=keycloak` and other env vars — set via shell or a `.env` file) | + +## Environment Files + +| File | Mode | Purpose | +|---|---|---| +| `.env.local-e2e` | `local-e2e` | Local end-to-end testing against a locally running backend and Keycloak | +| `.env.local-with-mock` | `local-with-mock` | Local development with a mocked OpenAPI server (no real backend) | + +## ESLint -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: +For type-aware lint rules in production applications, add a typed config entry to `eslint.config.js` alongside the existing rules: ```js export default defineConfig([ - globalIgnores(['dist']), + globalIgnores(["dist", "./src/components/ui/", "./src/gen", "./test"]), { - files: ['**/*.{ts,tsx}'], + files: ["**/*.{ts,tsx}"], extends: [ - // Other configs... - - // Remove tseslint.configs.recommended and replace with this - tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - tseslint.configs.stylisticTypeChecked, - - // Other configs... + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, ], languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... + ecmaVersion: 2020, + globals: globals.browser, + }, + rules: { + "react-refresh/only-export-components": "off", }, }, -]) -``` - -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: - -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default defineConfig([ - globalIgnores(['dist']), + // Add this for type-aware linting: { files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - // Enable lint rules for React - reactX.configs['recommended-typescript'], - // Enable lint rules for React DOM - reactDom.configs.recommended, - ], + extends: [tseslint.configs.recommendedTypeChecked], languageOptions: { parserOptions: { project: ['./tsconfig.node.json', './tsconfig.app.json'], tsconfigRootDir: import.meta.dirname, }, - // other options... }, }, ])