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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8

- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
with:
node-version: "24"
cache: "npm"
Expand All @@ -28,4 +28,4 @@ jobs:
run: npm run lint

- name: Run Tests
run: npm test
run: npm run test:all
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ The worker exposes three main services:

We've structured the app to separate the core logic from the specific runtime environment (Cloudflare, Node, etc.).

- **Application Logic**: Found in `src/versions`, `src/central-alerts`, etc. These feature modules don't know they are running on Cloudflare.
- **Platform Layer**: Located in `src/platform`. This defines interfaces for things like Cache, Database, and Environment variables.
- **Application Logic**: Found in `src/services/versions/v1`, `src/services/central-alerts/v1`, etc. These feature modules don't know they are running on Cloudflare.
- **Platform Layer**: Located in `src/lib`. This defines interfaces for things like Cache, Database, and Environment variables.
- **Adapters**:
- `src/platform/adapters/cloudflare`: Real implementations using KV and D1.
- `src/platform/adapters/node`: Reference implementations (useful for testing or alternative deployments).
- `src/lib/adapters/cloudflare`: Real implementations using KV and D1.
- `src/lib/adapters/node`: Reference implementations (useful for testing or alternative deployments).

## APIs

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dev": "wrangler dev",
"format": "prettier --write .",
"format:check": "prettier --check .",
"init:db": "npx tsx src/central-alerts/v1/scripts/init-db.ts",
"init:db": "npx tsx src/services/central-alerts/v1/scripts/init-db.ts",
"lint": "eslint",
"lint:fix": "eslint --fix",
"test": "vitest run",
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts → src/app/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Hono } from "hono";
import { contextStorage } from "hono/context-storage";
import { HTTPException } from "hono/http-exception";
import centralAlertsV1 from "./central-alerts/v1";
import releasesV1 from "./releases/v1";
import versionsV1 from "./versions/v1";
import { platformMiddleware } from "./platform/middleware";
import { createCloudflareBindings } from "./platform/adapters/cloudflare";
import centralAlertsV1 from "../services/central-alerts/v1";
import releasesV1 from "../services/releases/v1";
import versionsV1 from "../services/versions/v1";
import { platformMiddleware } from "../lib/middleware";
import { createCloudflareBindings } from "../lib/adapters/cloudflare";

const app = new Hono<{ Bindings: CloudflareBindings }>();

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ The `type` field accepts: `success`, `info`, `warning`, `danger`

## Database

Uses D1 database binding `DB_CENTRAL_ALERTS`. Initialize with the setup script in `src/central-alerts/v1/scripts/`.
Uses D1 database binding `DB_CENTRAL_ALERTS`. Initialize with the setup script in `src/services/central-alerts/v1/scripts/`.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CentralAlert } from "./interfaces";
import { IDatabase } from "../../platform/interfaces";
import { IDatabase } from "../../../lib/interfaces";

export interface DatabaseError {
message: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Hono } from "hono";
import { trimTrailingSlash } from "hono/trailing-slash";
import { CentralAlertsDatabase } from "./database";
import { getPlatform } from "../../platform/middleware";
import { getPlatform } from "../../../lib/middleware";

const centralAlertsV1 = new Hono<{ Bindings: CloudflareBindings }>();

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { trimTrailingSlash } from "hono/trailing-slash";
import { diff as semverDiff, compare as semverCompare } from "semver";
import { FOSSBillingVersion } from "./interfaces";
import { getReleases } from "../../versions/v1";
import { getPlatform } from "../../platform/middleware";
import { getPlatform } from "../../../lib/middleware";

const releasesV1 = new Hono<{ Bindings: CloudflareBindings; strict: true }>();

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
valid as semverValid
} from "semver";
import { Releases, ReleaseDetails } from "./interfaces";
import { getPlatform } from "../../platform/middleware";
import { ICache } from "../../platform/interfaces";
import { getPlatform } from "../../../lib/middleware";
import { ICache } from "../../../lib/interfaces";

// Cache for UPDATE_TOKEN to avoid repeated KV lookups
let updateTokenCache: string | null = null;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/unit/index.test.ts → test/app/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
createExecutionContext,
waitOnExecutionContext
} from "cloudflare:test";
import app from "../../src/index";
import app from "../../src/app/index";
import { mockD1Database } from "../utils/d1-mock";
import {
ApiResponse,
Expand Down
Loading