From df1fa2b40dfc873c505ffde408d423fa1ef947e1 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 20 Feb 2018 17:25:06 -0500 Subject: [PATCH 1/4] feat(test): add travis and cargo fmt script --- .travis.yml | 17 +++++++++++++++++ tests/scripts/rustfmt.sh | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 .travis.yml create mode 100644 tests/scripts/rustfmt.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..568f493 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: rust +sudo: false +cache: + cargo +rust: + - stable + - beta + - nightly +before_install: + - bash ./tests/scripts/rustfmt.sh + +script: + - cargo fmt -- --write-mode diff + - cargo test +matrix: + allow_failures: + - rust: nightly diff --git a/tests/scripts/rustfmt.sh b/tests/scripts/rustfmt.sh new file mode 100644 index 0000000..6836314 --- /dev/null +++ b/tests/scripts/rustfmt.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +which rustfmt > /dev/null + +if [[ $? -ne 0 ]]; then + cargo install rustfmt +else + current_version=$(rustfmt --version | cut -d '-' -f 1 | xargs) + upstream_version=$(cargo search rustfmt | head -n 1 | cut -d ' ' -f 3 | tr -d '"' | xargs) + if [ $current_version != $upstream_version ]; then + cargo install rustfmt --force + fi +fi From 59ee54aaef2ece3d42766e6d522ff93783d4440d Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 20 Feb 2018 17:28:46 -0500 Subject: [PATCH 2/4] feat(doc): add travis status to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index eba8f80..616a3a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # 📦✨ wasm-pack > pack up the wasm and publish it to npm! +[![Build Status](https://travis-ci.org/ashleygwilliams/wasm-pack.svg?branch=master)](https://travis-ci.org/ashleygwilliams/wasm-pack) + the goal of this project is to create a portable command line tool for publishing compiled wasm projects to the npm registry for the consumption of js devs using the npm CLI, yarn, or any other CLI tool that interfaces From c8b702c06116d3d2f3c52f1520dd02521df83f94 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 20 Feb 2018 17:44:47 -0500 Subject: [PATCH 3/4] feat(doc): doc available commands --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 616a3a9..9d1d475 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,25 @@ this project is written in rust. [get rust] to work on this project. 2. `cd wasm-pack` 3. `cargo run` +## 💃 commands + +- `help`: display available commands +- 🐣 `init`: + - generate a `package.json` + - run [wasm-bindgen] [NOT IMPLEMENTED] +- 🍱 `pack`: create a tarball but don't push to the npm registry [NOT IMPLEMENTED] +- 🎆 `publish`: create a tarball and publish to the npm registry [NOT IMPLEMENTED] + ## ⚙️ what's it do? right now? not much. here's the plan: - [x] read data from `Cargo.toml` +- [ ] run [wasm-bindgen] - [ ] read JS dependency data from your compiled wasm (see [rust-wasm/36]) - [x] write data to `package.json` - [ ] log you in to npm - [ ] publish package to npm registry [rust-wasm/36]: https://github.com/rust-lang-nursery/rust-wasm/issues/36 +[wasm-bindgen]: https://github.com/alexcrichton/wasm-bindgen From 4c54996abd02d13ef3dcda9fa13ecb5b6228e952 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 20 Feb 2018 17:56:55 -0500 Subject: [PATCH 4/4] feat(test): use new rustfmt-preview --- .travis.yml | 5 ++--- src/lib.rs | 2 +- tests/scripts/rustfmt.sh | 13 ------------- 3 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 tests/scripts/rustfmt.sh diff --git a/.travis.yml b/.travis.yml index 568f493..20a98d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,11 @@ rust: - stable - beta - nightly -before_install: - - bash ./tests/scripts/rustfmt.sh script: - - cargo fmt -- --write-mode diff - cargo test + - rustup component add rustfmt-preview + - cargo fmt -- --write-mode diff matrix: allow_failures: - rust: nightly diff --git a/src/lib.rs b/src/lib.rs index 3696813..9e5aa7b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ +extern crate failure; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate toml; -extern crate failure; use std::fs::File; use std::io::prelude::*; diff --git a/tests/scripts/rustfmt.sh b/tests/scripts/rustfmt.sh deleted file mode 100644 index 6836314..0000000 --- a/tests/scripts/rustfmt.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -which rustfmt > /dev/null - -if [[ $? -ne 0 ]]; then - cargo install rustfmt -else - current_version=$(rustfmt --version | cut -d '-' -f 1 | xargs) - upstream_version=$(cargo search rustfmt | head -n 1 | cut -d ' ' -f 3 | tr -d '"' | xargs) - if [ $current_version != $upstream_version ]; then - cargo install rustfmt --force - fi -fi