docs/contributing/frontend/index.md
Invoke's UI is made possible by many contributors and open-source libraries. Thank you!
Follow the dev environment guide to get set up. Run the UI using pnpm dev.
dev: run the frontend in dev mode, enabling hot reloadingbuild: run all checks (dpdm, eslint, prettier, tsc, knip) and then build the frontendlint:dpdm: check circular dependencieslint:eslint: check code qualitylint:prettier: check code formattinglint:tsc: check type issueslint:knip: check for unused exports or objectslint: run all checks concurrentlyfix: run eslint and prettier, fixing fixable issuestest:ui: run vitest with the fancy web UIWe use openapi-typescript to generate types from the app's OpenAPI schema. The generated types are committed to the repo in schema.ts.
If you make backend changes, it's important to regenerate the frontend types:
cd invokeai/frontend/web && python ../../../scripts/generate_openapi_schema.py | pnpm typegen
On macOS and Linux, you can run make frontend-typegen as a shortcut for the above snippet.
We use i18next for localization, but translation to languages other than English happens on our Weblate project.
Only the English source strings (i.e. en.json) should be changed on this repo.
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Invoke UI",
"url": "http://localhost:5173",
"webRoot": "${workspaceFolder}/invokeai/frontend/web"
}
]
}
We've noticed an intermittent timeout issue with the VSCode remote dev port forwarding.
We suggest disabling the editor's port forwarding feature and doing it manually via SSH:
ssh -L 9090:localhost:9090 -L 5173:localhost:5173 user@host
Thanks for your interest in contributing to the Invoke Web UI!
Please follow these guidelines when contributing.
Please check in before you invest your time on anything besides a trivial fix, in case it conflicts with ongoing work or isn't aligned with the vision for the app.
If a feature request or issue doesn't already exist for the thing you want to work on, please create one.
Ping @psychedelicious on discord in the #frontend-dev channel or in the feature request / issue you want to work on - we're happy to chat.
useCallback, useMemo, memo) with enthusiasm.useMemo.lodash (via lodash-es) to make the intent of your code clear.Please use the conventional commits spec for the web UI, with a scope of "ui":
chore(ui): bump depschore(ui): lintfeat(ui): add some cool new featurefix(ui): fix some bugWe don't do any UI testing at this time, but consider adding tests for sensitive logic.
We use vitest, and tests should be next to the file they are testing. If the logic is in something.ts, the tests should be in something.test.ts.
In some situations, we may want to test types. For example, if you use zod to create a schema that should match a generated type, it's best to add a test to confirm that the types match. Use tsafe's assert for this.
pnpm lint. Some issues are auto-fixable with pnpm fix.