Extract Sai Ink embedder
This commit is contained in:
commit
20d01a8ff7
23 changed files with 13537 additions and 0 deletions
16
scripts/build.mjs
Normal file
16
scripts/build.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const root = new URL("..", import.meta.url);
|
||||
const files = ["sai.js", "sai.css", "ink.js"];
|
||||
|
||||
await fs.mkdir(new URL("dist/", root), { recursive: true });
|
||||
|
||||
for (const file of files) {
|
||||
await fs.copyFile(
|
||||
new URL(`src/${file}`, root),
|
||||
new URL(`dist/${file}`, root),
|
||||
);
|
||||
}
|
||||
|
||||
console.log(`Built ${files.map((file) => path.join("dist", file)).join(", ")}`);
|
||||
31
scripts/check.mjs
Normal file
31
scripts/check.mjs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import fs from "node:fs/promises";
|
||||
|
||||
const root = new URL("..", import.meta.url);
|
||||
const required = [
|
||||
"dist/sai.js",
|
||||
"dist/sai.css",
|
||||
"dist/ink.js",
|
||||
"examples/static-site/index.html",
|
||||
"docs/manifest.md",
|
||||
];
|
||||
|
||||
for (const file of required) {
|
||||
await fs.access(new URL(file, root));
|
||||
}
|
||||
|
||||
const script = await fs.readFile(new URL("dist/sai.js", root), "utf8");
|
||||
const css = await fs.readFile(new URL("dist/sai.css", root), "utf8");
|
||||
|
||||
if (!script.includes("window.Sai")) {
|
||||
throw new Error("dist/sai.js must expose window.Sai");
|
||||
}
|
||||
|
||||
if (!script.includes(".sai-player, .aetheria-ink-player")) {
|
||||
throw new Error("dist/sai.js must preserve legacy player discovery");
|
||||
}
|
||||
|
||||
if (!css.includes(".sai-player")) {
|
||||
throw new Error("dist/sai.css must style .sai-player");
|
||||
}
|
||||
|
||||
console.log("Sai package checks passed.");
|
||||
Loading…
Reference in a new issue