This commit is contained in:
1 parent
2127f5f459
commit
8b80d05ca2
56 files changed
+6910
-1
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { readdirSync, readFileSync, statSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
let files = 0,
|
||||
size = 0;
|
||||
function inspect(directory) {
|
||||
for (const name of readdirSync(directory)) {
|
||||
const path = join(directory, name);
|
||||
if (statSync(path).isDirectory()) {
|
||||
inspect(path);
|
||||
continue;
|
||||
}
|
||||
if (!/\.(html|js|css|svg)$/.test(name))
|
||||
throw new Error(`Unexpected production asset: ${path}`);
|
||||
if (/reference|vendor|binjgb/i.test(path))
|
||||
throw new Error(`Reference tool in production: ${path}`);
|
||||
const bytes = readFileSync(path),
|
||||
text = bytes.toString("utf8");
|
||||
if (/Binjgb|_emulator_|binjgb\.wasm|\.reference\/pokecrystal/.test(text))
|
||||
throw new Error(`Reference dependency in production: ${path}`);
|
||||
if (/data:(image|audio|application\/octet-stream)[^,]*;base64,/i.test(text))
|
||||
throw new Error(`Embedded binary asset in production: ${path}`);
|
||||
files++;
|
||||
size += bytes.length;
|
||||
}
|
||||
}
|
||||
inspect("dist");
|
||||
console.log(
|
||||
`Native release verified: ${files} HTML/JS/CSS/SVG files, ${size} bytes; no emulator, ROM, extracted binary assets or reference checkout.`,
|
||||
);
|
||||
Reference in new issue
Block a user