tinyrelayfile
tinyrelay/scripts/verify-bundles.mjs/

scripts/verify-bundles.mjs raw
1import { build } from "esbuild";
2import { readFile, mkdtemp, rm } from "node:fs/promises";
3import { tmpdir } from "node:os";
4import { join } from "node:path";
5import { signerBundle, nostrNameBundle } from "./bundle-config.mjs";
6
7const root = new URL("..", import.meta.url);
8const temporaryDirectory = await mkdtemp(join(tmpdir(), "tinyrelay-bundles-"));
9const bundles = [
10 ["signer", signerBundle(join(temporaryDirectory, "signer.js")), "tinyclient/signer.js"],
11 ["nostr-name", nostrNameBundle(join(temporaryDirectory, "nostr-name.js")), "tinyclient/nostr-name.js"],
12];
13
14try {
15 for (const [name, config, checkedInPath] of bundles) {
16 await build(config);
17 const [built, checkedIn] = await Promise.all([
18 readFile(config.outfile),
19 readFile(new URL(checkedInPath, root)),
20 ]);
21 if (!built.equals(checkedIn)) {
22 throw new Error(`${checkedInPath} is stale; run npm run build:${name}`);
23 }
24 }
25 console.log(`verified ${bundles.length} generated browser bundles`);
26} finally {
27 await rm(temporaryDirectory, { recursive: true, force: true });
28}

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs