diff --git a/.travis.yml b/.travis.yml index b3fd994..bd3169d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,17 +5,8 @@ sudo: false cache: - cargo -INSTALL_NODE_VIA_NVM: &INSTALL_NODE_VIA_NVM - | - rustup target add wasm32-unknown-unknown - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash - source ~/.nvm/nvm.sh - nvm install v10.5 - -install: - - *INSTALL_NODE_VIA_NVM - - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f - script: - - wasm-pack build - - cd ./www && npm install && ./node_modules/.bin/webpack + - rustup target add wasm32-unknown-unknown + - cargo build --target wasm32-unknown-unknown + - cargo install wasm-bindgen + - wasm-bindgen --out-dir www --target web --reference-types --no-typescript --omit-default-module-path target/wasm32-unknown-unknown/debug/wasm_game_of_life.wasm diff --git a/www/.bin/create-wasm-app.js b/www/.bin/create-wasm-app.js deleted file mode 100755 index 2f42973..0000000 --- a/www/.bin/create-wasm-app.js +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env node - -const { spawn } = require("child_process"); -const fs = require("fs"); - -let folderName = '.'; - -if (process.argv.length >= 3) { - folderName = process.argv[2]; - if (!fs.existsSync(folderName)) { - fs.mkdirSync(folderName); - } -} - -const clone = spawn("git", ["clone", "https://github.com/rustwasm/create-wasm-app.git", folderName]); - -clone.on("close", code => { - if (code !== 0) { - console.error("cloning the template failed!") - process.exit(code); - } else { - console.log("🦀 Rust + 🕸 Wasm = ❤"); - } -}); diff --git a/www/.gitignore b/www/.gitignore index 3c3629e..960b12e 100644 --- a/www/.gitignore +++ b/www/.gitignore @@ -1 +1,2 @@ -node_modules +wasm_game_of_life.js +wasm_game_of_life_bg.wasm diff --git a/www/README.md b/www/README.md deleted file mode 100644 index e151096..0000000 --- a/www/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# create-wasm-app -> an npm init project for generating a project that consumes rust-generated wasm via webpack - -## Usage - -``` -npm init wasm-app -``` - -## What's Included - -- `.gitignore`: ignores `node_modules` -- `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you -- `README.md`: the file you are reading now! -- `index.html`: a bare bones html document that includes the webpack bundle -- `index.js`: example js file with a comment showing how to import and use a wasm pkg -- `package.json` and `package-lock.json`: - - pulls in devDependencies for using webpack: - - [`webpack`](https://www.npmjs.com/package/webpack) - - [`webpack-cli`](https://www.npmjs.com/package/webpack-cli) - - [`webpack-dev-server`](https://www.npmjs.com/package/webpack-dev-server) - - defines a `start` script to run `webpack-dev-server` -- `webpack.config.js`: configuration file for bundling your js with webpack - -## License - -Licensed under either of - -* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally -submitted for inclusion in the work by you, as defined in the Apache-2.0 -license, shall be dual licensed as above, without any additional terms or -conditions. diff --git a/www/bootstrap.js b/www/bootstrap.js deleted file mode 100644 index 7934d62..0000000 --- a/www/bootstrap.js +++ /dev/null @@ -1,5 +0,0 @@ -// A dependency graph that contains any wasm must all be imported -// asynchronously. This `bootstrap.js` file does the single async import, so -// that no one else needs to worry about it again. -import("./index.js") - .catch(e => console.error("Error importing `index.js`:", e)); diff --git a/www/index.html b/www/index.html index e55e022..acb334e 100644 --- a/www/index.html +++ b/www/index.html @@ -25,6 +25,6 @@
- +