Skip to content

Commit

Permalink
feat: Moving the commands from the devfile to the vscode tasks.json a…
Browse files Browse the repository at this point in the history
…nd updating the document accordingly

Signed-off-by: Samantha Dawley <[email protected]>
  • Loading branch information
SDawley committed Oct 20, 2022
1 parent bf0688d commit a44fc6d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 52 deletions.
47 changes: 43 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
"group": "build"
},
{
"label": "Fix ts lint",
"command": "yarn run lint:fix",
"label": "[Chectl] Build",
"command": "yarn",
"type": "shell",
"args": [],
"problemMatcher": [
Expand All @@ -119,8 +119,47 @@
"group": "build"
},
{
"label": "Pack binaries",
"command": "yarn run pack-binaries",
"label": "[Chectl] Test",
"command": "yarn test",
"type": "shell",
"args": [],
"problemMatcher": [
"$tsc"
],
"presentation": {
"reveal": "always"
},
"group": "test"
},
{
"label": "[Chectl] Run",
"command": "./bin/run --help",
"type": "shell",
"args": [],
"problemMatcher": [
"$tsc"
],
"presentation": {
"reveal": "always"
},
"group": "test"
},
{
"label": "[Chectl] Format Sources",
"command": "yarn lint:fix",
"type": "shell",
"args": [],
"problemMatcher": [
"$tsc"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "[Chectl] Pack Binaries",
"command": "yarn pack-binaries",
"type": "shell",
"args": [],
"problemMatcher": [
Expand Down
22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ After starting the workspace, Che will clone sources of `chectl` to the `/projec

`chectl` is written in TypeScript. For its development, there is a dedicated `dev` container that has preinstalled software for comfortable development. This allows the developer to build, test, and launch `chectl` inside the container.

Your workspace will be initialized with a list of commands described in the [devfile](devfile.yaml) `commands` section. The commands are:
- build
- test
- run
- package-binaries
- format-sources
Your workspace will be initialized with a list of commands described in the [tasks.json](.vscode/tasks.json) file. The commands are:
- Build
- Test
- Run
- Package Binaries
- Format Sources

You can run commands through the **Terminal** menu by clicking **Terminal => Run Task... => che** and selecting the desired task.
You can run commands through the **Terminal** menu by clicking **Terminal => Run Task... ** and selecting the desired task.

## Build

```bash
yarn
```

Running the `che: build` command will run `yarn` in the `/projects/chectl` directory inside `dev` container. The command will install all necessary dependencies and compile the project. Upon successful assembly, a new `bin` directory will appear in the project directory and will have two files: `run` and `run.cmd`.
Running the `[Chectl] Build` command will run `yarn` in the `/projects/chectl` directory inside `dev` container. The command will install all necessary dependencies and compile the project. Upon successful assembly, a new `bin` directory will appear in the project directory and will have two files: `run` and `run.cmd`.


## Run tests
Expand All @@ -51,7 +51,7 @@ yarn test
```

Tests for `chectl` are written by using the [jest](https://jestjs.io/docs/getting-started) framework.
To run tests, find and launch the `che: test` command. The command will run `yarn test` inside `dev` container.
To run tests, find and launch the `[Chectl] Test` command. The command will run `yarn test` inside `dev` container.
Testing summary will be printed to the output.


Expand All @@ -61,11 +61,11 @@ Testing summary will be printed to the output.
./bin/run --help
```

To test ensure `chectl` is built successfully, launch the `che: run` command. It wil run `chectl` with `--help` directive.
To test ensure `chectl` is built successfully, launch the `[Chectl] Run` command. It wil run `chectl` with `--help` directive.

## Package binaries
For packaging binaries, [oclif](https://github.com/oclif/dev-cli) is used. It generates packages for Linux, Windows, and MacOS operating systems and puts the result in the `dist/channels/stable` directory.
To start packaging, just run the `che: package-binaries` command. It will run the following in the `/projects/chectl` directory:
To start packaging, just run the `[Chectl] Package Binaries` command. It will run the following in the `/projects/chectl` directory:

```bash
yarn oclif-dev pack
Expand Down
37 changes: 0 additions & 37 deletions devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,3 @@ components:
memoryLimit: 5G
memoryRequest: 1G

commands:
- id: build
exec:
label: "Install depenedencies and build the app"
component: dev
commandLine: "yarn"
group:
kind: build
- id: test
exec:
label: "Run jest tests"
component: dev
commandLine: "yarn test"
group:
kind: test
- id: run
exec:
label: "Test that the app is working correctly by running with the --help command"
component: dev
commandLine: "./run --help"
workingDir: ${PROJECT_SOURCE}/bin
group:
kind: test
- id: package-binaries
exec:
label: "Package binaries into tarballs"
component: dev
commandLine: "yarn pack-binaries"
group:
kind: build
- id: format-sources
exec:
label: "Run 'yarn lint:fix'"
component: dev
commandLine: "yarn lint:fix"
group:
kind: build

0 comments on commit a44fc6d

Please sign in to comment.