Skip to content

Commit a567193

Browse files
AmmarAbouZorDmitryAstafyev
authored andcommitted
Docs: Improve Contributing & Add Debugging
* Add Debugging instructions to docs. * Split contributing into multiple files without duplication in content. * Include all commands needed for installing dependencies in one document to make simpler for developers. * Clean up old contributing file + Check all links are valid. * Add comments to rake readme file to tell developers that this is deprecated now.
1 parent 8bac5fe commit a567193

10 files changed

Lines changed: 283 additions & 348 deletions

File tree

contribution.md

Lines changed: 0 additions & 167 deletions
This file was deleted.

developing/scripts/check.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/bin/bash
2+
3+
# This script isn't used anymore because the environment checks are
4+
# included within Chipmunk Development CLI Tool in `{CHIPMUNK_ROOT}/cli/dev-cli`.
5+
26
ERRORS=0;
37
if node -v &>/dev/null; then
48
echo "NodeJS is OK"

docs/contributing/debugging.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
This guide covers debugging the Chipmunk application, including logs and component-specific procedures
2+
3+
## Debugging Procedures
4+
5+
### Frontend Components
6+
7+
The Chipmunk frontend consists of multiple components, each with a different debugging method.
8+
9+
#### Debugging Electron App
10+
11+
To debug the Electron `holder` application, located at `{CHIPMUNK_ROOT}/application/holder`, a debug session can be invoked directly from VS Code or any debugger that supports its launch configurations.
12+
13+
A standard launch configuration object must be added to your debugger's settings. This configuration should point to the Electron executable and the application's entry point.
14+
15+
```json
16+
{
17+
"type": "node",
18+
"request": "launch",
19+
"name": "Debug Electron",
20+
"runtimeExecutable": "${workspaceRoot}/application/holder/node_modules/.bin/electron",
21+
"program": "${workspaceRoot}/application/holder/src/app.ts",
22+
"outFiles": ["${workspaceRoot}/application/holder/dist/**/*.js"]
23+
}
24+
```
25+
26+
Before starting each debug session, you must build the application with the development CLI tool via:
27+
28+
```sh
29+
cargo chipmunk build app
30+
```
31+
32+
#### Debugging Client
33+
34+
The application `client`, located at `{CHIPMUNK_ROOT}/application/client`, is a standard web application that you can debug using the built-in **Chromium Developer Tools**.
35+
36+
**1. Opening Developer Tools**
37+
38+
You can open the developer tools in several ways:
39+
40+
* **Menu:** Select `Chipmunk` -> `Developing` -> `Toggle Developer Tools`.
41+
* **Shortcut:** Press **Ctrl + Shift + I**.
42+
* **Environment Variable:** Set `CHIPMUNK_DEVELOPING_MODE=true` before launching the application.
43+
44+
**2. Using the Debugger**
45+
46+
Once the developer tools are open, you can:
47+
* Inspect `console.log()` output in the **Console** tab.
48+
* Set breakpoints in the source code under the **Sources** tab, located at `webpack:///./src/`.
49+
50+
#### Debugging Communication Libraries
51+
52+
Chipmunk uses several shared libraries to facilitate communication between the Rust backend and the frontend components.
53+
54+
You can debug these libraries using the same VS Code workflow as the Electron `holder`. However, because these libraries are copied into the `holder`'s `node_modules` directory during the build process, you'll need to use the specific debug paths listed below.
55+
56+
* **`platform`**: Provides shared type definitions for frontend projects. Debug at `{CHIPMUNK_ROOT}/application/holder/node_modules/platform`.
57+
* **`ts-bindings`**: Includes type definitions for Rust-to-Electron communication. Debug at `{CHIPMUNK_ROOT}/application/holder/node_modules/rustcore/ts-bindings`.
58+
59+
----
60+
61+
### Rust Backend
62+
63+
The recommended methods for debugging the Rust backend are print-based debugging and structured logging.
64+
65+
You can use Rust's standard printing macros for immediate feedback during development. For more persistent and configurable diagnostics, the backend uses a logging framework, which is the primary method for monitoring the application's behavior.
66+
67+
The configuration for this logging system is detailed in the next section.
68+
69+
----
70+
71+
## Logs and Configuration Files
72+
73+
Checking the log output is the first step in diagnosing most issues. Chipmunk's log files and their configurations are located within the Chipmunk home directory.
74+
75+
### Log Files
76+
77+
* `chipmunk.log`: Logs for the Chipmunk Electron frontend.
78+
* `chipmunk.indexer.log`: Logs for the Chipmunk Rust backend (indexer).
79+
* `chipmunk.updater.log`: Logs for the Chipmunk updater binary.
80+
* `chipmunk.launcher.log`: Logs for the application during backend initialization.
81+
82+
### Configuration Files
83+
84+
Backend logging is configured using the [log4rs](https://docs.rs/log4rs/latest/log4rs/index.html) crate. To adjust log levels or other settings, modify the relevant YAML files.
85+
86+
* `log4rs.yaml`: Configuration for the Rust backend. (Note: The first line of this file is used for version control and should not be changed.)
87+
* `log4rs_updater.yaml`: Configuration for the updater tool.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
## Development Workflow
2+
3+
Chipmunk consists of a Rust backend for log processing, an Electron/Angular frontend application, and smaller libraries facilitating communication between them. Development tasks across these different components are managed using the [Chipmunk Development CLI Tool](./dev-cli.md).
4+
5+
This tool simplifies common operations such as building, linting, and running various parts of Chipmunk. It automatically handles project dependencies and tracks changes in source files, ensuring that only necessary components are rebuilt.
6+
For comprehensive details on all available commands and functionalities, please consult the documentation for the development CLI tool.
7+
8+
### Building the Application
9+
10+
Use the development CLI tool to build the Chipmunk application:
11+
12+
```sh
13+
# For development build
14+
cargo chipmunk build app
15+
16+
# For production build
17+
cargo chipmunk build app -p
18+
```
19+
These commands automatically determine and build only the components that have changed since the last build, optimizing build times.
20+
21+
### Running the Application
22+
23+
You can similarly use the run command to start the Chipmunk application:
24+
25+
```sh
26+
# Run in development
27+
cargo chipmunk run
28+
29+
# Run in production
30+
cargo chipmunk run -p
31+
```
32+
The run command automatically performs any necessary builds of modified components before launching the application interface.
33+
34+
### Development CLI Help
35+
36+
To explore the full range of commands and options available with the `cargo chipmunk` development tool, use the `--help` flag:
37+
38+
To list all top-level commands:
39+
```sh
40+
cargo chipmunk --help
41+
```
42+
43+
To view options for a specific command (for example, the `build` command):
44+
```sh
45+
cargo chipmunk build --help
46+
```
47+
48+
## Code Quality Checks
49+
50+
Before submitting a Pull Request (PR), please run the linters and tests using the development CLI tool. This helps ensure your changes follow the project's coding style and pass basic automated checks.
51+
52+
To check for formatting issues, code smells, or potential errors, run the linters:
53+
54+
Run linters for the entire project:
55+
```sh
56+
cargo chipmunk lint
57+
```
58+
59+
To run linting for the backend only you can use
60+
61+
```sh
62+
cargo chipmunk lint core binding
63+
```
64+
65+
To run linting for the frontend only you can use
66+
67+
```sh
68+
cargo chipmunk lint shared wrapper client app
69+
```
70+
71+
Ensure your changes are covered by appropriate test cases. Run all test cases to verify that everything is working as expected:
72+
73+
```sh
74+
cargo chipmunk test
75+
```
76+
77+
## Reporting Issues
78+
79+
Your contributions through bug reports and suggestions are greatly appreciated!
80+
81+
If you discover any bugs, have suggestions for improvements, or identify potential issues within Chipmunk, please report them by opening a new issue on the project's GitHub repository. When reporting bugs, providing a clear description and steps to reproduce the issue is very helpful.

0 commit comments

Comments
 (0)