diff --git a/src/command/build.rs b/src/command/build.rs index 8832cefe..8e56f9c9 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -2,7 +2,7 @@ use bindgen; use build; -use command::utils::{set_crate_path, create_pkg_dir}; +use command::utils::{create_pkg_dir, set_crate_path}; use emoji; use error::Error; use indicatif::HumanDuration; @@ -35,7 +35,7 @@ pub enum BuildMode { } /// Everything required to configure and run the `wasm-pack build` command. -#[derive(Debug,StructOpt)] +#[derive(Debug, StructOpt)] pub struct BuildOptions { /// The path to the Rust crate. pub path: Option, @@ -60,7 +60,6 @@ pub struct BuildOptions { #[structopt(long = "debug")] /// Build without --release. debug: bool, - // build config from manifest // build_config: Option, } @@ -72,10 +71,10 @@ impl From for Build { // let build_config = manifest::xxx(&crate_path).xxx(); Build { crate_path, - scope:build_opts.scope, - disable_dts:build_opts.disable_dts, - target:build_opts.target, - debug:build_opts.debug, + scope: build_opts.scope, + disable_dts: build_opts.disable_dts, + target: build_opts.target, + debug: build_opts.debug, // build_config, crate_name, } @@ -85,7 +84,7 @@ impl From for Build { type BuildStep = fn(&mut Build, &Step, &Logger) -> Result<(), Error>; impl Build { - /// Execute this `Init` command. + /// Execute this `Build` command. pub fn run(&mut self, log: &Logger, mode: BuildMode) -> Result<(), Error> { let process_steps = Build::get_process_steps(mode); @@ -148,7 +147,6 @@ impl Build { } } - fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { info!(&log, "Checking crate configuration..."); manifest::check_crate_config(&self.crate_path, step)?; diff --git a/src/command/init.rs b/src/command/init.rs index f2bef530..1fbb7af2 100644 --- a/src/command/init.rs +++ b/src/command/init.rs @@ -1,6 +1,6 @@ //! Initializing a crate for packing `.wasm`s. -use command::utils::{set_crate_path,create_pkg_dir}; +use command::utils::{create_pkg_dir, set_crate_path}; use emoji; use error::Error; use indicatif::HumanDuration; @@ -17,8 +17,6 @@ pub struct Init { scope: Option, disable_dts: bool, target: String, - // build without --release. - debug: bool, } /// `Init` options @@ -39,22 +37,16 @@ pub struct InitOptions { #[structopt(long = "target", short = "t", default_value = "browser")] /// Sets the target environment. [possible values: browser, nodejs] pub target: String, - - #[structopt(long = "debug")] - /// Build without --release. - pub debug: bool, } impl From for Init { fn from(init_opts: InitOptions) -> Self { let crate_path = set_crate_path(init_opts.path); - let crate_name = manifest::get_crate_name(&crate_path).unwrap(); - Init { + Init { crate_path, scope: init_opts.scope, - disable_dts:init_opts.disable_dts, - target:init_opts.target, - debug:init_opts.debug, + disable_dts: init_opts.disable_dts, + target: init_opts.target, } } } diff --git a/src/command/mod.rs b/src/command/mod.rs index 513dd7a2..19ced9ad 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -7,11 +7,11 @@ mod pack; mod publish; pub mod utils; +use self::build::{Build, BuildMode}; +use self::init::Init; use self::login::login; use self::pack::pack; use self::publish::publish; -use self::build::{Build,BuildMode}; -use self::init::Init; use error::Error; use slog::Logger; use std::result; diff --git a/src/command/utils.rs b/src/command/utils.rs index 650878ea..e50ba4d0 100644 --- a/src/command/utils.rs +++ b/src/command/utils.rs @@ -1,10 +1,10 @@ //! Utility functions for commands. +use emoji; use error::Error; use progressbar::Step; -use PBAR; use std::fs; -use emoji; +use PBAR; /// If an explicit path is given, then use it, otherwise assume the current /// directory is the crate path.