|
| 1 | +# Contributing to RubyUI |
| 2 | + |
| 3 | +Thanks for your interest in contributing! This repository is a monorepo containing two sibling projects: |
| 4 | + |
| 5 | +- [`gem/`](gem/) — the `ruby_ui` gem published to rubygems.org. |
| 6 | +- [`docs/`](docs/) — the Rails app that powers https://rubyui.com. |
| 7 | + |
| 8 | +The big advantage of the monorepo: **a single PR can touch both the component and the docs example**. The docs app consumes the local gem via `path: "../gem"`, so any change in `gem/lib/ruby_ui/` is reflected in the running site immediately. |
| 9 | + |
| 10 | +## Development setup |
| 11 | + |
| 12 | +We recommend using the devcontainer for either subproject (each has its own `.devcontainer/`). |
| 13 | + |
| 14 | +```bash |
| 15 | +git clone git@github.com:ruby-ui/ruby_ui.git |
| 16 | +cd ruby_ui |
| 17 | + |
| 18 | +# For gem-only work: |
| 19 | +cd gem |
| 20 | +bundle install |
| 21 | +bundle exec rake |
| 22 | + |
| 23 | +# For docs work: |
| 24 | +cd docs |
| 25 | +bundle install |
| 26 | +pnpm install |
| 27 | +bin/dev |
| 28 | +``` |
| 29 | + |
| 30 | +## Workflow |
| 31 | + |
| 32 | +1. Fork and create a feature branch. |
| 33 | +2. Make your changes: |
| 34 | + - Component or generator changes → `gem/lib/...`, with tests in `gem/test/...`. |
| 35 | + - Documentation page changes → `docs/app/views/docs/...` or `docs/app/components/...`. |
| 36 | + - If a component change affects how it's documented, update **both** in the same PR. |
| 37 | +3. Run the relevant test suites: |
| 38 | + - `cd gem && bundle exec rake` (tests + standardrb). |
| 39 | + - `cd docs && bin/rails test` and `bundle exec standardrb`. |
| 40 | +4. Open a Pull Request against `main`. Use the PR template and prefix the title with a category in brackets, e.g. `[Feature] Add new variant to Button`. |
| 41 | + |
| 42 | +## Focus areas |
| 43 | + |
| 44 | +We prioritize: |
| 45 | + |
| 46 | +- Improving existing components rather than adding new ones. |
| 47 | +- Preserving the shadcn look and feel. |
| 48 | +- Enhancing documentation. |
| 49 | +- Fixing bugs. |
| 50 | + |
| 51 | +## Code style |
| 52 | + |
| 53 | +- Ruby: [Standard Ruby](https://github.com/standardrb/standard) — `bundle exec standardrb --fix` to auto-fix. |
| 54 | +- JavaScript: kept minimal; Stimulus controllers live alongside the components they belong to. |
| 55 | + |
| 56 | +## Documentation files |
| 57 | + |
| 58 | +The gem ships per-component `*_docs.rb` files (rendering examples) under `gem/lib/ruby_ui/<component>/`. Consumers of the gem can install these into their own Rails app with: |
| 59 | + |
| 60 | +```bash |
| 61 | +bin/rails g ruby_ui:install:docs |
| 62 | +``` |
| 63 | + |
| 64 | +Within this monorepo, the **docs app does not run that generator** — it has its own richer view implementations in `docs/app/views/docs/` and `docs/app/components/docs/`. If you change a component's API, update the relevant view in `docs/app/views/docs/<component>.rb` to keep the documentation site accurate. |
| 65 | + |
| 66 | +Thanks for helping make RubyUI better! |
0 commit comments