mirror of
https://github.com/penpot/penpot.git
synced 2026-09-25 13:26:16 +00:00
2.3 KiB
2.3 KiB
Frontend UI Packages and Text Editor Workflow
frontend/packages/, frontend/text-editor/, Storybook/component tests. Separate from CLJS app UI under frontend/src/app/main/ui.
Package boundaries
frontend/packages/uibuilds@penpot/ui, a React/Vite library package. It exports ESM and type declarations fromdist/; React and ReactDOM are peer dependencies and must stay external in the Vite library build.- The UI package build copies generated
dist/index.cssintofrontend/resources/public/css/ui.css. If shared UI styles look stale in the app, rebuild the package or check this copy step before debugging CLJS style code. frontend/text-editorbuilds@penpot/text-editorfromsrc/editor/TextEditor.js. It is a Vite JS package, not CLJS, and has its own Vitest/browser-test setup.- The text editor consumes render-wasm artifacts copied from
frontend/resources/public/jsintofrontend/text-editor/src/wasm. Usepnpm run wasm:updateafter rebuildingrender-wasmif tests or local dev use stale WASM files. - Other packages under
frontend/packages/such astokenscript,draft-js, andmousetrapare workspace dependencies used by the frontend app; do not assume their runtime behavior lives in CLJS namespaces.
Commands
From frontend/:
- Build app-side JS package assets:
pnpm run build:app:libs. - Watch app-side JS package assets:
pnpm run watch:app:libs. - Storybook build:
pnpm run build:storybook; local Storybook:pnpm run watch:storybook. - Storybook/component tests:
pnpm run test:storybook.
From frontend/packages/ui:
- Build library and CSS artifact:
pnpm run build. - Watch library build:
pnpm run watch.
From frontend/text-editor:
- Local Vite dev:
pnpm run dev. - Tests:
pnpm run test; coverage:pnpm run coverage; browser watch:pnpm run test:watch:e2e. - Format check:
pnpm run fmt:js.
Validation notes
- Frontend root
check-fmt:jscovers stories, Playwright scripts, frontend scripts, andtext-editor/**/*.js; it does not replace package-specific builds/tests. - Changes to shared UI package exports should be validated both in the package build and in the consuming app/Storybook path.
- Changes that alter text rendering/editing can involve
frontend/text-editor,render-wasm, CLJS text integration, andmem:common/text-subtleties; verify the runtime that actually owns the changed behavior.