|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for your interest in contributing to `@luk4x/list`. |
| 4 | + |
| 5 | +This project is intentionally small and opinionated. Please read this document carefully before opening an issue or pull request. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Project scope |
| 10 | + |
| 11 | +This component exists to solve **one specific problem**: |
| 12 | + |
| 13 | +> Rendering lists in React with correct, stable keys and minimal boilerplate, without hiding React’s behavior. |
| 14 | +
|
| 15 | +Because of that, this project values: |
| 16 | + |
| 17 | +- **Correctness over convenience** (especially around stable keys) |
| 18 | +- **failing loudly over silent fallbacks** |
| 19 | +- **Minimal API surface** |
| 20 | +- **Strong typing** |
| 21 | +- **Clear docs** |
| 22 | + |
| 23 | +If a proposed change compromises any of these principles, it’s unlikely to be accepted. |
| 24 | + |
| 25 | +### Proposing changes |
| 26 | + |
| 27 | +Please do **not** propose changes that: |
| 28 | + |
| 29 | +- add styling, layout, or visual concerns |
| 30 | +- introduce silent fallbacks as a workaround in case of failure |
| 31 | +- attempt to “fix” unstable or poorly modeled data |
| 32 | +- hide React’s behavior |
| 33 | +- expand the API surface beyond its current scope |
| 34 | + |
| 35 | +Contributions are very welcome when: |
| 36 | + |
| 37 | +- fix bugs or edge cases related to key handling |
| 38 | +- improve type safety without increasing API complexity |
| 39 | +- improve documentation clarity or examples |
| 40 | +- add tests that validate existing behavior |
| 41 | +- clarify error messages or developer feedback |
| 42 | + |
| 43 | +### Issues and feature requests |
| 44 | + |
| 45 | +When opening an issue, please include: |
| 46 | + |
| 47 | +- What you’re trying to do |
| 48 | +- Expected behavior |
| 49 | +- Actual behavior |
| 50 | +- A minimal code example |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## Project environment |
| 55 | + |
| 56 | +The project is a **CLI** that prompts for a destination path and copies the `templates/list` component into a user’s codebase. |
| 57 | + |
| 58 | +Therefore, the changes should be tested through the CLI itself as well, and not just through tests. |
| 59 | + |
| 60 | +### Folder structure |
| 61 | + |
| 62 | +``` |
| 63 | +
|
| 64 | +├─ .github/ # GitHub metadata |
| 65 | +├─ .husky/ # Git hooks |
| 66 | +├─ dist/ # Build output (generated) |
| 67 | +├─ src/ # CLI source |
| 68 | +├─ templates # Component templates shipped by the CLI |
| 69 | +├─ tests/ # Runtime and type tests |
| 70 | +├─ index.d.ts # Root type exports for tsd |
| 71 | +├─ tsup.config.ts # Build config |
| 72 | +└─ vitest.config.ts # Test config |
| 73 | +
|
| 74 | +``` |
| 75 | + |
| 76 | +### Requirements |
| 77 | + |
| 78 | +- Node.js >= 18 (recommended via NVM) |
| 79 | +- pnpm |
| 80 | + |
| 81 | +### Tooling and conventions |
| 82 | + |
| 83 | +This project uses the following tools and conventions: |
| 84 | + |
| 85 | +- [@changesets/cli](https://www.npmjs.com/package/@changesets/cli) for versioning and releases |
| 86 | +- [Conventional Commits](https://www.conventionalcommits.org) for commit messages |
| 87 | +- [Vitest](https://vitest.dev/) and [tsd](https://www.npmjs.com/package/tsd) for testing |
| 88 | + |
| 89 | +### Main scripts |
| 90 | + |
| 91 | +```bash |
| 92 | + |
| 93 | +pnpm install # install dependencies |
| 94 | +nvm install # install Node.js version from .nvmrc |
| 95 | +pnpm run dev # build and run the CLI locally |
| 96 | +pnpm run typecheck # run TypeScript checks (runs on every commit) |
| 97 | +pnpm run lint # run ESLint (runs on every commit) |
| 98 | +pnpm run test:all # run runtime and type tests (runs on every commit) |
| 99 | +pnpm run build # build the CLI with tsup (runs on every push) |
| 100 | + |
| 101 | +``` |
| 102 | + |
| 103 | +### Recommended CLI local testing workflow |
| 104 | + |
| 105 | +Because this is a CLI that copies templates into real projects, the most reliable way to test changes is to run it against a fresh test project. |
| 106 | + |
| 107 | +Create a temporary test project: |
| 108 | + |
| 109 | +```bash |
| 110 | + |
| 111 | +mkdir -p /tmp/list-test && cd /tmp/list-test && pnpm init |
| 112 | + |
| 113 | +``` |
| 114 | + |
| 115 | +From inside that project, run the CLI directly from your local build (replace the path accordingly): |
| 116 | + |
| 117 | +```bash |
| 118 | + |
| 119 | +node /absolute/path/to/list-repo/dist/cli.mjs |
| 120 | + |
| 121 | +``` |
| 122 | + |
| 123 | +This simulates how real users interact with the CLI and helps catch issues that unit tests alone may miss (path resolution, prompts, file output, etc.). Changes that affect the CLI or templates should always be tested this way before opening a pull request. |
0 commit comments