frontend-web-editor
frontend-web-editor
This is the frontend-web-editor package within the OpenPRA MonoRepo. It is a React v18 and TypeScript-based frontend UI for the OpenPRA application suite.
Features
- React v18 for building user interfaces
- TypeScript for type-safe code
- Integration with the OpenPRA backend services
- Jest for unit testing
- ESLint for code linting
- Webpack for bundling
Installation
This package is part of the OpenPRA MonoRepo, and it should be managed with the tools and commands provided by the monorepo's root README.md. Please refer to the main README.md for installation instructions.
Usage
To serve the frontend-web-editor package, you can use the following command from the root of the monorepo:
nx serve frontend-web-editorDevelopment
Running the Development Server
To start the development server with hot module replacement (HMR), run:
nx serve frontend-web-editorBuilding the Package
To build the package for production, run:
nx build frontend-web-editor --configuration=productionFor a development build, you can omit the --configuration flag.
Running Tests
To execute the unit tests via Jest, run:
nx test frontend-web-editorLinting
To lint the package, run:
nx lint frontend-web-editorEnd-to-end tests (Playwright)
This package includes Playwright E2E tests configured via @nx/playwright.
Run the E2E suite:
shellnx run frontend-web-editor:e2e-cliOptional reporter (example):
shellnx run frontend-web-editor:e2e-cli -- --reporter=listNote the
--to pass flags to Playwright rather than Nx.Auth setup and storage state:
- Tests are split into a
setupproject (creates a user and saves auth state) and dependent projects (e.g., "Admin Tests"). - The setup test writes storage to
packages/frontend/web-editor/e2e/.auth/user.jsonand dependent tests use it automatically.
- Tests are split into a
System dependencies (in containers):
Our Playwright config runs
playwright install-depsautomatically before starting dev servers.If you run Playwright directly outside Nx, install OS deps once inside the container:
shellpnpm exec playwright install-deps
If the browsers fail to launch headless, ensure the dependency step above has been run in your environment.
Configuration
The package uses several configuration files for its operations:
jest.config.tsfor Jest configurationtsconfig.app.jsonandtsconfig.spec.jsonfor TypeScript compiler optionswebpack.config.jsfor Webpack configurationproxy.conf.jsonfor development server proxy configuration
