Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
rename bundle_config to builder_config, and related names
Browse files Browse the repository at this point in the history
  • Loading branch information
xortive committed Dec 17, 2020
1 parent e5780a0 commit db9c356
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/commands/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ mod tests {
webpack_config: None,
site: None,
vars: None,
bundle_config: None,
builder_config: None,
};
assert!(kv::get_namespace_id(&target_with_dup_kv_bindings, "").is_err());
}
Expand Down
8 changes: 4 additions & 4 deletions src/settings/toml/bundle.rs → src/settings/toml/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const BUILD_COMMAND: &str = "npm run build";

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Bundle {
pub struct Builder {
// are these renames necessary? I'm not super well versed in serde
// so i'm not sure how the annotations work
#[serde(rename = "build_command")]
Expand All @@ -24,7 +24,7 @@ pub struct Bundle {
src_dir: Option<PathBuf>,
}

impl Bundle {
impl Builder {
fn dir_or_default(dir: &Option<PathBuf>, default: &str, dirname: &str) -> PathBuf {
match dir {
Some(path) => path.to_owned(),
Expand All @@ -42,7 +42,7 @@ impl Bundle {

pub fn output_dir(&self) -> Result<PathBuf, std::io::Error> {
let current_dir = env::current_dir()?;
let output_dir = current_dir.join(Bundle::dir_or_default(
let output_dir = current_dir.join(Builder::dir_or_default(
&self.output_dir,
OUTPUT_DIR,
"output dir",
Expand All @@ -52,7 +52,7 @@ impl Bundle {

pub fn src_dir(&self) -> Result<PathBuf, std::io::Error> {
let current_dir = env::current_dir()?;
let src_dir = current_dir.join(Bundle::dir_or_default(&self.src_dir, SRC_DIR, "src dir"));
let src_dir = current_dir.join(Builder::dir_or_default(&self.src_dir, SRC_DIR, "src dir"));
Ok(src_dir)
}

Expand Down
7 changes: 4 additions & 3 deletions src/settings/toml/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use serde_with::rust::string_empty_as_none;

use crate::commands::{validate_worker_name, DEFAULT_CONFIG_PATH};
use crate::deploy::{self, DeployTarget, DeploymentSet};
use crate::settings::toml::bundle::Bundle;
use crate::settings::toml::builder::Builder;
use crate::settings::toml::dev::Dev;
use crate::settings::toml::environment::Environment;
use crate::settings::toml::kv_namespace::{ConfigKvNamespace, KvNamespace};
Expand Down Expand Up @@ -41,7 +41,8 @@ pub struct Manifest {
#[serde(default, with = "string_empty_as_none")]
pub zone_id: Option<String>,
pub webpack_config: Option<String>,
pub bundle_config: Option<Bundle>,
#[serde(alias = "builder-config")]
pub builder_config: Option<Builder>,
pub private: Option<bool>,
// TODO: maybe one day, serde toml support will allow us to serialize sites
// as a TOML inline table (this would prevent confusion with environments too!)
Expand Down Expand Up @@ -297,7 +298,7 @@ impl Manifest {
kv_namespaces: get_namespaces(self.kv_namespaces.clone(), preview)?, // Not inherited
site: self.site.clone(), // Inherited
vars: self.vars.clone(), // Not inherited
bundle_config: self.bundle_config.clone(), // lol idk what this inherit stuff means
builder_config: self.builder_config.clone(), // lol idk what this inherit stuff means
};

let environment = self.get_environment(environment_name)?;
Expand Down
4 changes: 2 additions & 2 deletions src/settings/toml/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod bundle;
mod builder;
mod dev;
mod environment;
mod kv_namespace;
Expand All @@ -9,7 +9,7 @@ mod target;
mod target_type;
mod triggers;

pub use bundle::Bundle;
pub use builder::Builder;
pub use environment::Environment;
pub use kv_namespace::{ConfigKvNamespace, KvNamespace};
pub use manifest::Manifest;
Expand Down
4 changes: 2 additions & 2 deletions src/settings/toml/target.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::bundle::Bundle;
use super::builder::Builder;
use super::kv_namespace::KvNamespace;
use super::site::Site;
use super::target_type::TargetType;
Expand All @@ -15,7 +15,7 @@ pub struct Target {
pub name: String,
pub target_type: TargetType,
pub webpack_config: Option<String>,
pub bundle_config: Option<Bundle>,
pub builder_config: Option<Builder>,
pub site: Option<Site>,
pub vars: Option<HashMap<String, String>>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/sites/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ mod tests {
target_type: TargetType::JavaScript,
webpack_config: None,
site: Some(site),
bundle_config: None,
builder_config: None,
vars: None,
}
}
Expand Down

0 comments on commit db9c356

Please sign in to comment.