diff --git a/README.md b/README.md index 2f67617..de8b249 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,45 @@ # wasm-build -Tool for building and packaging rust wasm projects, using wasm-bindgen for generating bindings - [![Build Status](https://travis-ci.org/Healthire/wasm-build.svg?branch=master)](https://travis-ci.org/Healthire/wasm-build) -This tool is intended to be used in conjunction with [wasm-bindgen](https://github.com/alexcrichton/wasm-bindgen). Its primary intended use is to package and run wasm modules produced by wasm-bindgen in a web browser context. +Tool for building and packaging rust wasm projects using [wasm-bindgen](https://github.com/alexcrichton/wasm-bindgen) for web. ## Work In Progress This tool is a work in progress and is not fully implemented yet. -## Planned features +## Usage + +wasm-build depends on [yarn](https://yarnpkg.com/en/) + +### Setup + +1. Install [yarn](https://yarnpkg.com/en/) +2. Install wasm-build as a cargo package +``` +$ cargo install --git https://github.com/Healthire/wasm-build +``` +3. Done! + +### Building + +Building is as simple as running the build command in your project directory +``` +$ wasm-build build +``` +During the build process wasm-build will ask you to confirm automatically installing [wasm-bindgen](https://github.com/alexcrichton/wasm-bindgen) CLI tool and [webpack](https://webpack.js.org/) if they are not found on your system. + +The wasm-build build outputs a bundled javascript app to ./target/wasm-build//dist/.js. + +### Running + +Running a packaged is as easy as building. +``` +$ wasm-build run +``` +When the build is finished, the application will be served at http://localhost:8000. + +A static HTML file can be served instead of the default HTML index by creating a ./html/.html file. + +## Possible future features -* Packaging binary targets into html bundles -* Packaging library targets into es6 modules -* Run binary targets (package html bundle and host it from a webserver) * Run tests (package test bundles and run tests in headless browser) -* Possibly separate browser/nodejs modes for running binaries and tests