You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -172,10 +179,11 @@ shared/ # Shared between app and server
172
179
└── types/ # TypeScript type definitions
173
180
174
181
cli/ # Local connector CLI (separate workspace)
182
+
175
183
test/ # Vitest tests
176
184
├── unit/ # Unit tests (*.spec.ts)
177
-
└── nuxt/ # Nuxt component tests
178
-
tests/ # Playwright E2E tests
185
+
├── nuxt/ # Nuxt component tests
186
+
└── e2e/ # Playwright E2E tests
179
187
```
180
188
181
189
> [!TIP]
@@ -458,6 +466,7 @@ The following scripts help manage translation files. `en.json` is the reference
458
466
|`pnpm i18n:check:fix [locale]`| Same as check, but adds missing keys to other locales with English placeholders. |
459
467
|`pnpm i18n:report`| Audits translation keys against code usage in `.vue` and `.ts` files. Reports missing keys (used in code but not in locale), unused keys (in locale but not in code), and dynamic keys. |
460
468
|`pnpm i18n:report:fix`| Removes unused keys from `en.json` and all other locale files. |
469
+
|`pnpm i18n:schema`| Generates a JSON Schema from `en.json` at `i18n/schema.json`. Locale files reference this schema for IDE validation and autocompletion. |
461
470
462
471
### Adding a new locale
463
472
@@ -885,6 +894,117 @@ The mock connector supports test endpoints for state manipulation:
885
894
-`/__test__/user-packages` - Set user's packages
886
895
-`/__test__/package` - Set package collaborators
887
896
897
+
## Storybook
898
+
899
+
Storybook is a development environment for UI components that helps catch UI changes and provides integrations for various testing types. For testing, Storybook offers:
900
+
901
+
-**Accessibility tests** - Built-in a11y checks
902
+
-**Visual tests** - Compare JPG screenshots
903
+
-**Vitest tests** - Use stories directly in the unit tests
904
+
905
+
### Component categories
906
+
907
+
The plan is to organize components into 3 categories.
908
+
909
+
#### UI Library Components
910
+
911
+
Generic and reusable components used throughout the application.
The component should include descriptive comments.
972
+
973
+
```ts
974
+
// Button.vue
975
+
<scriptsetuplang="ts">
976
+
const props =withDefaults(
977
+
defineProps<{
978
+
/** Whether the button is disabled */
979
+
disabled?:boolean
980
+
/**
981
+
* HTML button type attribute
982
+
* @default"button"
983
+
type?: 'button' | 'submit'
984
+
// ...
985
+
}>)
986
+
</script>
987
+
```
988
+
989
+
### Configuration
990
+
991
+
Stories can be configured at three levels:
992
+
993
+
- **Global scope** (`.storybook/preview.ts`) - Applies to all stories
994
+
- **Component scope** - Applies to all stories for a specific component
995
+
- **Story scope** - Applies to individual stories only
996
+
997
+
### Global app settings
998
+
999
+
Global application settings are added to the Storybook toolbar for easy testing and viewing. Configure these in `.storybook/preview.ts` under the `globalTypes` and `decorators` properties.
1000
+
1001
+
### Known limitations
1002
+
1003
+
- Changing `i18n` in the toolbar doesn't update the language. A manual story reload is required.
1004
+
- `autodocs` currently is non-functional due bugs, its usage is discouraged at this time.
1005
+
- `pnpm storybook` may log warnings or non-breaking errors for Nuxt modules due to the lack of mocks. If the UI renders correctly, these can be safely ignored.
1006
+
- Do not `import type` from `.vue` files. The `vue-docgen-api` parser used by `@storybook/addon-docs` cannot follow type imports across SFCs and will crash. Extract shared types into a separate `.ts` file instead.
0 commit comments