- Source code lives in
src/:- Components:
src/components/{atoms|molecules|organisms}/<component>/<component>.ts - Core utilities and types:
src/core/,src/utils/,src/types/ - Framework bindings:
src/integrations/{react|vue|angular} - Tests alongside code:
src/**/*.{test,spec}.ts
- Components:
- Documentation in
docs/; examples inexamples/anddemo/. - Build artifacts in
dist/(do not edit by hand).
npm run dev— Start Vite dev server.npm run build— Build library + generate and bundle types.npm run preview— Preview built output.npm run storybook/npm run build-storybook— UI docs locally / static build.npm run test/npm run test:watch— Run Vitest once / watch mode.npm run test:coverage— Run tests with coverage.npm run type-check— Strict TypeScript checks.npm run lint/npm run format— ESLint checks / Prettier format.npm run generate:component— Scaffold a new component.
- Language: TypeScript (ES2020 modules), strict mode.
- Linting: ESLint with
@typescript-eslint; formatting via Prettier. - Web Components use kebab-case selectors (e.g.,
nc-button). Classes/types use PascalCase. - Files and folders in components use kebab-case; tests end with
.test.tsor.spec.ts. - Do not modify generated files (
*.d.ts,dist/**).
- Framework: Vitest (
happy-domenv). Setup atsrc/test/setup.ts. - Location: colocated tests under
src/**. - Coverage thresholds: 70% for branches, functions, lines, statements.
- Example:
npm run test:coveragethen opencoverage/index.html.
- Use Conventional Commits:
feat:,fix:,docs:,chore:, etc. - Commits should be concise and scoped to one change.
- PRs must include: clear description, linked issues, test evidence (output or screenshots), Storybook notes/screenshots for UI changes, and updated docs when applicable.
- Before opening a PR:
npm run lint && npm run test:coverage && npm run build.
- Node 18+ recommended (Vite 5). Never commit secrets.
- Prefer
npm run generate:componentto ensure structure and metadata are consistent. - When integrating frameworks, keep changes within
src/integrations/and avoid leaking DOM globals.