Skip to content

Commit

Permalink
docs: update README with build instructions and requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmo-ds committed May 25, 2023
1 parent a97cef6 commit 5e0f106
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
# totp-wasm-zig

[![License](https://img.shields.io/github/license/gizmo-ds/totp-wasm-zig?style=flat-square)](./LICENSE)
[![CI](https://img.shields.io/github/actions/workflow/status/gizmo-ds/totp-wasm-zig/testing.yml?branch=main&label=docker%20image&style=flat-square)](https://github.com/gizmo-ds/totp-wasm-zig/actions/workflows/testing.yml)

> **Warning**
> This project is still in the early stage of development, and is not ready for production use.
> This project is still in the early stage of development and is not ready for production use.
# Requirements

- [Zig](https://ziglang.org/)
- [Binaryen](https://github.com/WebAssembly/binaryen) (Optional but recommended)
- [Node.js](https://nodejs.org) (Optional)

# Build

## Compiling WebAssembly

To reduce the size of the `.wasm` file, you can choose to install [Binaryen](https://github.com/WebAssembly/binaryen).

[How to install Binaryen?](#how-to-install-binaryen)

```fish
zig build
zig build bind
```

## Packaging the totp-wasm JavaScript bundle

```fish
npx esbuild packages/totp-wasm/index.ts --bundle --format=esm --platform=node --target=es2017 --minify --outfile=packages/totp-wasm/index.js
```

# How to install Binaryen?

You can download the latest release of Binaryen from [https://github.com/WebAssembly/binaryen/releases](https://github.com/WebAssembly/binaryen/releases). Once that's done, simply extract the compressed file somewhere. `wasm-opt` will be in the `bin` folder.

## License

Expand Down

0 comments on commit 5e0f106

Please sign in to comment.