Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
cache: "pnpm"

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Lint
run: npm run lint
run: pnpm run lint
working-directory: backend

- name: Type-check
run: npm run typecheck
run: pnpm run typecheck
working-directory: backend

- name: Run tests
run: npm test -- --coverage
run: pnpm test
working-directory: backend

- name: Upload coverage
Expand All @@ -47,26 +49,28 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
cache: "pnpm"

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Lint
run: npm run lint
run: pnpm run lint
working-directory: frontend

- name: Type-check
run: npm run typecheck
run: pnpm run typecheck
working-directory: frontend

- name: Build
run: npm run build
run: pnpm run build
working-directory: frontend
env:
NEXT_PUBLIC_API_URL: http://localhost:4000
Expand All @@ -77,30 +81,32 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
cache: "pnpm"

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Lint
run: npm run lint
run: pnpm run lint
working-directory: cli

- name: Type-check
run: npm run typecheck
run: pnpm run typecheck
working-directory: cli

- name: Run tests
run: npm test
run: pnpm test
working-directory: cli

- name: Build
run: npm run build
run: pnpm run build
working-directory: cli

build-docker:
Expand Down
2 changes: 2 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"rate-limit-redis": "^4.2.0",
"redis": "^4.6.13",
"winston": "^3.12.0",
"uuid": "^11.1.0",
"ws": "^8.16.0",
"zod": "^3.22.4"
},
Expand Down Expand Up @@ -52,6 +53,7 @@
"roots": [
"<rootDir>/tests"
],
"collectCoverage": true,
"coverageDirectory": "coverage",
"collectCoverageFrom": [
"src/**/*.ts"
Expand Down
2 changes: 1 addition & 1 deletion backend/src/routes/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Router, Request, Response } from "express";
import { PoolMonitor } from "../services/pool-monitor";
import { MevDetector } from "../services/mev-detector";

export const analyticsRouter = Router();
export const analyticsRouter: Router = Router();

/**
* GET /api/analytics/summary
Expand Down
2 changes: 1 addition & 1 deletion backend/src/routes/health.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Router } from "express";

export const healthRouter = Router();
export const healthRouter: Router = Router();

healthRouter.get("/", (_req, res) => {
res.json({ status: "ok", timestamp: Date.now() });
Expand Down
2 changes: 1 addition & 1 deletion backend/src/routes/monitor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Router, Request, Response } from "express";
import { PoolMonitor } from "../services/pool-monitor";

export const monitorRouter = Router();
export const monitorRouter: Router = Router();

/**
* GET /api/monitor/pools
Expand Down
2 changes: 1 addition & 1 deletion backend/src/routes/shield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { requireAuth } from "../middleware/auth";
import { TransactionShield } from "../services/transaction-shield";
import { MevDetector } from "../services/mev-detector";

export const shieldRouter = Router();
export const shieldRouter: Router = Router();

const ShieldBodySchema = z.object({
dex: z.enum(["jupiter", "raydium", "orca", "binance"]),
Expand Down
8 changes: 7 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"bs58": "^5.0.0"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/inquirer": "^9.0.7",
"@types/node": "^20.12.2",
"@types/ws": "^8.5.10",
Expand All @@ -52,6 +53,11 @@
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"roots": ["<rootDir>/tests"]
"roots": ["<rootDir>/tests"],
"globals": {
"ts-jest": {
"tsconfig": "tsconfig.test.json"
}
}
}
}
8 changes: 8 additions & 0 deletions cli/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"types": ["jest", "node"]
},
"include": ["src/**/*", "tests/**/*"]
}
11 changes: 8 additions & 3 deletions devops/Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
FROM node:20 AS builder
WORKDIR /app

# Activate pnpm via corepack (version pinned in root package.json)
RUN corepack enable

# Copy workspace manifests first for layer caching
COPY package.json package-lock.json ./
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY backend/package.json ./backend/
RUN npm ci --workspace=backend
COPY cli/package.json ./cli/
COPY frontend/package.json ./frontend/
RUN pnpm install --frozen-lockfile --filter l2mev-backend

COPY backend ./backend
RUN npm -w backend run build
RUN pnpm --filter l2mev-backend run build

# ── Production stage ─────────────────────────────────────────
FROM node:20-alpine AS runner
Expand Down
11 changes: 8 additions & 3 deletions devops/Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
FROM node:20 AS builder
WORKDIR /app

COPY package.json package-lock.json ./
# Activate pnpm via corepack (version pinned in root package.json)
RUN corepack enable

COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY frontend/package.json ./frontend/
RUN npm ci --workspace=frontend
COPY backend/package.json ./backend/
COPY cli/package.json ./cli/
RUN pnpm install --frozen-lockfile --filter l2mev-frontend

COPY frontend ./frontend
RUN npm -w frontend run build
RUN pnpm --filter l2mev-frontend run build

# ── Production stage ─────────────────────────────────────────
FROM node:20-alpine AS runner
Expand Down
Loading
Loading