fix: replace jsonc with jsonc-parser and cleanup build config

This commit is contained in:
openhands committed 2026-08-11 16:50:10 +02:00
1 parent 0bd2ac6707
commit e867b675fc
12 files changed
+195 -216

No files matched your search

+3 -3
View File
@@ -2,7 +2,7 @@
import fs from "node:fs/promises";
import path from "node:path";
import JSON5 from "json5";
import * as JSONC from "jsonc-parser";
import { z } from "zod";
import {
CLIENT_TRANSLATION_FILES,
@@ -97,7 +97,7 @@ export const saveClientTranslations = adminAction(
// intact. Falls back to a full re-serialization (which DOES drop comments)
// only when an edited key cannot be located via the patch contract.
const original: Record<string, string> = {};
const parsed = JSON5.parse(raw);
const parsed = JSONC.parse(raw);
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
for (const [k, v] of Object.entries(parsed)) {
original[k] = v == null ? "" : String(v);
@@ -116,7 +116,7 @@ export const saveClientTranslations = adminAction(
// and warn the caller that comments were lost.
await fs.writeFile(
absPath,
JSON5.stringify(ctx.data.data, null, 4),
JSON.stringify(ctx.data.data, null, 4),
"utf-8",
);
return actionOk({ commentsLost: true, unpatchedKeys });
+2 -2
View File
@@ -1,6 +1,6 @@
import fs from "node:fs/promises";
import path from "node:path";
import JSON5 from "json5";
import * as JSONC from "jsonc-parser";
import {
CLIENT_TRANSLATION_FILES,
getClientTranslationFile,
@@ -29,7 +29,7 @@ export default async function ClientTranslationsPage({
path.join(/*turbopackIgnore: true*/ process.cwd(), file.relPath),
"utf-8",
);
const parsed = file.format === "json5" ? JSON5.parse(raw) : JSON.parse(raw);
const parsed = file.format === "json5" ? JSONC.parse(raw) : JSON.parse(raw);
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
// Nitro localization files are flat: { "key.with.dots": "value" }.
// Coerce values to strings so the editor can render them in <input>.
-1
View File
@@ -1,7 +1,6 @@
@import "tailwindcss";
@plugin "@tailwindcss/forms";
@plugin "@tailwindcss/typography";
@plugin "tailwindcss-animate";
@custom-variant dark (&:where(.dark, .dark *));
@theme {
+17
View File
@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { importClothingSet } from "@/lib/services/clothing-set-import";
import { __clearFigureOfficialCache } from "@/lib/services/figure-official";
describe("real import", () => {
it("imports set 5044 (needs new lib shirt_M_drsports)", async () => {
__clearFigureOfficialCache();
const progress: string[] = [];
const r = await importClothingSet({
setType: "ch",
setId: 5044,
onProgress: (s) => progress.push(s),
});
expect(r.ok, JSON.stringify(r)).toBe(true);
expect(progress).toContain("importing library shirt_M_drsports");
}, 120000);
});