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 { prometheus } from "@hono/prometheus"; */
|
||||||
|
|
||||||
|
import { resolve } from "node:path";
|
||||||
import { getLogger } from "@logtape/logtape";
|
import { getLogger } from "@logtape/logtape";
|
||||||
import { apiReference } from "@scalar/hono-api-reference";
|
import { apiReference } from "@scalar/hono-api-reference";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
|
|
@ -27,7 +28,6 @@ import { routes } from "./routes.ts";
|
||||||
import type { ApiRouteExports, HonoEnv } from "./types/api.ts";
|
import type { ApiRouteExports, HonoEnv } from "./types/api.ts";
|
||||||
// Extends Zod with OpenAPI schema generation
|
// Extends Zod with OpenAPI schema generation
|
||||||
import "zod-openapi/extend";
|
import "zod-openapi/extend";
|
||||||
import { cwdFromEntrypoint } from "@/lib.ts";
|
|
||||||
|
|
||||||
export const appFactory = async (): Promise<Hono<HonoEnv>> => {
|
export const appFactory = async (): Promise<Hono<HonoEnv>> => {
|
||||||
await configureLoggers();
|
await configureLoggers();
|
||||||
|
|
@ -122,7 +122,7 @@ export const appFactory = async (): Promise<Hono<HonoEnv>> => {
|
||||||
const loader = new PluginLoader();
|
const loader = new PluginLoader();
|
||||||
|
|
||||||
const plugins = await loader.loadPlugins(
|
const plugins = await loader.loadPlugins(
|
||||||
join(cwdFromEntrypoint(), "plugins"),
|
resolve("./plugins"),
|
||||||
config.plugins?.autoload ?? true,
|
config.plugins?.autoload ?? true,
|
||||||
config.plugins?.overrides.enabled,
|
config.plugins?.overrides.enabled,
|
||||||
config.plugins?.overrides.disabled,
|
config.plugins?.overrides.disabled,
|
||||||
|
|
|
||||||
1
bun.lock
1
bun.lock
|
|
@ -95,6 +95,7 @@
|
||||||
"@badgateway/oauth2-client": "^2.4.2",
|
"@badgateway/oauth2-client": "^2.4.2",
|
||||||
"iso-639-1": "^3.1.5",
|
"iso-639-1": "^3.1.5",
|
||||||
"zod": "^3.24.2",
|
"zod": "^3.24.2",
|
||||||
|
"zod-openapi": "^4.2.4",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"packages/plugin-kit": {
|
"packages/plugin-kit": {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { generateVAPIDKeys } from "web-push";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { ZodError } from "zod";
|
import { ZodError } from "zod";
|
||||||
import { fromZodError } from "zod-validation-error";
|
import { fromZodError } from "zod-validation-error";
|
||||||
import { cwdFromEntrypoint } from "@/lib.ts";
|
|
||||||
import { ProxiableUrl } from "~/classes/media/url.ts";
|
import { ProxiableUrl } from "~/classes/media/url.ts";
|
||||||
import { RolePermission } from "~/packages/client/schemas/permissions.ts";
|
import { RolePermission } from "~/packages/client/schemas/permissions.ts";
|
||||||
|
|
||||||
|
|
@ -402,9 +401,7 @@ export const ConfigSchema = z
|
||||||
}),
|
}),
|
||||||
frontend: z.strictObject({
|
frontend: z.strictObject({
|
||||||
enabled: z.boolean().default(true),
|
enabled: z.boolean().default(true),
|
||||||
path: z
|
path: z.string().default(env.VERSIA_FRONTEND_PATH || "frontend"),
|
||||||
.string()
|
|
||||||
.default(env.VERSIA_FRONTEND_PATH || cwdFromEntrypoint()),
|
|
||||||
routes: z.strictObject({
|
routes: z.strictObject({
|
||||||
home: urlPath.default("/"),
|
home: urlPath.default("/"),
|
||||||
login: urlPath.default("/oauth/authorize"),
|
login: urlPath.default("/oauth/authorize"),
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@badgateway/oauth2-client": "^2.4.2",
|
"@badgateway/oauth2-client": "^2.4.2",
|
||||||
"iso-639-1": "^3.1.5",
|
"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 ISO6391 from "iso-639-1";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import "zod-openapi/extend";
|
||||||
|
|
||||||
export const Id = z.string().uuid();
|
export const Id = z.string().uuid();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,9 @@ importers:
|
||||||
zod:
|
zod:
|
||||||
specifier: ^3.24.2
|
specifier: ^3.24.2
|
||||||
version: 3.24.2
|
version: 3.24.2
|
||||||
|
zod-openapi:
|
||||||
|
specifier: ^4.2.4
|
||||||
|
version: 4.2.4(zod@3.24.2)
|
||||||
|
|
||||||
packages/plugin-kit:
|
packages/plugin-kit:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,13 @@
|
||||||
import { join } from "node:path";
|
|
||||||
import { FileSystemRouter } from "bun";
|
import { FileSystemRouter } from "bun";
|
||||||
import { cwdFromEntrypoint } from "@/lib.ts";
|
|
||||||
// Returns the route filesystem path when given a URL
|
// Returns the route filesystem path when given a URL
|
||||||
export const routeMatcher = new FileSystemRouter({
|
export const routeMatcher = new FileSystemRouter({
|
||||||
style: "nextjs",
|
style: "nextjs",
|
||||||
dir: `${cwdFromEntrypoint()}/api`,
|
dir: "api",
|
||||||
fileExtensions: [".ts", ".js"],
|
fileExtensions: [".ts", ".js"],
|
||||||
});
|
});
|
||||||
|
|
||||||
export const routes = Object.fromEntries(
|
export const routes = Object.fromEntries(
|
||||||
Object.entries(routeMatcher.routes)
|
Object.entries(routeMatcher.routes)
|
||||||
.filter(([route]) => !route.endsWith(".test"))
|
.filter(([route]) => !route.endsWith(".test"))
|
||||||
.map(([route, path]) => [
|
.map(([route, path]) => [route, path]),
|
||||||
route,
|
|
||||||
path.replace(join(cwdFromEntrypoint()), "."),
|
|
||||||
]),
|
|
||||||
) as Record<string, string>;
|
) as Record<string, string>;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
import { dirname } from "node:path";
|
|
||||||
import { main } from "bun";
|
|
||||||
|
|
||||||
type ElementWithId = { id: string };
|
type ElementWithId = { id: string };
|
||||||
|
|
||||||
export const mergeAndDeduplicate = <T extends ElementWithId>(
|
export const mergeAndDeduplicate = <T extends ElementWithId>(
|
||||||
|
|
@ -12,7 +9,3 @@ export const mergeAndDeduplicate = <T extends ElementWithId>(
|
||||||
(element, index, self) =>
|
(element, index, self) =>
|
||||||
index === self.findIndex((t) => t.id === element.id),
|
index === self.findIndex((t) => t.id === element.id),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const cwdFromEntrypoint = (): string => {
|
|
||||||
return dirname(main);
|
|
||||||
};
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue