chore(scure-sr25519): add the source lib/ is built from (#17)

The package shipped only compiled output, and no repository held its
source. lib/ is @scure/sr25519 0.2.0 with three edits made directly in
the compiled files: signing context 'substrate' -> 'bizinikiwi' and the
two header comment lines. index.ts is upstream's 0.2.0 source with the
same edits; compiled with its own tsconfig it reproduces lib/*.js and
lib/*.d.ts byte for byte. Only the source maps change, since the
hand-edited ones still described upstream's file.

- index.ts, tsconfig.json, tsconfig.cjs.json, upstream MIT LICENSE
- yarn build:scure-sr25519 rebuilds lib/
- scripts/check-scure-sr25519.sh, run in CI, fails when lib/ is not a
  build of index.ts
- README: what differs from upstream, how to build; it said the context
  was 'bizinikiwi' instead of 'bizinikiwi'
This commit is contained in:
SatoshiQaziMuhammed authored and GitHub committed 2026-10-19 22:50:39 +04:00
1 parent 0e96998a07
commit caaa7468bc
11 files changed
+655 -6

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Copyright 2017-2026 @pezkuwi/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
# packages/scure-sr25519/lib is committed and published as-is. Rebuild it from
# index.ts and fail if the result differs, so the published code can only come
# from the source in this repository.
set -euo pipefail
PKG="$(cd "$(dirname "$0")/../packages/scure-sr25519" && pwd)"
# Build beside lib/ so the source paths in the maps come out the same.
OUT="$(mktemp -d "$PKG/.check-lib.XXXXXX")"
trap 'rm -rf "$OUT"' EXIT
node node_modules/typescript/bin/tsc -p "$PKG/tsconfig.json" --outDir "$OUT/esm"
node node_modules/typescript/bin/tsc -p "$PKG/tsconfig.cjs.json" --outDir "$OUT"
cp "$PKG/lib/esm/package.json" "$OUT/esm/package.json"
if ! diff -r "$OUT" "$PKG/lib"; then
echo "packages/scure-sr25519/lib does not match a build of index.ts; run 'yarn build:scure-sr25519' and commit packages/scure-sr25519/lib" >&2
exit 1
fi
echo "scure-sr25519: lib matches index.ts"