Skip to content

Commit f884c3f

Browse files
Documentation update (#192)
* Add build documentation to README and Code Style Guide * Add checkout and running instructions to readme
1 parent 69de6c5 commit f884c3f

File tree

3 files changed

+96
-7
lines changed

3 files changed

+96
-7
lines changed

README.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,47 @@
11
# Stationhub
2-
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/unitystation/stationhub/dotnetcore.yml?style=flat-square)
3-
![Codacy grade](https://img.shields.io/codacy/grade/b6c9615ab3ba47f091efb0ff28e24798?style=flat-square)
4-
![AUR version](https://img.shields.io/aur/version/stationhub?style=flat-square)
5-
![Flathub](https://img.shields.io/flathub/v/org.unitystation.StationHub)
6-
![Discord](https://img.shields.io/discord/273774715741667329?style=flat-square)
2+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/unitystation/stationhub/dotnetcore.yml?style=flat-square)](https://github.com/unitystation/stationhub/actions/workflows/dotnetcore.yml)
3+
[![Codacy grade](https://img.shields.io/codacy/grade/b6c9615ab3ba47f091efb0ff28e24798?style=flat-square)](https://app.codacy.com/gh/unitystation/stationhub)
4+
[![AUR version](https://img.shields.io/aur/version/stationhub?style=flat-square)](https://aur.archlinux.org/packages/stationhub)
5+
[![Flathub](https://img.shields.io/flathub/v/org.unitystation.StationHub?style=flat-square)](https://flathub.org/apps/details/org.unitystation.StationHub)
6+
[![Discord](https://img.shields.io/discord/273774715741667329?style=flat-square)](https://discord.com/invite/tFcTpBp)
77

88
This is the official launcher for Unitystation, it handles account creation, downloading, updating, and server joining.
99

1010
## Tech-stack
11-
It is cross-platform using .Net 6.0 as the runtime and Avalonia for the UI.
11+
It is cross-platform using .NET 6 as the runtime and [Avalonia MVVM](https://docs.avaloniaui.net/guides/basics/mvvm) for the UI.
12+
13+
## Building
14+
You'll need [git](https://git-scm.com) and the [.NET 6 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) installed.
15+
16+
To check out the repo you can run the following in the directory you'd like to save the repo locally:
17+
```
18+
git clone https://github.com/unitystation/stationhub.git
19+
```
20+
21+
Once checked out you should be able to run the following in the directory with the `UnitystationLauncher.sln` file:
22+
```
23+
dotnet build
24+
```
25+
26+
Dependencies should be automatically restored by NuGet during the build process.
27+
28+
To test the build you just ran, you can do the following:
29+
```
30+
dotnet run --project ./UnitystationLauncher/UnitystationLauncher.csproj
31+
```
32+
33+
## Contributing
34+
Before opening your pull request please ensure there are no compile warnings for any new code that you've added.
35+
36+
.NET format is also enforced by the build pipeline, so before pushing your code you can run the following to make sure your code is formatted in the standard way:
37+
```
38+
dotnet format
39+
```
40+
41+
Unit Tests are a work in progress currently, however once they are included you'll be able to run them with:
42+
```
43+
dotnet test
44+
```
45+
46+
You'll want to ensure that existing tests pass, and make changes and additional tests where needed for your change.
47+
Also make sure to check out the [Code Style Guide](https://github.com/unitystation/stationhub/blob/develop/docs/code-style-guide.md) for the project.

docs/code-style-guide.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Code Style Guide
2+
## Class names for specific types
3+
### Services
4+
Services should be single instance classes that are used to access external resources such as web requests and files.
5+
6+
In `StandardModule.cs` we are registering every class which matches the pattern `*Service` as a single instance:
7+
```csharp
8+
builder.RegisterAssemblyTypes(ThisAssembly)
9+
.Where(t => t.Name.EndsWith("Service"))
10+
.SingleInstance();
11+
```
12+
13+
These class types should all be placed inside the `Services` directory of the project.
14+
15+
### View Models
16+
View Models are multi-instance classes which are tied to a View. These should be named the same as the view that they correspond to.
17+
18+
In `StandardModule.cs` we are registering every class which matches the pattern `*ViewModel`:
19+
```csharp
20+
builder.RegisterAssemblyTypes(ThisAssembly)
21+
.Where(t => t.Name.EndsWith("ViewModel"));
22+
```
23+
24+
These class types should all be placed inside the `ViewModels` directory of the project.
25+
26+
## Prefer using explicit types and new()
27+
Yes:
28+
```csharp
29+
Foo bar = new();
30+
```
31+
32+
No:
33+
```csharp
34+
Foo bar = new Foo();
35+
var bar = new Foo();
36+
```
37+
38+
## Prefer adding braces to statements
39+
This one will fail the code quality check in Codacy if not followed.
40+
41+
Yes:
42+
```csharp
43+
if (something)
44+
{
45+
return true;
46+
}
47+
```
48+
49+
No:
50+
```csharp
51+
if (something)
52+
return true;
53+
```

docs/flatpak-maintenance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The main thing to note is that the build servers disable internet access during
1818
### No NuGet Updates
1919
If there are no NuGet updates then the update process should be quite simple.
2020

21-
In the Flathub package repo there is a line at the top of `org.unitystation.StationHub.yaml` that defines the commit hash that the build server will check out before it builds.
21+
In the Flathub package repo there is a line in `org.unitystation.StationHub.yaml` that defines the commit hash that the build server will check out before it builds.
2222
It should look something like this:
2323
```yaml
2424
- name: StationHub

0 commit comments

Comments
 (0)