This repository has been archived by the owner on Feb 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds scripts to publish and fix node import
- Loading branch information
1 parent
b473fbb
commit 05c1c99
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const buffer = fs.readFileSync('./pkg/schnorrkel_js_bg.wasm'); | ||
|
||
fs.writeFileSync('./pkg/schnorrkel_js_bg.js', ` | ||
const imports = {}; | ||
imports['./schnorrkel_js'] = require('./schnorrkel_js'); | ||
const bytes = Buffer.from('${buffer.toString('base64')}', 'base64'); | ||
const wasmModule = new WebAssembly.Module(bytes); | ||
const wasmInstance = new WebAssembly.Instance(wasmModule, imports); | ||
module.exports = wasmInstance.exports; | ||
`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Compile the latest version; update ./pkg and readme files in it. | ||
wasm-pack build --target browser | ||
|
||
# Fix the name | ||
sed -i -e 's/schnorrkel-js/@parity\/schnorrkel-js/g' pkg/package.json | ||
|
||
# Run the script to fix node/browser import support | ||
./pack-node.sh | ||
|
||
# publish | ||
# wasm-pack publish |