Merge pull request #80 from ashleygwilliams/refactor-nits

assorted nits
master
ashley williams 7 years ago committed by GitHub
commit 1ffe34d2e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/bindgen.rs
  2. 2
      src/build.rs
  3. 8
      src/command.rs
  4. 8
      src/main.rs
  5. 2
      src/manifest.rs
  6. 2
      src/readme.rs

@ -1,7 +1,7 @@
use PBAR;
use console::style; use console::style;
use emoji; use emoji;
use std::process::Command; use std::process::Command;
use PBAR;
pub fn cargo_install_wasm_bindgen() { pub fn cargo_install_wasm_bindgen() {
let step = format!( let step = format!(

@ -1,7 +1,7 @@
use PBAR;
use console::style; use console::style;
use emoji; use emoji;
use std::process::Command; use std::process::Command;
use PBAR;
pub fn rustup_add_wasm_target() { pub fn rustup_add_wasm_target() {
let step = format!( let step = format!(

@ -1,4 +1,3 @@
use PBAR;
use bindgen; use bindgen;
use build; use build;
use console::style; use console::style;
@ -12,6 +11,7 @@ use readme;
use std::fs; use std::fs;
use std::result; use std::result;
use std::time::Instant; use std::time::Instant;
use PBAR;
#[derive(Debug, StructOpt)] #[derive(Debug, StructOpt)]
pub enum Command { pub enum Command {
@ -46,7 +46,7 @@ pub fn create_pkg_dir(path: &str) -> result::Result<(), Error> {
Ok(()) Ok(())
} }
pub fn init_command(path: Option<String>, scope: Option<String>) -> result::Result<(), Error> { pub fn init(path: Option<String>, scope: Option<String>) -> result::Result<(), Error> {
let started = Instant::now(); let started = Instant::now();
let crate_path = set_crate_path(path); let crate_path = set_crate_path(path);
@ -73,7 +73,7 @@ pub fn init_command(path: Option<String>, scope: Option<String>) -> result::Resu
Ok(()) Ok(())
} }
pub fn pack_command(path: Option<String>) -> result::Result<(), Error> { pub fn pack(path: Option<String>) -> result::Result<(), Error> {
let crate_path = set_crate_path(path); let crate_path = set_crate_path(path);
npm::npm_pack(&crate_path); npm::npm_pack(&crate_path);
@ -81,7 +81,7 @@ pub fn pack_command(path: Option<String>) -> result::Result<(), Error> {
Ok(()) Ok(())
} }
pub fn publish_command(path: Option<String>) -> result::Result<(), Error> { pub fn publish(path: Option<String>) -> result::Result<(), Error> {
let crate_path = set_crate_path(path); let crate_path = set_crate_path(path);
npm::npm_publish(&crate_path); npm::npm_publish(&crate_path);

@ -5,17 +5,17 @@ extern crate indicatif;
extern crate quicli; extern crate quicli;
use quicli::prelude::*; use quicli::prelude::*;
use wasm_pack::command::{init, pack, publish, Command};
use wasm_pack::Cli; use wasm_pack::Cli;
use wasm_pack::command::{init_command, pack_command, publish_command, Command};
main!(|args: Cli, log_level: verbosity| match args.cmd { main!(|args: Cli, log_level: verbosity| match args.cmd {
Command::Init { path, scope } => { Command::Init { path, scope } => {
init_command(path, scope)?; init(path, scope)?;
} }
Command::Pack { path } => { Command::Pack { path } => {
pack_command(path)?; pack(path)?;
} }
Command::Publish { path } => { Command::Publish { path } => {
publish_command(path)?; publish(path)?;
} }
}); });

@ -1,12 +1,12 @@
use std::fs::File; use std::fs::File;
use std::io::prelude::*; use std::io::prelude::*;
use PBAR;
use console::style; use console::style;
use emoji; use emoji;
use failure::Error; use failure::Error;
use serde_json; use serde_json;
use toml; use toml;
use PBAR;
#[derive(Deserialize)] #[derive(Deserialize)]
struct CargoManifest { struct CargoManifest {

@ -2,8 +2,8 @@ use console::style;
use failure::Error; use failure::Error;
use std::fs; use std::fs;
use PBAR;
use emoji; use emoji;
use PBAR;
pub fn copy_from_crate(path: &str) -> Result<(), Error> { pub fn copy_from_crate(path: &str) -> Result<(), Error> {
let step = format!( let step = format!(

Loading…
Cancel
Save