Skip to content

Commit bcef7b4

Browse files
committed
Some reorganization
1 parent 541462e commit bcef7b4

File tree

10 files changed

+26
-46
lines changed

10 files changed

+26
-46
lines changed

app.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
type GitHubApiClient,
1111
RealGitHubApiClient,
1212
} from "./lib/github-api-client.ts";
13-
import { App, staticFiles } from "fresh";
1413
import { ConfigProvider } from "./config.ts";
1514
import { LoggerFactory } from "./logger.ts";
1615
import { InsightsPageController } from "./routes/insights.tsx";
@@ -26,6 +25,8 @@ export interface AppState {
2625
store: AppStore;
2726
}
2827

28+
export type AppStore = ReturnType<typeof createRequestStore>;
29+
2930
const configProvider = new ConfigProvider();
3031

3132
// services that live for the duration of the application
@@ -57,9 +58,7 @@ const appStore = defineStore()
5758
})
5859
.finalize();
5960

60-
export type AppStore = ReturnType<typeof createRequestStore>;
61-
62-
function createRequestStore() {
61+
export function createRequestStore() {
6362
// services that live for the duration of a request
6463
return appStore.createChild()
6564
.add("logger", (store) => {
@@ -86,14 +85,3 @@ function createRequestStore() {
8685
})
8786
.finalize();
8887
}
89-
90-
export const app = new App<AppState>();
91-
92-
app.use(staticFiles());
93-
94-
app.use(async (ctx) => {
95-
using scopedStore = createRequestStore();
96-
ctx.state.store = scopedStore;
97-
return await ctx.next();
98-
});
99-
app.fsRoutes();

main.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { App, staticFiles } from "fresh";
2+
import { type AppState, createRequestStore } from "./app.ts";
3+
4+
export const app = new App<AppState>();
5+
6+
app
7+
.use(staticFiles())
8+
.use(async (ctx) => {
9+
using scopedStore = createRequestStore();
10+
ctx.state.store = scopedStore;
11+
return await ctx.next();
12+
})
13+
.fsRoutes();

routes/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default define.page(function App({ Component }) {
66
<head>
77
<meta charset="utf-8" />
88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
9-
<title>ci-test-viewer</title>
9+
<title>Deno CI Test Viewer</title>
1010
</head>
1111
<body>
1212
<Component />

routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Head } from "fresh/runtime";
22
import { define } from "@/define.ts";
3-
import type { RunsFetcher } from "../lib/runs-fetcher.ts";
3+
import type { RunsFetcher } from "@/lib/runs-fetcher.ts";
44
import { formatDate, getStatusBadge } from "@/render.tsx";
55

66
export const handler = define.handlers({

routes/insights.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { assertEquals } from "@std/assert";
22
import { InsightsPageController } from "./insights.tsx";
3-
import type { GitHubApiClient, WorkflowRun } from "../lib/github-api-client.ts";
3+
import type { GitHubApiClient, WorkflowRun } from "@/lib/github-api-client.ts";
44
import type {
55
JobTestResults,
66
TestResultsDownloader,
7-
} from "../lib/test-results-downloader.ts";
8-
import { NullLogger } from "../logger.ts";
7+
} from "@/lib/test-results-downloader.ts";
8+
import { NullLogger } from "@/logger.ts";
99

1010
interface RunsWithCount {
1111
totalCount: number;

routes/insights.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type {
44
RecordedTestResult,
55
TestResultsDownloader,
66
} from "@/lib/test-results-downloader.ts";
7-
import type { GitHubApiClient, WorkflowRun } from "../lib/github-api-client.ts";
8-
import type { Logger } from "../logger.ts";
7+
import type { GitHubApiClient, WorkflowRun } from "@/lib/github-api-client.ts";
8+
import type { Logger } from "@/logger.ts";
99

1010
export const handler = define.handlers({
1111
GET(ctx) {

routes/results/[runId].test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { assertEquals } from "@std/assert";
22
import { processTestResults } from "./[runId].tsx";
3-
import type { JobTestResults } from "../../lib/test-results-downloader.ts";
3+
import type { JobTestResults } from "@/lib/test-results-downloader.ts";
44

55
Deno.test("processTestResults - calculates basic stats correctly", () => {
66
const results: JobTestResults[] = [

routes/results/[runId].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
RecordedTestResult,
55
TestResultsDownloader,
66
} from "@/lib/test-results-downloader.ts";
7-
import type { GitHubApiClient } from "../../lib/github-api-client.ts";
7+
import type { GitHubApiClient } from "@/lib/github-api-client.ts";
88
import { formatDuration } from "@/render.tsx";
99

1010
export const handler = define.handlers({

static/logo.svg

Lines changed: 0 additions & 19 deletions
This file was deleted.

vite.config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import tailwindcss from "@tailwindcss/vite";
44

55
export default defineConfig({
66
plugins: [
7-
fresh({
8-
serverEntry: "app.ts",
9-
}),
7+
fresh(),
108
tailwindcss(),
119
],
1210
});

0 commit comments

Comments
 (0)