fix: resolve type errors and migrate pnpm settings to pnpm-workspace.yaml
Local Build and Deploy / deploy (push) Failing after 56s
Local Build and Deploy / deploy (push) Failing after 56s
- Move pnpm.onlyBuiltDependencies/overrides from package.json to pnpm-workspace.yaml (clears pnpm WARN) - Allow useServerAction run() to accept actions returning void - Make adminAction/authAction input optional so no-schema actions can be called without args - Return ActionResult from updateBcPage - Fix categoryPageMap value type (number | undefined) - Declare DbService.queryCount field - Use definite assignment for release in withFurniDataLock - Narrow pair type in theme-contrast test
This commit is contained in:
1 parent
df38dccbf1
commit
045dc06a1f
9 files changed
+28
-29
No files matched your search
@@ -76,21 +76,5 @@
|
|||||||
"tsx": "^4.22.5",
|
"tsx": "^4.22.5",
|
||||||
"typescript": "^5.7.0",
|
"typescript": "^5.7.0",
|
||||||
"vitest": "^2.1.0"
|
"vitest": "^2.1.0"
|
||||||
},
|
|
||||||
"pnpm": {
|
|
||||||
"onlyBuiltDependencies": [
|
|
||||||
"esbuild",
|
|
||||||
"prisma",
|
|
||||||
"@prisma/client",
|
|
||||||
"@prisma/engines",
|
|
||||||
"sharp",
|
|
||||||
"@parcel/watcher",
|
|
||||||
"@swc/core"
|
|
||||||
],
|
|
||||||
"overrides": {
|
|
||||||
"fast-uri": "^3.1.3",
|
|
||||||
"@hono/node-server": "^1.19.13",
|
|
||||||
"postcss": "^8.5.16"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
onlyBuiltDependencies:
|
||||||
|
- esbuild
|
||||||
|
- prisma
|
||||||
|
- "@prisma/client"
|
||||||
|
- "@prisma/engines"
|
||||||
|
- sharp
|
||||||
|
- "@parcel/watcher"
|
||||||
|
- "@swc/core"
|
||||||
|
|
||||||
|
overrides:
|
||||||
|
fast-uri: "^3.1.3"
|
||||||
|
"@hono/node-server": "^1.19.13"
|
||||||
|
postcss: "^8.5.16"
|
||||||
@@ -21,6 +21,7 @@ export async function updateBcPage({
|
|||||||
targetId: id,
|
targetId: id,
|
||||||
});
|
});
|
||||||
revalidatePath("/admin/catalog/builder-club");
|
revalidatePath("/admin/catalog/builder-club");
|
||||||
|
return { ok: true as const };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteBcItem({ id }: { id: number }) {
|
export async function deleteBcItem({ id }: { id: number }) {
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ export const PUT = withAdmin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 5. Pre-load category page map (captionSave → pageId) to avoid N+1 queries
|
// 5. Pre-load category page map (captionSave → pageId) to avoid N+1 queries
|
||||||
const categoryPageMap = new Map<string, number>();
|
const categoryPageMap = new Map<string, number | undefined>();
|
||||||
for (const sp of subPages) {
|
for (const sp of subPages) {
|
||||||
if (sp.captionSave) categoryPageMap.set(sp.captionSave, sp.id);
|
if (sp.captionSave) categoryPageMap.set(sp.captionSave, sp.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export function useServerAction(options: UseServerActionOptions = {}) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
function run(
|
function run(
|
||||||
action: () => Promise<ActionResult | undefined>,
|
action: () => Promise<ActionResult | undefined | void>,
|
||||||
opts: RunOptions = {},
|
opts: RunOptions = {},
|
||||||
) {
|
) {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export function adminAction<TSchema extends z.ZodType | undefined = undefined>(
|
|||||||
handler: ActionHandler<TSchema>,
|
handler: ActionHandler<TSchema>,
|
||||||
) {
|
) {
|
||||||
return async (
|
return async (
|
||||||
input: TSchema extends z.ZodType ? z.input<TSchema> : undefined,
|
input?: TSchema extends z.ZodType ? z.input<TSchema> : undefined,
|
||||||
): Promise<ActionResult> => {
|
): Promise<ActionResult> => {
|
||||||
const ip = await extractClientIpAsync();
|
const ip = await extractClientIpAsync();
|
||||||
const store = createStore(ip);
|
const store = createStore(ip);
|
||||||
@@ -158,7 +158,7 @@ export function authAction<TSchema extends z.ZodType | undefined = undefined>(
|
|||||||
) => Promise<ActionResult>,
|
) => Promise<ActionResult>,
|
||||||
) {
|
) {
|
||||||
return async (
|
return async (
|
||||||
input: TSchema extends z.ZodType ? z.input<TSchema> : undefined,
|
input?: TSchema extends z.ZodType ? z.input<TSchema> : undefined,
|
||||||
): Promise<ActionResult> => {
|
): Promise<ActionResult> => {
|
||||||
const ip = await extractClientIpAsync();
|
const ip = await extractClientIpAsync();
|
||||||
const store = createStore(ip);
|
const store = createStore(ip);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export class DbService {
|
|||||||
private readonly client: PrismaClient;
|
private readonly client: PrismaClient;
|
||||||
private lastHealthCheck = 0;
|
private lastHealthCheck = 0;
|
||||||
private healthCache: HealthStatus | null = null;
|
private healthCache: HealthStatus | null = null;
|
||||||
|
private queryCount = 0;
|
||||||
private readonly healthTtlMs = 10_000;
|
private readonly healthTtlMs = 10_000;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ async function acquireDiskLock(lockPath: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function withFurniDataLock<T>(fn: () => Promise<T>): Promise<T> {
|
export async function withFurniDataLock<T>(fn: () => Promise<T>): Promise<T> {
|
||||||
let release: () => void;
|
let release!: () => void;
|
||||||
const acquired = new Promise<void>((r) => {
|
const acquired = new Promise<void>((r) => {
|
||||||
release = r;
|
release = r;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -166,14 +166,14 @@ describe("derivePublicForegrounds", () => {
|
|||||||
for (const palette of [preset.light, preset.dark]) {
|
for (const palette of [preset.light, preset.dark]) {
|
||||||
const result = derivePublicForegrounds(palette);
|
const result = derivePublicForegrounds(palette);
|
||||||
for (const name of required) {
|
for (const name of required) {
|
||||||
const pair = result.pairs.find(
|
const pair = result.pairs.find(
|
||||||
(candidate) => candidate.name === name,
|
(candidate) => candidate.name === name,
|
||||||
);
|
);
|
||||||
expect(pair, `missing ${name}`).toBeDefined();
|
expect(pair, `missing ${name}`).toBeDefined();
|
||||||
expect(
|
expect(
|
||||||
contrastRatio(pair?.foreground, pair?.background),
|
contrastRatio(pair!.foreground, pair!.background),
|
||||||
name,
|
name,
|
||||||
).toBeGreaterThanOrEqual(4.5);
|
).toBeGreaterThanOrEqual(4.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user