Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { createGzip } from "node:zlib";
|
||||
import { createReadStream, createWriteStream, cpSync, mkdirSync, existsSync, rmSync } from "node:fs";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import { createRequire } from "node:module";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const webRoot = join(here, "..");
|
||||
const dest = join(webRoot, "static", "vendor", "rapidoc");
|
||||
|
||||
const pkgRoot = dirname(require.resolve("rapidoc/package.json"));
|
||||
const source = join(pkgRoot, "dist", "rapidoc-min.js");
|
||||
if (!existsSync(source)) {
|
||||
throw new Error(`rapidoc missing dist/rapidoc-min.js at ${source}`);
|
||||
}
|
||||
|
||||
rmSync(dest, { recursive: true, force: true });
|
||||
mkdirSync(dest, { recursive: true });
|
||||
|
||||
const destJs = join(dest, "rapidoc-min.js");
|
||||
cpSync(source, destJs);
|
||||
|
||||
// Precompress for hooks.server.ts (Accept-Encoding: gzip).
|
||||
await pipeline(createReadStream(destJs), createGzip({ level: 9 }), createWriteStream(`${destJs}.gz`));
|
||||
|
||||
console.log(`Copied rapidoc dist/rapidoc-min.js → ${dest}`);
|
||||
Reference in New Issue
Block a user