Skip to content

Update to todays wasm-pack #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .bin/create-rust-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

const { spawnSync } = require("child_process");
const fs = require("fs");
const path = require("path");
const cpr = require("cpr");
const rimraf = require("rimraf");

function run(cmd, args, opts) {
const output = spawnSync(cmd, args, opts);
Expand All @@ -24,10 +27,24 @@ if (process.argv.length >= 3) {
}
}

run("git", ["clone", "https://github.com/rustwasm/rust-webpack-template.git", folderName]);
let gitFolder = path.join(folderName, "git-clone");

console.log(" 🦀 Rust + 🕸 WebAssembly + Webpack = ❤️ ");
// This uses --no-tags and --depth 1 in order to make the cloning faster
run("git", ["clone", "--no-tags", "--depth", "1", "https://github.com/rustwasm/rust-webpack-template.git", gitFolder]);

run("npm", ["install"], { cwd: folderName, shell: true });
// Copies the template folder
cpr(path.join(gitFolder, "template"), folderName, {}, function (err, files) {
// Removes the git folder regardless of whether cpr succeeded or not
rimraf.sync(gitFolder);

console.log(" Installed dependencies ✅ ");
if (err) {
throw err;

} else {
console.log(" 🦀 Rust + 🕸 WebAssembly + Webpack = ❤️ ");

run("npm", ["install"], { cwd: folderName, shell: true });

console.log(" Installed dependencies ✅ ");
}
});
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
dist
node_modules
crate/bin
crate/pkg
crate/target
crate/wasm-pack.log
crate/Cargo.lock
/template/package-lock.json
/template/Cargo.lock
/template/git-clone
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ install:
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f

script:
- pushd template
- npm install
- npm run build
- popd
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ npm init rust-webpack my-app
This template comes pre-configured with all the boilerplate for compiling Rust
to WebAssembly and hooking into a Webpack build pipeline.

* `npm run start` -- Serve the project locally for development at
`http://localhost:8080`.
* `npm start` -- Serve the project locally for development at
`http://localhost:8080`. It auto-reloads when you make any changes.

* `npm run build` -- Bundle the project (in production mode).

* `npm test` -- Run the project's unit tests.
40 changes: 0 additions & 40 deletions crate/Cargo.toml

This file was deleted.

32 changes: 0 additions & 32 deletions crate/src/lib.rs

This file was deleted.

10 changes: 0 additions & 10 deletions index.html

This file was deleted.

3 changes: 0 additions & 3 deletions js/index.js

This file was deleted.

Loading