-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from bludnic/moon
Migrate to Moonrepo
- Loading branch information
Showing
78 changed files
with
1,383 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"opentrader": minor | ||
"frontend": minor | ||
"processor": minor | ||
--- | ||
|
||
- Migrated to Moonrepo | ||
- Added DTS in the NPM package | ||
- Use Docker Build Cloud | ||
- Improve CONTRIBUTING.md | ||
- Fixed missing return type in `exchange.placeMarketOrder` method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.next | ||
.dist | ||
.env | ||
.moon/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
$schema: "https://moonrepo.dev/schemas/toolchain.json" | ||
|
||
node: | ||
version: "20.18.0" | ||
packageManager: "pnpm" | ||
pnpm: | ||
version: "9.12.0" | ||
|
||
typescript: | ||
syncProjectReferences: true | ||
syncProjectReferencesToPaths: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# https://moonrepo.dev/docs/config/workspace | ||
$schema: "https://moonrepo.dev/schemas/workspace.json" | ||
|
||
# Require a specific version of moon while running commands, otherwise fail. | ||
# versionConstraint: '>=1.0.0' | ||
|
||
# Extend and inherit an external configuration file. Must be a valid HTTPS URL or file system path. | ||
# extends: './shared/workspace.yml' | ||
|
||
# REQUIRED: A map of all projects found within the workspace, or a list or file system globs. | ||
# When using a map, each entry requires a unique project ID as the map key, and a file system | ||
# path to the project folder as the map value. File paths are relative from the workspace root, | ||
# and cannot reference projects located outside the workspace boundary. | ||
projects: | ||
- "apps/*" | ||
- "packages/*" | ||
- "pro/*" | ||
|
||
# Configures the version control system to utilize within the workspace. A VCS | ||
# is required for determining touched (added, modified, etc) files, calculating file hashes, | ||
# computing affected files, and much more. | ||
vcs: | ||
# The client to use when managing the repository. | ||
# Accepts "git". Defaults to "git". | ||
manager: "git" | ||
|
||
# The default branch (master/main/trunk) in the repository for comparing the | ||
# local branch against. For git, this is is typically "master" or "main", | ||
# and must include the remote prefix (before /). | ||
defaultBranch: "dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,20 +7,13 @@ node -v | |
# `pnpm` must be installed | ||
pnpm -v | ||
|
||
# Install Turborepo globally | ||
pnpm install turbo --global | ||
# `moonrepo` must be installed | ||
moon --version | ||
|
||
# Docker (optional) | ||
docker -v | ||
``` | ||
|
||
> [!WARNING] | ||
> Due to a [bug](https://github.com/bludnic/opentrader/issues/53) in turbo that makes the Frontend app inaccessible in the browser, please use version `2.0.9` as a workaround. | ||
```bash | ||
pnpm i -g [email protected] | ||
``` | ||
|
||
## Setup | ||
|
||
1. Clone the repository: | ||
|
@@ -58,27 +51,27 @@ pnpm install | |
2. Run database migrations | ||
|
||
```bash | ||
turbo run prisma:migrate | ||
moon run prisma:migrate | ||
``` | ||
|
||
3. Seed the database | ||
|
||
```bash | ||
turbo run prisma:seed | ||
moon run prisma:seed | ||
``` | ||
|
||
4. Build the project | ||
|
||
```bash | ||
turbo run build | ||
moon run :build | ||
``` | ||
|
||
# Development | ||
|
||
## CLI | ||
|
||
You can interact with the bot by using CLI. | ||
If you made changes in the code, don't forget to rebuild the project `turbo run build`. | ||
If you made changes in the code, don't forget to rebuild the project `moon run :build`. | ||
|
||
```bash | ||
# List of commands | ||
|
@@ -108,23 +101,21 @@ The UI allows managing multiple bots and strategies, viewing backtest results, a | |
**Option 1**: Run both `frontend` and `backend` apps in a single terminal | ||
|
||
```bash | ||
turbo run dev | ||
moon run :dev | ||
``` | ||
|
||
**Option 2**: Run each app in a separate terminal | ||
|
||
First Terminal | ||
|
||
```bash | ||
cd pro/frontend | ||
pnpm run dev | ||
moon run frontend:dev | ||
``` | ||
|
||
Second Terminal | ||
|
||
```bash | ||
cd pro/backend | ||
pnpm run dev | ||
moon run backend:dev | ||
``` | ||
|
||
# Apps | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
tasks: | ||
build: | ||
command: tsup | ||
platform: node | ||
inputs: | ||
- 'src/**/*' | ||
- '/packages/*/src/**' | ||
outputs: | ||
- 'dist' | ||
dts: | ||
command: | | ||
rm -rf ../../dts && | ||
tsc --build --emitDeclarationOnly && | ||
resolve-tspaths --src . && | ||
resolve-tspaths --project packages/backtesting/tsconfig.json --src . && | ||
resolve-tspaths --project packages/bot/tsconfig.json --src . && | ||
resolve-tspaths --project packages/bot-processor/tsconfig.json --src . && | ||
resolve-tspaths --project packages/bot-store/tsconfig.json --src . && | ||
resolve-tspaths --project packages/bot-templates/tsconfig.json --src . && | ||
resolve-tspaths --project packages/daemon/tsconfig.json --src . && | ||
resolve-tspaths --project packages/db/tsconfig.json --src . && | ||
resolve-tspaths --project packages/event-bus/tsconfig.json --src . && | ||
resolve-tspaths --project packages/exchanges/tsconfig.json --src . && | ||
resolve-tspaths --project packages/indicators/tsconfig.json --src . && | ||
resolve-tspaths --project packages/logger/tsconfig.json --src . && | ||
resolve-tspaths --project packages/prisma/tsconfig.json --src . && | ||
resolve-tspaths --project packages/processing/tsconfig.json --src . && | ||
resolve-tspaths --project packages/tools/tsconfig.json --src . && | ||
resolve-tspaths --project packages/trpc/tsconfig.json --src . && | ||
resolve-tspaths --project packages/types/tsconfig.json --src . | ||
inputs: | ||
- 'src/**/*' | ||
outputs: | ||
- '/dts' | ||
lint: | ||
command: eslint . --quiet | ||
lint-fix: | ||
command: eslint . --fix | ||
typecheck: | ||
command: tsc --noEmit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.