Skip to content

Commit 128ce32

Browse files
authored
Merge pull request #1819 from counterfact/copilot/remove-gui-client
Remove the client (GUI)
2 parents cf94e4b + 0c3120f commit 128ce32

10 files changed

Lines changed: 10 additions & 383 deletions

File tree

.changeset/remove-gui-client.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"counterfact": minor
3+
---
4+
5+
Remove the built-in GUI client (dashboard and RapiDoc pages) from src/client and the Handlebars dependency. The Swagger UI at /counterfact/swagger remains available. Navigating to /counterfact now redirects to /counterfact/swagger.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"test": "yarn node --experimental-vm-modules ./node_modules/jest-cli/bin/jest --testPathIgnorePatterns=black-box",
6868
"test:black-box": "rimraf dist && yarn build && python3 -m pytest test-black-box/ -v",
6969
"test:tsd": "tsd --typings ./dist/server/counterfact-types/index.ts --files ./test/**/*.test-d.ts",
70-
"build": "rm -rf dist && tsc && copyfiles -f \"src/client/**\" dist/client && copyfiles -f \"src/counterfact-types/*.ts\" dist/server/counterfact-types && copyfiles -f \"src/server/*.cjs\" dist/server",
70+
"build": "rm -rf dist && tsc && copyfiles -f \"src/counterfact-types/*.ts\" dist/server/counterfact-types && copyfiles -f \"src/server/*.cjs\" dist/server",
7171
"prepack": "yarn build",
7272
"release": "npx changeset publish",
7373
"prepare": "husky install",
@@ -131,7 +131,6 @@
131131
"commander": "14.0.3",
132132
"debug": "4.4.3",
133133
"fs-extra": "11.3.4",
134-
"handlebars": "4.7.9",
135134
"http-terminator": "3.2.0",
136135
"js-yaml": "4.1.1",
137136
"json-schema-faker": "0.6.0",

src/client/README.md

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

src/client/index.html.hbs

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

src/client/rapi-doc.html.hbs

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

src/server/create-koa-app.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { pathToFileURL } from "node:url";
2-
31
import createDebug from "debug";
42
import Koa from "koa";
53
import bodyParser from "koa-bodyparser";
@@ -9,7 +7,6 @@ import { adminApiMiddleware } from "./admin-api-middleware.js";
97
import type { Config } from "./config.js";
108
import type { ContextRegistry } from "./context-registry.js";
119
import { openapiMiddleware } from "./openapi-middleware.js";
12-
import { pageMiddleware } from "./page-middleware.js";
1310
import type { Registry } from "./registry.js";
1411

1512
const debug = createDebug("counterfact:server:create-koa-app");
@@ -46,43 +43,16 @@ export function createKoaApp(
4643
debug("basePath: %s", config.basePath);
4744
debug("routes", registry.routes);
4845

49-
app.use(
50-
pageMiddleware("/counterfact/", "index", {
51-
basePath: config.basePath,
52-
methods: ["get", "post", "put", "delete", "patch"],
53-
54-
openApiHref: config.openApiPath.includes("://")
55-
? config.openApiPath
56-
: pathToFileURL(config.openApiPath).href,
57-
58-
openApiPath: config.openApiPath,
59-
60-
get routes() {
61-
return registry.routes;
62-
},
63-
}),
64-
);
65-
6646
app.use(async (ctx, next) => {
6747
if (ctx.URL.pathname === "/counterfact") {
68-
ctx.redirect("/counterfact/");
48+
ctx.redirect("/counterfact/swagger");
6949

7050
return;
7151
}
7252

7353
await next();
7454
});
7555

76-
app.use(
77-
pageMiddleware("/counterfact/rapidoc", "rapi-doc", {
78-
basePath: config.basePath,
79-
80-
get routes() {
81-
return registry.routes;
82-
},
83-
}),
84-
);
85-
8656
app.use(bodyParser());
8757

8858
app.use(async (ctx, next) => {

0 commit comments

Comments
 (0)