5.9 KiB
How to Contribute
This is a personal project forked from Radarr. We're not actively seeking contributions at this time, but this guide documents the development process.
Development
Aletheia is written in C# (backend) and JS (frontend). The backend is built on .NET 8, while the frontend utilizes React.
Tools required
- Visual Studio 2022 or higher is recommended (https://www.visualstudio.com/vs/). The community version is free and works (https://www.visualstudio.com/downloads/).
VS 2022 V17.8 or higher is recommended as it includes the .NET 8 SDK {.is-info}
- HTML/Javascript editor of choice (VS Code/Sublime Text/Webstorm/Atom/etc)
- Git
- The Node.js runtime is required. The following versions are supported:
- 20 (any minor or patch version within this) {.grid-list}
The Application will NOT run on older versions such as
18.x,16.xor any version below 20.0! Due to a dependency issue, it will also not run on21.xand is untested on other verisons. {.is-warning}
- Yarn is required to build the frontend
- Yarn is included with Node 20+ by default. Enable it with
corepack enable - For other Node versions, install it with
npm i -g corepack
- Yarn is included with Node 20+ by default. Enable it with
Getting started
- Clone the repository:
git clone https://github.com/cheir-mneme/aletheia.git - Install dependencies and build as described below
- (Optional) Install pre-commit hooks:
./scripts/setup-hooks.sh
The pre-commit hooks will automatically run lint checks before each commit. You can also run lint manually:
yarn lint --fixfor JS/TS,yarn stylelint-linux --fixfor CSS.
Building the frontend
-
Navigate to the cloned directory
-
Install the required Node Packages
yarn install -
Start webpack to monitor your development environment for any changes that need post processing using:
yarn start
Building the Backend
The backend solution is most easily built and ran in Visual Studio or Rider, however if the only priority is working on the frontend UI it can be built easily from command line as well when the correct SDK is installed.
Visual Studio
Ensure startup project is set to
Radarr.Consoleand framework tonet8.0{.is-info}
- First
Buildthe solution in Visual Studio, this will ensure all projects are correctly built and dependencies restored - Next
Debug/Runthe project in Visual Studio to start Aletheia - Open http://localhost:7878
Command line
- Clean solution
dotnet clean src/Radarr.sln -c Debug
- Restore and Build debug configuration for the correct platform (Posix or Windows)
dotnet msbuild -restore src/Radarr.sln -p:Configuration=Debug -p:Platform=Posix -t:PublishAllRids
- Run the produced executable from
/_output
Contributing Code
- Make meaningful commits using conventional commit format
- Add tests (unit/integration) for new features
- Commit with *nix line endings for consistency
- Use 4 spaces instead of tabs
- Match existing code patterns and style
Commit Format
Use Conventional Commits:
type(scope): description
Types:
feat: New featurefix: Bug fixdocs: Documentation onlyrefactor: Code change (no behavior change)test: Test additions/changeschore: Build, deps, config
Scope (optional): audiobook, metadata, ui, database, api, indexer
Examples:
feat(audiobook): add narrator matching logic
fix(metadata): handle API timeout gracefully
refactor(database): extract MediaItem base class
docs: update installation instructions
Pull Requesting
- Only make pull requests to
develop, nevermaster - Use meaningful feature branch names:
feature/,fix/,refactor/,docs/ - Each PR should contain related changes (one feature/bug fix per PR)
- Fill out the PR template completely
Unit Testing
Aletheia utilizes nunit for its unit, integration, and automation test suite.
Running Tests
Tests can be run easily from within VS using the included nunit3testadapter nuget package or from the command line using the included bash script test.sh.
From VS simply navigate to Test Explorer and run or debug the tests you'd like to examine.
Tests can be run all at once or one at a time in VS.
From command line the test.sh script accepts 3 parameters
test.sh <PLATFORM> <TYPE> <COVERAGE>
Writing Tests
While not always fun, we encourage writing unit tests for any backend code changes. This will ensure the change is functioning as you intended and that future changes dont break the expected behavior.
We currently require 80% coverage on new code when submitting a PR {.is-info}
If you have any questions about any of this, please let us know.
Translation
Translation files are stored in the repo at src/NzbDrone.Core/Localization. The English translation, en.json, serves as the source for all other translations.
Adding Translation Strings in Code
When adding a new string to either the UI or backend, a key must also be added to src/NzbDrone.Core/Localization/en.json along with the default value in English. This key may then be consumed as follows:
PRs for translation of log messages will not be accepted {.is-warning}
Backend Strings
Backend strings may be added utilizing the Localization Service GetLocalizedString method
private readonly ILocalizationService _localizationService;
public IndexerCheck(ILocalizationService localizationService)
{
_localizationService = localizationService;
}
var translated = _localizationService.GetLocalizedString("IndexerHealthCheckNoIndexers")
Frontend Strings
New strings can be added to the frontend by importing the translate function and using a key specified from en.json
import translate from 'Utilities/String/translate';
<div>
{translate('UnableToAddANewIndexerPleaseTryAgain')}
</div>