From 61ce6b1ead386e91c58758f4683611c0faa4d829 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Mon, 23 Aug 2021 19:27:09 +0200 Subject: [PATCH] Add register script --- package.json | 6 ++---- register.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 register.js diff --git a/package.json b/package.json index 375d1a3..90ab055 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,8 @@ "lib/**/*.js", "lib/**/*.js.map", "lib/**/*.d.ts", - "blst-native.*", - "browser.*", - "herumi.*", - "node." + "*.d.ts", + "*.js" ], "keywords": [ "ethereum", diff --git a/register.js b/register.js new file mode 100644 index 0000000..79f5a4a --- /dev/null +++ b/register.js @@ -0,0 +1,14 @@ +const {init} = require("./lib"); + +// ----------------------------------------- +// To be used in NodeJS testing environments +// node -r @chainsafe/bls/register +// ----------------------------------------- + +// blst-native initialization is syncronous +// Initialize bls here instead of in before() so it's available inside describe() blocks +init("blst-native").catch((e) => { + // eslint-disable-next-line no-console + console.error(e); + process.exit(1); +});