mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
test: 🧪 Fix failing tests due to incorrect cwd resolving
Some checks failed
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 0s
Build Docker Images / lint (push) Failing after 6s
Build Docker Images / check (push) Failing after 6s
Build Docker Images / tests (push) Failing after 5s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
Some checks failed
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 0s
Build Docker Images / lint (push) Failing after 6s
Build Docker Images / check (push) Failing after 6s
Build Docker Images / tests (push) Failing after 5s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
This commit is contained in:
parent
1beb18e321
commit
37bc4458e5
6
app.ts
6
app.ts
|
|
@ -1,5 +1,6 @@
|
|||
import { join } from "node:path";
|
||||
/* import { prometheus } from "@hono/prometheus"; */
|
||||
|
||||
import { resolve } from "node:path";
|
||||
import { getLogger } from "@logtape/logtape";
|
||||
import { apiReference } from "@scalar/hono-api-reference";
|
||||
import chalk from "chalk";
|
||||
|
|
@ -27,7 +28,6 @@ import { routes } from "./routes.ts";
|
|||
import type { ApiRouteExports, HonoEnv } from "./types/api.ts";
|
||||
// Extends Zod with OpenAPI schema generation
|
||||
import "zod-openapi/extend";
|
||||
import { cwdFromEntrypoint } from "@/lib.ts";
|
||||
|
||||
export const appFactory = async (): Promise<Hono<HonoEnv>> => {
|
||||
await configureLoggers();
|
||||
|
|
@ -122,7 +122,7 @@ export const appFactory = async (): Promise<Hono<HonoEnv>> => {
|
|||
const loader = new PluginLoader();
|
||||
|
||||
const plugins = await loader.loadPlugins(
|
||||
join(cwdFromEntrypoint(), "plugins"),
|
||||
resolve("./plugins"),
|
||||
config.plugins?.autoload ?? true,
|
||||
config.plugins?.overrides.enabled,
|
||||
config.plugins?.overrides.disabled,
|
||||
|
|
|
|||
1
bun.lock
1
bun.lock
|
|
@ -95,6 +95,7 @@
|
|||
"@badgateway/oauth2-client": "^2.4.2",
|
||||
"iso-639-1": "^3.1.5",
|
||||
"zod": "^3.24.2",
|
||||
"zod-openapi": "^4.2.4",
|
||||
},
|
||||
},
|
||||
"packages/plugin-kit": {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { generateVAPIDKeys } from "web-push";
|
|||
import { z } from "zod";
|
||||
import { ZodError } from "zod";
|
||||
import { fromZodError } from "zod-validation-error";
|
||||
import { cwdFromEntrypoint } from "@/lib.ts";
|
||||
import { ProxiableUrl } from "~/classes/media/url.ts";
|
||||
import { RolePermission } from "~/packages/client/schemas/permissions.ts";
|
||||
|
||||
|
|
@ -402,9 +401,7 @@ export const ConfigSchema = z
|
|||
}),
|
||||
frontend: z.strictObject({
|
||||
enabled: z.boolean().default(true),
|
||||
path: z
|
||||
.string()
|
||||
.default(env.VERSIA_FRONTEND_PATH || cwdFromEntrypoint()),
|
||||
path: z.string().default(env.VERSIA_FRONTEND_PATH || "frontend"),
|
||||
routes: z.strictObject({
|
||||
home: urlPath.default("/"),
|
||||
login: urlPath.default("/oauth/authorize"),
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
"dependencies": {
|
||||
"@badgateway/oauth2-client": "^2.4.2",
|
||||
"iso-639-1": "^3.1.5",
|
||||
"zod": "^3.24.2"
|
||||
"zod": "^3.24.2",
|
||||
"zod-openapi": "^4.2.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import ISO6391 from "iso-639-1";
|
||||
import { z } from "zod";
|
||||
import "zod-openapi/extend";
|
||||
|
||||
export const Id = z.string().uuid();
|
||||
|
||||
|
|
|
|||
|
|
@ -257,6 +257,9 @@ importers:
|
|||
zod:
|
||||
specifier: ^3.24.2
|
||||
version: 3.24.2
|
||||
zod-openapi:
|
||||
specifier: ^4.2.4
|
||||
version: 4.2.4(zod@3.24.2)
|
||||
|
||||
packages/plugin-kit:
|
||||
dependencies:
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
import { join } from "node:path";
|
||||
import { FileSystemRouter } from "bun";
|
||||
import { cwdFromEntrypoint } from "@/lib.ts";
|
||||
// Returns the route filesystem path when given a URL
|
||||
export const routeMatcher = new FileSystemRouter({
|
||||
style: "nextjs",
|
||||
dir: `${cwdFromEntrypoint()}/api`,
|
||||
dir: "api",
|
||||
fileExtensions: [".ts", ".js"],
|
||||
});
|
||||
|
||||
export const routes = Object.fromEntries(
|
||||
Object.entries(routeMatcher.routes)
|
||||
.filter(([route]) => !route.endsWith(".test"))
|
||||
.map(([route, path]) => [
|
||||
route,
|
||||
path.replace(join(cwdFromEntrypoint()), "."),
|
||||
]),
|
||||
.map(([route, path]) => [route, path]),
|
||||
) as Record<string, string>;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
import { dirname } from "node:path";
|
||||
import { main } from "bun";
|
||||
|
||||
type ElementWithId = { id: string };
|
||||
|
||||
export const mergeAndDeduplicate = <T extends ElementWithId>(
|
||||
|
|
@ -12,7 +9,3 @@ export const mergeAndDeduplicate = <T extends ElementWithId>(
|
|||
(element, index, self) =>
|
||||
index === self.findIndex((t) => t.id === element.id),
|
||||
);
|
||||
|
||||
export const cwdFromEntrypoint = (): string => {
|
||||
return dirname(main);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue