|
| 1 | +# Contributing to DevWorkspace Generator |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the DevWorkspace Generator! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Reporting Issues |
| 6 | + |
| 7 | +Issues are tracked at [github.com/eclipse/che/issues](https://github.com/eclipse/che/issues). When filing a bug or feature request, please use the appropriate [issue template](https://github.com/devfile/devworkspace-generator/issues/new/choose). |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +- [Node.js](https://nodejs.org/) (LTS recommended) |
| 12 | +- [Yarn](https://yarnpkg.com/) package manager |
| 13 | + |
| 14 | +## Getting Started |
| 15 | + |
| 16 | +1. Fork and clone the repository: |
| 17 | + |
| 18 | + ```bash |
| 19 | + git clone https://github.com/<your-username>/devworkspace-generator.git |
| 20 | + cd devworkspace-generator |
| 21 | + ``` |
| 22 | + |
| 23 | +2. Install dependencies: |
| 24 | + |
| 25 | + ```bash |
| 26 | + yarn install |
| 27 | + ``` |
| 28 | + |
| 29 | +3. Build the project: |
| 30 | + |
| 31 | + ```bash |
| 32 | + yarn build |
| 33 | + ``` |
| 34 | + |
| 35 | + This runs formatting checks, compilation, linting, and tests. |
| 36 | + |
| 37 | +## Development Workflow |
| 38 | + |
| 39 | +### Building |
| 40 | + |
| 41 | +```bash |
| 42 | +yarn compile # Compile TypeScript |
| 43 | +yarn build # Full build (format + compile + lint + test) |
| 44 | +yarn watch # Watch mode for incremental compilation |
| 45 | +``` |
| 46 | + |
| 47 | +### Formatting |
| 48 | + |
| 49 | +The project uses [Prettier](https://prettier.io/) with the following configuration: |
| 50 | +- Print width: 120 |
| 51 | +- Single quotes |
| 52 | +- Arrow parens: avoid |
| 53 | + |
| 54 | +```bash |
| 55 | +yarn format # Check formatting |
| 56 | +yarn format:fix # Auto-fix formatting issues |
| 57 | +``` |
| 58 | + |
| 59 | +### Linting |
| 60 | + |
| 61 | +[ESLint](https://eslint.org/) is used for static analysis. |
| 62 | + |
| 63 | +```bash |
| 64 | +yarn lint # Run linter |
| 65 | +yarn lint:fix # Auto-fix lint issues |
| 66 | +``` |
| 67 | + |
| 68 | +### Testing |
| 69 | + |
| 70 | +Tests are written with [Jest](https://jestjs.io/) and located in the `tests/` directory. |
| 71 | + |
| 72 | +```bash |
| 73 | +yarn test # Run tests with coverage |
| 74 | +``` |
| 75 | + |
| 76 | +**Important:** This project requires **100% code coverage** (branches, functions, lines, and statements). All new code must be fully covered by tests. |
| 77 | + |
| 78 | +## Submitting a Pull Request |
| 79 | + |
| 80 | +1. Create a branch for your changes: |
| 81 | + |
| 82 | + ```bash |
| 83 | + git checkout -b my-feature |
| 84 | + ``` |
| 85 | + |
| 86 | +2. Make your changes, ensuring: |
| 87 | + - Code compiles without errors (`yarn compile`) |
| 88 | + - Formatting passes (`yarn format`) |
| 89 | + - Linting passes (`yarn lint`) |
| 90 | + - All tests pass with 100% coverage (`yarn test`) |
| 91 | + |
| 92 | +3. Run the full build to verify everything: |
| 93 | + |
| 94 | + ```bash |
| 95 | + yarn build |
| 96 | + ``` |
| 97 | + |
| 98 | +4. Commit your changes and push to your fork. |
| 99 | + |
| 100 | +5. Open a pull request against the `main` branch. Fill out the [PR template](https://github.com/devfile/devworkspace-generator/blob/main/.github/PULL_REQUEST_TEMPLATE.md), which asks: |
| 101 | + - What does this PR do? |
| 102 | + - What issues does this PR fix or reference? |
| 103 | + - Is it tested? How? |
| 104 | + |
| 105 | +## Project Structure |
| 106 | + |
| 107 | +``` |
| 108 | +src/ |
| 109 | +├── api/ # DevfileContext API types |
| 110 | +├── bitbucket/ # Bitbucket Cloud URL resolver |
| 111 | +├── bitbucket-server/ # Bitbucket Server URL resolver |
| 112 | +├── devfile/ # Devfile processing (component finder/inserter) |
| 113 | +├── devfile-schema/ # Devfile JSON schemas (2.0.0 – 2.3.0) |
| 114 | +├── editor/ # Editor definition resolver |
| 115 | +├── fetch/ # URL fetching utilities |
| 116 | +├── github/ # GitHub URL resolver |
| 117 | +├── inversify/ # Dependency injection bindings |
| 118 | +├── resolve/ # Git URL resolution |
| 119 | +├── entrypoint.ts # CLI entrypoint |
| 120 | +├── generate.ts # DevWorkspace generation logic |
| 121 | +├── main.ts # Library main export |
| 122 | +└── types.ts # Shared types |
| 123 | +tests/ # Test files mirroring src/ structure |
| 124 | +``` |
| 125 | + |
| 126 | +## License |
| 127 | + |
| 128 | +This project is licensed under the [Apache License 2.0](LICENSE). By contributing, you agree that your contributions will be licensed under the same license. |
0 commit comments