Skip to content

Commit 0c938bf

Browse files
authored
Merge branch 'main' into Formatting-Backend
2 parents 52a000d + f62c6ed commit 0c938bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2151
-31
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Frontend Build
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
project: ['aro', 'mcc']
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: denoland/setup-deno@v2
16+
with:
17+
deno-version: v2.x
18+
- name: Install dependencies for ${{matrix.project}}
19+
run: |
20+
cd ./gs/frontend/${{matrix.project}}
21+
deno install
22+
- name: Build ${{matrix.project}}
23+
run: |
24+
cd ./gs/frontend/${{matrix.project}}
25+
deno task build

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
- uses: actions/setup-python@v3
1414
with:
1515
python-version: '3.10'
16+
- uses: denoland/setup-deno@v2
17+
with:
18+
deno-version: v2.x
1619
- id: file_changes
1720
uses: trilom/file-changes-action@v1.2.4
1821
with:

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ dkms.conf
5656
.idea/
5757
compile_commands.json
5858
.cache/
59+
*.suo
60+
*.ntvs*
61+
*.njsproj
62+
*.sln
63+
*.sw?
5964

6065
.env
6166

@@ -74,3 +79,23 @@ __pycache__/
7479
*.coverage
7580
.mypy_cache/
7681
.ruff_cache/
82+
83+
# Frontend Dependencies
84+
*node_modules
85+
*.pnp
86+
.pnp.js
87+
88+
# Logs
89+
logs
90+
*.log
91+
npm-debug.log*
92+
yarn-debug.log*
93+
yarn-error.log*
94+
pnpm-debug.log*
95+
lerna-debug.log*
96+
97+
# Frontend build
98+
*dist
99+
*dist-ssr
100+
*.local
101+
*.vite

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
- id: trailing-whitespace
88
exclude: '(libs|hal)/.*'
99
- id: end-of-file-fixer
10-
exclude: '(libs|hal)/.*'
10+
exclude: '((libs|hal)/.*|\.(ts|tsx|css|html|json|md|yaml|yml|ipynb)$)'
1111
- id: check-added-large-files
1212
exclude: '(libs|hal)/.*'
1313
- repo: https://github.com/pre-commit/mirrors-clang-format
@@ -22,3 +22,7 @@ repos:
2222
- id: ruff
2323
args: ["--fix"]
2424
- id: ruff-format
25+
- repo: https://github.com/nozaq/pre-commit-deno
26+
rev: 0.1.0
27+
hooks:
28+
- id: deno-fmt

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ endif()
3737
if(${CMAKE_BUILD_TYPE} MATCHES GS)
3838
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
3939
enable_language(C CXX)
40-
add_subdirectory(gs)
40+
add_subdirectory(gs/backend)
4141
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/cserialport)
4242
endif()
4343

README.md

