Skip to content

Latest commit

 

History

History
100 lines (71 loc) · 2.83 KB

CONTRIBUTING.md

File metadata and controls

100 lines (71 loc) · 2.83 KB

Contributing

We welcome contributions form everyone. Please use our GitHub issue tracker for questions, ideas, bug reports, or feature requests.

If you want to make a pull request:

  1. discuss your idea first, before putting in a lot of effort
  2. refer to the developer documentation
  3. if needed, fork the repository to your own Github profile
  4. work on your own feature branch
  5. make sure the existing tests still work and add new tests (if necessary)
  6. update or expand the documentation;
  7. make sure your code follows the style guidelines
  8. don't be afraid to ask help with any of the above steps. We're happy to help!

By participating in this project, you agree to abide by the code of conduct.

Development

We use ladle to develop components. To start the development server run:

pnpm dev

To lint use

pnpm lint

To check types with Typescript use

pnpm typecheck

To format use

pnpm format

Testing logic can be done with tests written with vitest in browser mode.

pnpm exec playwright install # Only needed once per installation
pnpm test
# Or to run headless
CI=1 pnpm test
# Or for coverage
CI=1 pnpm test -- run --coverage --coverage.reporter=html
# Open coverage/index.html in browser

Stories and tests can be located next to the code in the src/ folder. If stories needs reusable helper code that should not be part of the package, then it can be placed in the stories/ folder.

The stories can be tested using Visual Snapshots with

pnpm run docs
pnpm preview
# In another shell
pnpm playwright test stories/snapshot.spec.ts

(A new story will fail initially, but after snapshot (stories/snapshot.spec.ts-snapshots/*.png) is created it will pass.) (A updated component or story will fail, but after you update the snapshot it will pass.)

Note: The visual snapshots are different between machines, tests will mostly fail if not run on the same machine as where expected snapshots where made.

Build package

pnpm build

Writes js, dts, sourcemap and declaration map files to dist/ folder and regenerates exports in package.json file.

Build documentation website

For component stories & api documentation

pnpm run docs

Writes to docs/ folder, which can be hosted on GitHub pages.

The site can be previewed with pnpm preview.

Publish package

  1. Set new semantic version in package.json
  2. Create an new GitHub release. The package will be published to npm using a GitHub action.