Skip to content

Commit 60ef4ae

Browse files
committed
config(toml): move build config into manifest
1 parent daf9588 commit 60ef4ae

File tree

5 files changed

+199
-207
lines changed

5 files changed

+199
-207
lines changed

src/command/build.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use command::utils::{create_pkg_dir, set_crate_path};
44
use emoji;
55
use error::Error;
66
use indicatif::HumanDuration;
7-
use manifest;
7+
use manifest::{self, BuildConfig};
88
use progressbar::Step;
99
use readme;
1010
use slog::Logger;
@@ -19,7 +19,7 @@ pub(crate) struct Build {
1919
pub disable_dts: bool,
2020
pub target: String,
2121
pub debug: bool,
22-
// build_config: Option<BuildConfig>,
22+
pub build_config: Option<BuildConfig>,
2323
pub crate_name: String,
2424
}
2525

@@ -60,22 +60,20 @@ pub struct BuildOptions {
6060
#[structopt(long = "debug")]
6161
/// Build without --release.
6262
debug: bool,
63-
// build config from manifest
64-
// build_config: Option<BuildConfig>,
6563
}
6664

6765
impl From<BuildOptions> for Build {
6866
fn from(build_opts: BuildOptions) -> Self {
6967
let crate_path = set_crate_path(build_opts.path);
7068
let crate_name = manifest::get_crate_name(&crate_path).unwrap();
71-
// let build_config = manifest::xxx(&crate_path).xxx();
69+
let manifest = manifest::read_cargo_toml(&crate_path).unwrap();
7270
Build {
7371
crate_path,
7472
scope: build_opts.scope,
7573
disable_dts: build_opts.disable_dts,
7674
target: build_opts.target,
7775
debug: build_opts.debug,
78-
// build_config,
76+
build_config: manifest.build_config,
7977
crate_name,
8078
}
8179
}

src/config.rs

Lines changed: 0 additions & 190 deletions
This file was deleted.

src/error.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Code related to error handling for wasm-pack
2+
use failure;
23
use serde_json;
34
use std::borrow::Cow;
45
use std::io;
@@ -95,3 +96,11 @@ impl From<toml::de::Error> for Error {
9596
Error::SerdeToml(e)
9697
}
9798
}
99+
100+
impl From<failure::Error> for Error {
101+
fn from(e: failure::Error) -> Self {
102+
Error::CrateConfig {
103+
message: e.to_string(),
104+
}
105+
}
106+
}

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ extern crate toml;
2323
pub mod bindgen;
2424
pub mod build;
2525
pub mod command;
26-
pub mod config;
2726
pub mod emoji;
2827
pub mod error;
2928
pub mod logger;

0 commit comments

Comments
 (0)