Skip to content

Commit c7c9ba2

Browse files
authored
chore: update devfile and add CONTRIBUTING.md (#346)
* chore: update devfile; add CONTRIBUTING.md Signed-off-by: Valerii Svydenko <vsvydenk@redhat.com> * update generate devworkspace command Signed-off-by: Valerii Svydenko <vsvydenk@redhat.com> * improve generate devworkspace command Signed-off-by: Valerii Svydenko <vsvydenk@redhat.com> --------- Signed-off-by: Valerii Svydenko <vsvydenk@redhat.com>
1 parent 03f2514 commit c7c9ba2

File tree

3 files changed

+156
-12
lines changed

3 files changed

+156
-12
lines changed

.devfile.yaml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ metadata:
44
components:
55
- name: builder
66
container:
7-
image: quay.io/devfile/universal-developer-image:ubi8-latest
7+
image: quay.io/devfile/universal-developer-image:ubi10-latest
88
memoryRequest: 256Mi
99
memoryLimit: 3Gi
1010
cpuRequest: 100m
@@ -15,27 +15,42 @@ commands:
1515
label: "1. Build"
1616
component: builder
1717
workingDir: ${PROJECTS_ROOT}/devworkspace-generator
18-
commandLine: |
19-
nvm use v${NODEJS_20_VERSION}
20-
yarn && yarn format:fix && yarn build
18+
commandLine: yarn && yarn format:fix && yarn build
2119
- id: test
2220
exec:
2321
label: "2. Run tests"
2422
component: builder
2523
workingDir: ${PROJECTS_ROOT}/devworkspace-generator
26-
commandLine: |
27-
nvm use v${NODEJS_20_VERSION}
28-
yarn test
24+
commandLine: yarn test
25+
- id: license-check
26+
exec:
27+
label: "3. Check licenses"
28+
component: builder
29+
workingDir: ${PROJECTS_ROOT}/devworkspace-generator
30+
commandLine: yarn license:check
31+
- id: license-generate
32+
exec:
33+
label: "4. Generate licenses"
34+
component: builder
35+
workingDir: ${PROJECTS_ROOT}/devworkspace-generator
36+
commandLine: yarn license:generate
2937
- id: generate-devworkspace
3038
exec:
31-
label: "3. Generate DevWorkspace with Template"
39+
label: "5. Generate DevWorkspace with Template"
3240
component: builder
3341
workingDir: ${PROJECTS_ROOT}/devworkspace-generator
3442
commandLine: |
35-
nvm use v${NODEJS_20_VERSION}
43+
DEFAULT_DEVFILE_URL="https://github.com/che-incubator/quarkus-api-example/tree/main"
44+
DEFAULT_EDITOR_URL="https://raw.githubusercontent.com/eclipse-che/che-operator/refs/heads/main/editors-definitions/che-code-insiders.yaml"
45+
echo "Enter devfile URL (default: ${DEFAULT_DEVFILE_URL}):"
46+
read DEVFILE_URL
47+
DEVFILE_URL="${DEVFILE_URL:-${DEFAULT_DEVFILE_URL}}"
48+
echo "Enter editor URL (default: ${DEFAULT_EDITOR_URL}):"
49+
read EDITOR_URL
50+
EDITOR_URL="${EDITOR_URL:-${DEFAULT_EDITOR_URL}}"
3651
node lib/entrypoint.js \
37-
--devfile-url:https://github.com/che-samples/java-spring-petclinic/tree/main \
38-
--editor-url:https://raw.githubusercontent.com/eclipse-che/che-operator/refs/heads/main/editors-definitions/che-code-insiders.yaml \
52+
--devfile-url:"${DEVFILE_URL}" \
53+
--editor-url:"${EDITOR_URL}" \
3954
--output-file:/tmp/devworkspace-che-code-latest.yaml \
4055
--injectDefaultComponent:true \
4156
--defaultComponentImage:registry.access.redhat.com/ubi8/openjdk-11:latest

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"dbaeumer.vscode-eslint",
44
"redhat.vscode-yaml",
55
"Orta.vscode-jest",
6-
"cnshenj.vscode-task-manager"
6+
"cnshenj.vscode-task-manager",
7+
"RooVeterinaryInc.roo-cline"
78
]
89
}

CONTRIBUTING.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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

Comments
 (0)