Lines changed: 80 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This repository holds all the code written by UW Orbital's firmware team. This i
99
- [C Style Guide](#c-style-guide)
1010
- [Python Style Guide](#python-style-guide)
1111
- [Pytest Style Guide](#pytest-style-guide)
12+
- [Typescript/React Style Guide](#typescript/react-style-guide)
1213
- [Authors](#authors)
1314

1415
**[Back to top](#table-of-contents)**
@@ -23,7 +24,7 @@ This section will explain how to set up the repo, and how to build, flash, and d
2324
2. To clone this project, run the following command in whatever directory you want to store the repository in:
2425

2526
```
26-
git clone git@github.com:UWOrbital/OBC-firmware.git
27+
git clone https://github.com/UWOrbital/OBC-firmware.git
2728
```
2829

2930
### Dependencies
@@ -63,11 +64,11 @@ Once you open the docker instance, open a terminal in VSCode and run the followi
6364
This command opens a terminal in VSCode: `` Ctrl + Shift + ` ``
6465

6566
Enter these commands in your terminal:
66-
67-
```
67+
```sh
6868
sudo apt-get update
69-
sudo apt-get install -y python3-pip build-essential cmake gcc-multilib g++-multilib
69+
sudo apt-get install -y python3-pip build-essential cmake gcc-multilib g++-multilib curl
7070
pip3 install -r requirements.txt
71+
curl -fsSL https://deno.land/install.sh | sh # Deno is required for pre-commit
7172
pre-commit install
7273
```
7374

@@ -88,7 +89,7 @@ Skip this section if you set up a Docker development environment.
8889
2. In WSL2, run the following:
8990
```sh
9091
sudo apt-get update
91-
sudo apt-get install build-essential gcc-multilib g++-multilib
92+
sudo apt-get install build-essential gcc-multilib g++-multilib curl
9293
```
9394
3. Choose the environment where you'll be running `git commit` (either WSL2 or the host) and install Python 3.10 and pip. (Only required for Python devs)
9495
A. If using WSL, follow the instructions under the `Linux` section 2.
@@ -107,6 +108,7 @@ Skip this section if you set up a Docker development environment.
107108
4. Setup pre-commit.
108109
In the WSL, under the OBC-firmware directory, run the following commands:
109110
```sh
111+
curl -fsSL https://deno.land/install.sh | sh # Deno is required for pre-commit
110112
pip install -r requirements.txt # You may want to create a Python virtual env before this if you haven't already
111113
pre-commit install
112114
```
@@ -129,7 +131,7 @@ brew install make
129131
brew install gcc
130132
```
131133

132-
2. Install Python 3.10 and setup Python virtual environment (Only required for Python devs)
134+
2. Install Python 3.10 and setup Python virtual environment (Only required for Backend devs)
133135

134136
Run the following commands in the OBC-firmware directory:
135137

@@ -144,6 +146,7 @@ pip install -e .
144146
3. Setup pre-commit
145147

146148
```sh
149+
curl -fsSL https://deno.land/install.sh | sh # Deno is required for pre-commit
147150
pip install -r requirements.txt # You may want to create a Python virtual env before this if you haven't already
148151
pre-commit install
149152
```
@@ -156,10 +159,10 @@ Skip this section if you set up a Docker development environment.
156159

157160
```sh
158161
sudo apt-get update
159-
sudo apt-get install build-essential gcc-multilib g++-multilib
162+
sudo apt-get install build-essential gcc-multilib g++-multilib curl
160163
```
161164

162-
2. Install Python 3.10 and setup Python virtual environment (Only required for Python devs)
165+
2. Install Python 3.10 and setup Python virtual environment (Only required for Backend devs)
163166

164167
Run the following commands in the OBC-firmware directory:
165168

@@ -174,6 +177,7 @@ pip install -e .
174177
3. Setup pre-commit
175178

176179
```sh
180+
curl -fsSL https://deno.land/install.sh | sh # Deno is required for pre-commit
177181
pip install -r requirements.txt # You may want to create a Python virtual env before this if you haven't already
178182
pre-commit install
179183
```
@@ -280,6 +284,24 @@ Then, click `Start` to begin a session. Select the `OBC-firmware.out` executable
280284

281285
We use Code Composer Studio for debugging the firmware. **TODO**: Write a tutorial on how to use CCS.
282286

287+
### **Frontend Development**
288+
289+
To run the frontend, you will need Deno 2 installed which was installed in the pre-commit setup instructions above.
290+
291+
#### **Running the ARO Frontend**
292+
293+
```sh
294+
cd gs/frontend/aro # Assuming you are in the top-level directory
295+
deno task dev # This will start the frontend on localhost:5173
296+
```
297+
298+
#### **Running the MCC Frontend**
299+
300+
```sh
301+
cd gs/frontend/mcc # Assuming you are in the top-level directory
302+
deno task dev # This will start the frontend on localhost:5173
303+
```
304+
283305
## Contributing
284306

285307
1. Make sure you're added as a member to the UW Orbital organization on GitHub.
@@ -428,6 +450,7 @@ File comments are not required
428450
class PointTwoDimension:
429451
"""
430452
@brief Class for storing a 2D point
453+
431454
@attribute x (int) - x coordinate of the point
432455
@attribute y (int) - y coordinate of the point
433456
"""
@@ -436,7 +459,7 @@ class PointTwoDimension:
436459
self.x = x
437460
self.y = y
438461

439-
@dataclasses.dataclass
462+
@dataclass
440463
class PointTwoDimension:
441464
"""
442465
@brief Class for storing a 2D point
@@ -449,10 +472,10 @@ class PointTwoDimension:
449472
```
450473

451474
```python
452-
import enum
475+
from enum import Enum
453476

454477
# No comments required
455-
class ErrorCode(enum.Enum):
478+
class ErrorCode(Enum):
456479
"""
457480
@brief Enum for the error codes
458481
"""
@@ -472,9 +495,9 @@ class ErrorCode(enum.Enum):
472495

473496
```python
474497
# For brevity, the class comments were removed but they should be in real code
475-
import dataclasses
498+
from dataclasses import dataclass
476499

477-
@dataclasses.dataclass
500+
@dataclass
478501
class PointTwoDimension:
479502
x: int
480503
y: int
@@ -488,9 +511,9 @@ class ErrorCode(enum.Enum):
488511
- `EnumName` in PascalCase
489512

490513
```python
491-
import enum
514+
from enum import Enum
492515

493-
class ErrorCode(enum.Enum):
516+
class ErrorCode(Enum):
494517
SUCCESS = 0
495518
INVALID_ARG = 1
496519

@@ -508,21 +531,21 @@ Handled by pre-commit
508531
#### Notes about imports
509532

510533
- Imports should only be used at the top of the file (no function or scoped imports)
511-
- Only modules should be imported
534+
- Modules should not be imported
512535

513536
```python
514537
# module1 contains very_long_module_name and function foo and variable var.
515538
# very_long_module_name contains bar
516539

517-
# Yes:
518-
from module1 import very_long_module_name as module2 # Casting to shorter name
540+
# No:
541+
from module1 import very_long_module_name as module2
519542
import module1
520543

521544
module1.foo()
522545
module1.var
523546
module2.bar()
524547

525-
# No:
548+
# Yes:
526549
from module1.very_long_module_name import bar
527550
from module1 import foo, var
528551

@@ -547,6 +570,44 @@ bar()
547570

548571
**[Back to top](#table-of-contents)**
549572

573+
## Typescript/React Style Guide
574+
575+
### Comments
576+
577+
#### Single Line Comments
578+
579+
Variable and function names should be descriptive enough to understand even without comments. Comments are needed to describe any complicated logic. You may use `//` or `/* */` for single line comments.
580+
581+
#### Function Comments
582+
583+
Function comments should follow the format shown below:
584+
```typescript
585+
/**
586+
* @brief Adds two numbers together
587+
*
588+
* @param num1 - The first number to add.
589+
* @param num2 - The second number to add.
590+
* @return Returns the sum of the two numbers.
591+
*/
592+
function addNumbers(num1: number, num2: number): number {
593+
return num1 + num2;
594+
}
595+
```
596+
597+
#### File Comments
598+
599+
- File comments are not required
600+
601+
### ****Naming and typing conventions****
602+
603+
- `variableNames` in camelCase
604+
- `functionNames()` in camelCase
605+
- `CONSTANT_NAME` in CAPITAL_SNAKE_CASE
606+
- `file_names` in snake_case
607+
- `ClassName` and `ComponentName` in PascalCase
608+
609+
**[Back to top](#table-of-contents)**
610+
550611
## Authors
551612

552613
This codebase was developed by the members of UW Orbital, the University of Waterloo's CubeSat design team.

deno.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"fmt": {
3+
"include": ["gs/frontend/"]
4+
}
5+
}
File renamed without changes.

0 commit comments

Comments
 (0)