mirror of
https://github.com/velocitatem/PHANTOM.git
synced 2026-05-31 08:33:36 +00:00
implementing nx management for the framework
This commit is contained in:
33
backend/project.json
Normal file
33
backend/project.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "platform",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "backend",
|
||||||
|
"targets": {
|
||||||
|
"up": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "docker compose up -d",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "docker compose down",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"logs": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "docker compose logs --tail=100 -f",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:platform",
|
||||||
|
"type:infra"
|
||||||
|
]
|
||||||
|
}
|
||||||
39
backend/provider/project.json
Normal file
39
backend/provider/project.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "pricing-provider",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "backend/provider",
|
||||||
|
"targets": {
|
||||||
|
"install": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "bash -lc '[ -x ../../.venv/bin/python ] || python3 -m venv ../../.venv; ../../.venv/bin/python -m ensurepip --upgrade; ../../.venv/bin/python -m pip install -r requirements.txt'",
|
||||||
|
"cwd": "backend/provider"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "../../.venv/bin/uvicorn app:app --host 0.0.0.0 --port ${PROVIDER_PORT:-5001} --reload",
|
||||||
|
"cwd": "backend/provider"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "../../.venv/bin/uvicorn app:app --host 0.0.0.0 --port ${PROVIDER_PORT:-5001}",
|
||||||
|
"cwd": "backend/provider"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:backend",
|
||||||
|
"type:provider"
|
||||||
|
]
|
||||||
|
}
|
||||||
39
backend/server/project.json
Normal file
39
backend/server/project.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "backend-server",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "backend/server",
|
||||||
|
"targets": {
|
||||||
|
"install": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "bash -lc '[ -x ../../.venv/bin/python ] || python3 -m venv ../../.venv; ../../.venv/bin/python -m ensurepip --upgrade; ../../.venv/bin/python -m pip install -r requirements.txt'",
|
||||||
|
"cwd": "backend/server"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "../../.venv/bin/uvicorn app:app --host 0.0.0.0 --port ${BACKEND_PORT:-5000} --reload",
|
||||||
|
"cwd": "backend/server"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "../../.venv/bin/uvicorn app:app --host 0.0.0.0 --port ${BACKEND_PORT:-5000}",
|
||||||
|
"cwd": "backend/server"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:backend",
|
||||||
|
"type:api"
|
||||||
|
]
|
||||||
|
}
|
||||||
39
backend/worker/project.json
Normal file
39
backend/worker/project.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "backend-worker",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "backend/worker",
|
||||||
|
"targets": {
|
||||||
|
"install": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "bash -lc '[ -x ../../.venv/bin/python ] || python3 -m venv ../../.venv; ../../.venv/bin/python -m ensurepip --upgrade; ../../.venv/bin/python -m pip install -r requirements.txt'",
|
||||||
|
"cwd": "backend/worker"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "../../.venv/bin/celery -A main:app worker --loglevel=info",
|
||||||
|
"cwd": "backend/worker"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "../../.venv/bin/python main.py",
|
||||||
|
"cwd": "backend/worker"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:backend",
|
||||||
|
"type:worker"
|
||||||
|
]
|
||||||
|
}
|
||||||
3
backend/worker/requirements.txt
Normal file
3
backend/worker/requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
celery>=5.3,<6
|
||||||
|
python-dotenv>=1.0.0
|
||||||
|
redis>=5.0.0
|
||||||
46
engine/project.json
Normal file
46
engine/project.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "research",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "engine",
|
||||||
|
"targets": {
|
||||||
|
"install": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "make install",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "make test.backend",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"train": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "make train",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"stats": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "make stats.lines",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:research",
|
||||||
|
"type:python"
|
||||||
|
]
|
||||||
|
}
|
||||||
68
nx.json
Normal file
68
nx.json
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/nx/schemas/nx-schema.json",
|
||||||
|
"useInferencePlugins": false,
|
||||||
|
"defaultBase": "main",
|
||||||
|
"namedInputs": {
|
||||||
|
"sharedGlobals": [
|
||||||
|
"{workspaceRoot}/nx.json",
|
||||||
|
"{workspaceRoot}/package.json",
|
||||||
|
"{workspaceRoot}/Makefile",
|
||||||
|
"{workspaceRoot}/pyproject.toml",
|
||||||
|
"{workspaceRoot}/docker-compose.yml"
|
||||||
|
],
|
||||||
|
"default": [
|
||||||
|
"{projectRoot}/**/*",
|
||||||
|
"sharedGlobals"
|
||||||
|
],
|
||||||
|
"production": [
|
||||||
|
"default",
|
||||||
|
"!{projectRoot}/node_modules/**/*",
|
||||||
|
"!{projectRoot}/.next/**/*",
|
||||||
|
"!{projectRoot}/test-results/**/*",
|
||||||
|
"!{projectRoot}/build/**/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"targetDefaults": {
|
||||||
|
"build": {
|
||||||
|
"cache": true,
|
||||||
|
"inputs": [
|
||||||
|
"production",
|
||||||
|
"^production"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"cache": false,
|
||||||
|
"inputs": [
|
||||||
|
"default",
|
||||||
|
"^production"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"install": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"watch": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"clean": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"train": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"logs": {
|
||||||
|
"cache": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
package.json
Normal file
27
package.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "phantom-monorepo",
|
||||||
|
"private": true,
|
||||||
|
"workspaces": [
|
||||||
|
"web",
|
||||||
|
"tests/e2e"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"nx": "nx",
|
||||||
|
"projects": "nx show projects",
|
||||||
|
"graph": "nx graph",
|
||||||
|
"web:dev": "nx run web:dev",
|
||||||
|
"web:build": "nx run web:build",
|
||||||
|
"backend:server": "nx run backend-server:dev",
|
||||||
|
"backend:provider": "nx run pricing-provider:dev",
|
||||||
|
"backend:worker": "nx run backend-worker:dev",
|
||||||
|
"paper:build": "nx run paper:build",
|
||||||
|
"platform:up": "nx run platform:up",
|
||||||
|
"platform:down": "nx run platform:down",
|
||||||
|
"platform:logs": "nx run platform:logs",
|
||||||
|
"research:test": "nx run research:test",
|
||||||
|
"e2e:test": "nx run e2e:test"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"nx": "^20.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
36
paper/project.json
Normal file
36
paper/project.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "paper",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "paper/src",
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/build"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "make pdf.build",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"watch": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "make pdf.watch",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"clean": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "make pdf.clean",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:paper",
|
||||||
|
"type:latex"
|
||||||
|
]
|
||||||
|
}
|
||||||
49
tests/e2e/project.json
Normal file
49
tests/e2e/project.json
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "e2e",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "tests/e2e",
|
||||||
|
"targets": {
|
||||||
|
"install": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "npm install",
|
||||||
|
"cwd": "tests/e2e"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/test-results"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "make test.e2e",
|
||||||
|
"cwd": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test-ui": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "npm run test:ui",
|
||||||
|
"cwd": "tests/e2e"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test-debug": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "npm run test:debug",
|
||||||
|
"cwd": "tests/e2e"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:test",
|
||||||
|
"type:e2e"
|
||||||
|
]
|
||||||
|
}
|
||||||
52
web/project.json
Normal file
52
web/project.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "web",
|
||||||
|
"projectType": "application",
|
||||||
|
"sourceRoot": "web/src",
|
||||||
|
"targets": {
|
||||||
|
"install": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "npm install",
|
||||||
|
"cwd": "web"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "npm run dev",
|
||||||
|
"cwd": "web"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"install"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/.next"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "npm run build",
|
||||||
|
"cwd": "web"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"dependsOn": [
|
||||||
|
"build"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"command": "npm run start",
|
||||||
|
"cwd": "web"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"scope:web",
|
||||||
|
"type:frontend"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user