mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
style: apply Biome formatting to enterprise files
This commit is contained in:
@@ -23,7 +23,8 @@ const ENTERPRISE_DIR = join(ROOT, "packages/enterprise");
|
||||
// Catches static `from "..."`, side-effect `import "..."`, and dynamic `import("...")`
|
||||
// forms. The bare package entry "@snapotter/enterprise" (no trailing slash) stays
|
||||
// allowed; only reaching INTO the package is a violation.
|
||||
const INTERNAL_IMPORT = /(from|import)\s*[\s(]\s*["'](@snapotter\/enterprise\/|[./]*packages\/enterprise\/)/;
|
||||
const INTERNAL_IMPORT =
|
||||
/(from|import)\s*[\s(]\s*["'](@snapotter\/enterprise\/|[./]*packages\/enterprise\/)/;
|
||||
const APP_IMPORT = /(from|import)\s*[\s(]\s*["'][^"']*apps\/(api|web)\//;
|
||||
|
||||
const violations = [];
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
/**
|
||||
* Export an installed AI feature bundle as a gzipped tar archive for offline
|
||||
* transfer to air-gapped SnapOtter installations.
|
||||
@@ -18,11 +20,9 @@
|
||||
* createRequire, same pattern as tests/global-setup.ts).
|
||||
*/
|
||||
import { createRequire } from "node:module";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { tmpdir } from "node:os";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const apiRequire = createRequire(join(__dirname, "../apps/api/package.json"));
|
||||
@@ -136,7 +136,9 @@ if (modelEntries.length === 0) {
|
||||
process.stderr.write("Warning: no model files found; archive will only contain bundle.json\n");
|
||||
}
|
||||
|
||||
process.stderr.write(`Exporting bundle "${bundleId}" v${version} (${modelEntries.length} model files)...\n`);
|
||||
process.stderr.write(
|
||||
`Exporting bundle "${bundleId}" v${version} (${modelEntries.length} model files)...\n`,
|
||||
);
|
||||
|
||||
// ── Create the archive ─────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -19,7 +19,10 @@ mkdirSync(outDir, { recursive: true });
|
||||
|
||||
// --- 1. truncated.jpg: a real JPEG cut off at 40% ---------------------------
|
||||
const realJpeg = readFileSync(join(root, "tests", "fixtures", "sample-photo.jpg"));
|
||||
writeFileSync(join(outDir, "truncated.jpg"), realJpeg.subarray(0, Math.floor(realJpeg.length * 0.4)));
|
||||
writeFileSync(
|
||||
join(outDir, "truncated.jpg"),
|
||||
realJpeg.subarray(0, Math.floor(realJpeg.length * 0.4)),
|
||||
);
|
||||
|
||||
// --- 2. zero-byte.png --------------------------------------------------------
|
||||
writeFileSync(join(outDir, "zero-byte.png"), Buffer.alloc(0));
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
/**
|
||||
* Generates the tiny media/document fixtures committed under tests/fixtures/.
|
||||
* Requires ffmpeg on PATH (or FFMPEG_PATH) and qpdf (or QPDF_PATH).
|
||||
@@ -6,9 +8,7 @@
|
||||
* node scripts/generate-test-fixtures.mjs
|
||||
*/
|
||||
import { createRequire } from "node:module";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import { join, dirname } from "node:path";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
@@ -38,17 +38,52 @@ function run(args) {
|
||||
}
|
||||
|
||||
// 1s 64x64 mp4 with video + audio (h264 + aac; needed by extract-audio + mute-video)
|
||||
run(["-f", "lavfi", "-i", "testsrc=duration=1:size=64x64:rate=8",
|
||||
"-f", "lavfi", "-i", "sine=frequency=440:duration=1",
|
||||
"-c:v", "libx264", "-preset", "ultrafast", "-pix_fmt", "yuv420p",
|
||||
"-c:a", "aac", "-b:a", "32k", "-shortest",
|
||||
join(mediaDir, "tiny.mp4")]);
|
||||
run([
|
||||
"-f",
|
||||
"lavfi",
|
||||
"-i",
|
||||
"testsrc=duration=1:size=64x64:rate=8",
|
||||
"-f",
|
||||
"lavfi",
|
||||
"-i",
|
||||
"sine=frequency=440:duration=1",
|
||||
"-c:v",
|
||||
"libx264",
|
||||
"-preset",
|
||||
"ultrafast",
|
||||
"-pix_fmt",
|
||||
"yuv420p",
|
||||
"-c:a",
|
||||
"aac",
|
||||
"-b:a",
|
||||
"32k",
|
||||
"-shortest",
|
||||
join(mediaDir, "tiny.mp4"),
|
||||
]);
|
||||
// 1s sine mp3
|
||||
run(["-f", "lavfi", "-i", "sine=frequency=440:duration=1", "-c:a", "libmp3lame", "-b:a", "32k",
|
||||
join(mediaDir, "tiny.mp3")]);
|
||||
run([
|
||||
"-f",
|
||||
"lavfi",
|
||||
"-i",
|
||||
"sine=frequency=440:duration=1",
|
||||
"-c:a",
|
||||
"libmp3lame",
|
||||
"-b:a",
|
||||
"32k",
|
||||
join(mediaDir, "tiny.mp3"),
|
||||
]);
|
||||
// 1s sine wav
|
||||
run(["-f", "lavfi", "-i", "sine=frequency=440:duration=1", "-c:a", "pcm_s16le", "-ar", "8000",
|
||||
join(mediaDir, "tiny.wav")]);
|
||||
run([
|
||||
"-f",
|
||||
"lavfi",
|
||||
"-i",
|
||||
"sine=frequency=440:duration=1",
|
||||
"-c:a",
|
||||
"pcm_s16le",
|
||||
"-ar",
|
||||
"8000",
|
||||
join(mediaDir, "tiny.wav"),
|
||||
]);
|
||||
|
||||
// Minimal OOXML/EPUB containers via archiver (resolved from apps/api).
|
||||
const apiRequire = createRequire(join(root, "apps/api/package.json"));
|
||||
@@ -108,7 +143,11 @@ await writeZip(join(docsDir, "tiny.xlsx"), {
|
||||
// EPUB requires the mimetype entry FIRST and STORED (uncompressed).
|
||||
await writeZip(
|
||||
join(docsDir, "tiny.epub"),
|
||||
{ "META-INF/container.xml": epubContainer, "OEBPS/content.opf": epubOpf, "OEBPS/chapter.xhtml": epubChapter },
|
||||
{
|
||||
"META-INF/container.xml": epubContainer,
|
||||
"OEBPS/content.opf": epubOpf,
|
||||
"OEBPS/chapter.xhtml": epubChapter,
|
||||
},
|
||||
{ name: "mimetype", content: "application/epub+zip" },
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user