|
| 1 | +# Contributing to launchts |
| 2 | + |
| 3 | +Thank you for your interest in contributing! |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +1. **Fork and clone** the repository: |
| 8 | + |
| 9 | + ```bash |
| 10 | + git clone https://github.com/Jszigeti/launchts.git |
| 11 | + cd launchts |
| 12 | + ``` |
| 13 | + |
| 14 | +2. **Install dependencies:** |
| 15 | + |
| 16 | + ```bash |
| 17 | + npm install |
| 18 | + ``` |
| 19 | + |
| 20 | +3. **Run tests:** |
| 21 | + |
| 22 | + ```bash |
| 23 | + npm test |
| 24 | + ``` |
| 25 | + |
| 26 | +4. **Try the CLI locally:** |
| 27 | + ```bash |
| 28 | + npm run dev -- my-test-project |
| 29 | + # or build and link |
| 30 | + npm run build |
| 31 | + npm link |
| 32 | + launchts my-test-project |
| 33 | + ``` |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## Development Workflow |
| 38 | + |
| 39 | +### Project Structure |
| 40 | + |
| 41 | +``` |
| 42 | +src/ |
| 43 | +├── cli.ts # CLI entry point, command parsing, prompts |
| 44 | +├── generator.ts # Core project generation logic |
| 45 | +├── configs.ts # Tool configurations (ESLint, Prettier, etc.) |
| 46 | +├── messages.ts # Centralized user-facing messages |
| 47 | +└── types.ts # TypeScript type definitions |
| 48 | +
|
| 49 | +tests/ |
| 50 | +├── cli.integration.test.ts # CLI integration tests |
| 51 | +├── flags.test.ts # Flag parsing tests |
| 52 | +├── generator.test.ts # Generator unit tests |
| 53 | +├── generator.error.test.ts # Error handling tests |
| 54 | +├── options.test.ts # Tool injection tests |
| 55 | +└── validation.test.ts # Input validation tests |
| 56 | +``` |
| 57 | + |
| 58 | +### Available Scripts |
| 59 | + |
| 60 | +| Command | Description | |
| 61 | +| ------------------- | ----------------------------- | |
| 62 | +| `npm run build` | Compile TypeScript to `dist/` | |
| 63 | +| `npm run dev` | Run CLI directly with ts-node | |
| 64 | +| `npm test` | Run tests in watch mode | |
| 65 | +| `npm test -- --run` | Run tests once (CI mode) | |
| 66 | +| `npm run lint` | Check for linting errors | |
| 67 | +| `npm run format` | Format code with Prettier | |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Testing Guidelines |
| 72 | + |
| 73 | +### Writing Tests |
| 74 | + |
| 75 | +All new features **must** include tests. We use [Vitest](https://vitest.dev/) for testing. |
| 76 | + |
| 77 | +**Test categories:** |
| 78 | + |
| 79 | +- **Unit tests** — Test individual functions in isolation |
| 80 | +- **Integration tests** — Test CLI flows end-to-end |
| 81 | +- **Error tests** — Verify error handling and edge cases |
| 82 | + |
| 83 | +**Example test:** |
| 84 | + |
| 85 | +```typescript |
| 86 | +import { describe, it, expect } from 'vitest'; |
| 87 | +import { createProject } from '../src/generator'; |
| 88 | + |
| 89 | +describe('myFeature', () => { |
| 90 | + it('should do something specific', async () => { |
| 91 | + // Arrange |
| 92 | + const options = { name: 'test-project' }; |
| 93 | + |
| 94 | + // Act |
| 95 | + await createProject(options); |
| 96 | + |
| 97 | + // Assert |
| 98 | + expect(result).toBe(expected); |
| 99 | + }); |
| 100 | +}); |
| 101 | +``` |
| 102 | + |
| 103 | +### Running Tests |
| 104 | + |
| 105 | +```bash |
| 106 | +# Watch mode (default) |
| 107 | +npm test |
| 108 | + |
| 109 | +# Run once (CI) |
| 110 | +npm test -- --run |
| 111 | + |
| 112 | +# Run specific test file |
| 113 | +npm test -- generator.test.ts |
| 114 | + |
| 115 | +# Run with coverage |
| 116 | +npm test -- --coverage |
| 117 | +``` |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## Code Style |
| 122 | + |
| 123 | +We use **ESLint** and **Prettier** to maintain consistent code style. |
| 124 | + |
| 125 | +### Before Committing |
| 126 | + |
| 127 | +Run these commands to ensure your code passes CI: |
| 128 | + |
| 129 | +```bash |
| 130 | +npm run lint # Check for linting errors |
| 131 | +npm run format # Auto-format code |
| 132 | +npm test -- --run # Run all tests |
| 133 | +``` |
| 134 | + |
| 135 | +### Pre-commit Hooks |
| 136 | + |
| 137 | +If you have Husky installed, these checks run automatically on commit. If not: |
| 138 | + |
| 139 | +```bash |
| 140 | +npm run prepare # Install Git hooks |
| 141 | +``` |
| 142 | + |
| 143 | +### Style Guidelines |
| 144 | + |
| 145 | +- **TypeScript:** Strict mode enabled, no `any` types |
| 146 | +- **Imports:** Use absolute paths from `src/` |
| 147 | +- **Functions:** Prefer named exports |
| 148 | +- **Comments:** Use JSDoc for public APIs |
| 149 | +- **Errors:** Use descriptive error messages with actionable tips |
| 150 | + |
| 151 | +--- |
| 152 | + |
| 153 | +## Contribution Ideas |
| 154 | + |
| 155 | +### Good First Issues |
| 156 | + |
| 157 | +Look for issues labeled [`good first issue`](https://github.com/Jszigeti/launchts/labels/good%20first%20issue) — these are great for newcomers! |
| 158 | + |
| 159 | +### Areas to Improve |
| 160 | + |
| 161 | +- **New tools:** Add support for more dev tools (Jest, Vitest, etc.) |
| 162 | +- **Templates:** Add project templates (Express, CLI, library) |
| 163 | +- **Config options:** Expose more customization options |
| 164 | +- **Documentation:** Improve examples, add tutorials |
| 165 | +- **Performance:** Optimize file I/O, parallel operations |
| 166 | +- **Error messages:** Better error handling with helpful tips |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | +## Pull Request Process |
| 171 | + |
| 172 | +1. **Create a branch:** |
| 173 | + |
| 174 | + ```bash |
| 175 | + git checkout -b feature/my-awesome-feature |
| 176 | + ``` |
| 177 | + |
| 178 | +2. **Make your changes:** |
| 179 | + |
| 180 | + - Write code |
| 181 | + - Add/update tests |
| 182 | + - Update documentation if needed |
| 183 | + |
| 184 | +3. **Verify everything works:** |
| 185 | + |
| 186 | + ```bash |
| 187 | + npm run lint |
| 188 | + npm run format |
| 189 | + npm test -- --run |
| 190 | + npm run build |
| 191 | + ``` |
| 192 | + |
| 193 | +4. **Commit with a clear message:** |
| 194 | + |
| 195 | + ```bash |
| 196 | + git commit -m "feat: add support for Jest" |
| 197 | + ``` |
| 198 | + |
| 199 | + Use [conventional commits](https://www.conventionalcommits.org/): |
| 200 | + |
| 201 | + - `feat:` New feature |
| 202 | + - `fix:` Bug fix |
| 203 | + - `docs:` Documentation changes |
| 204 | + - `test:` Test changes |
| 205 | + - `refactor:` Code refactoring |
| 206 | + - `chore:` Maintenance tasks |
| 207 | + |
| 208 | +5. **Push and create PR:** |
| 209 | + |
| 210 | + ```bash |
| 211 | + git push origin feature/my-awesome-feature |
| 212 | + ``` |
| 213 | + |
| 214 | + Then open a Pull Request on GitHub with: |
| 215 | + |
| 216 | + - Clear description of changes |
| 217 | + - Link to related issues |
| 218 | + - Screenshots/examples if applicable |
| 219 | + |
| 220 | +6. **Respond to feedback:** |
| 221 | + - Address review comments |
| 222 | + - Keep the PR focused and small |
| 223 | + |
| 224 | +--- |
| 225 | + |
| 226 | +## Reporting Bugs |
| 227 | + |
| 228 | +Found a bug? [Open an issue](https://github.com/Jszigeti/launchts/issues/new) with: |
| 229 | + |
| 230 | +- **Title:** Clear, descriptive summary |
| 231 | +- **Description:** What happened vs. what you expected |
| 232 | +- **Steps to reproduce:** Minimal example to trigger the bug |
| 233 | +- **Environment:** Node version, OS, package manager |
| 234 | +- **Logs:** Any error messages or stack traces |
| 235 | + |
| 236 | +**Example:** |
| 237 | + |
| 238 | +```markdown |
| 239 | +**Bug:** ESLint config not created when using --eslint |
| 240 | + |
| 241 | +**Steps:** |
| 242 | + |
| 243 | +1. Run `npx launchts my-app --eslint` |
| 244 | +2. Check for `.eslintrc.json` |
| 245 | + |
| 246 | +**Expected:** `.eslintrc.json` should exist |
| 247 | +**Actual:** File is missing |
| 248 | + |
| 249 | +**Environment:** |
| 250 | + |
| 251 | +- Node: v20.10.0 |
| 252 | +- npm: 10.2.3 |
| 253 | +- OS: macOS 14.1 |
| 254 | +``` |
| 255 | + |
| 256 | +--- |
| 257 | + |
| 258 | +## Feature Requests |
| 259 | + |
| 260 | +Have an idea? [Open a discussion](https://github.com/Jszigeti/launchts/discussions/new) or issue with: |
| 261 | + |
| 262 | +- **Use case:** What problem does it solve? |
| 263 | +- **Proposed solution:** How should it work? |
| 264 | +- **Alternatives:** Other approaches you considered |
| 265 | +- **Examples:** Similar features in other tools |
| 266 | + |
| 267 | +--- |
| 268 | + |
| 269 | +## Code of Conduct |
| 270 | + |
| 271 | +Be respectful, inclusive, and constructive. We're all here to build something great together! |
| 272 | + |
| 273 | +--- |
| 274 | + |
| 275 | +## Recognition |
| 276 | + |
| 277 | +Contributors are recognized in: |
| 278 | + |
| 279 | +- Release notes |
| 280 | +- GitHub contributors page |
| 281 | +- Special shoutouts for significant contributions |
| 282 | + |
| 283 | +Thank you for making `launchts` better! ❤️ |
0 commit comments