Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 12 additions & 36 deletions src/config/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,17 @@ impl<R: BufRead> Prompter<R> {
&under(&path, "CHANGELOG.md"),
);

package_config(
PackageConfig {
name,
path,
vec![VersionedFile {
versioned_files: vec![VersionedFile {
path: version_file_path,
format: parse_file_format(&format_str),
selector: None,
}],
changelog,
)
changelog: Some(changelog),
..Default::default()
}
}

fn discovered(&mut self, found: &[DiscoveredPackage]) -> Option<Vec<PackageConfig>> {
Expand Down Expand Up @@ -167,43 +168,18 @@ impl<R: BufRead> Prompter<R> {
}
}

fn package_config(
name: String,
path: String,
versioned_files: Vec<VersionedFile>,
changelog: String,
) -> PackageConfig {
PackageConfig {
name,
path,
versioned_files,
changelog: Some(changelog),
shared_paths: Vec::new(),
depends_on: vec![],
versioning: None,
tag_template: None,
version_template: None,
hooks: None,
floating_tags: None,
latest_tag: None,
build_metadata: None,
publishers: vec![],
update_lockfiles: None,
version_source: None,
}
}

fn discovered_package(found: &DiscoveredPackage) -> PackageConfig {
package_config(
found.name.clone(),
found.path.clone(),
vec![VersionedFile {
PackageConfig {
name: found.name.clone(),
path: found.path.clone(),
versioned_files: vec![VersionedFile {
path: under(&found.path, found.manifest),
format: found.format.clone(),
selector: None,
}],
under(&found.path, "CHANGELOG.md"),
)
changelog: Some(under(&found.path, "CHANGELOG.md")),
..Default::default()
}
}

const ALLOWED_FORMATS: &[&str] = &["toml", "json", "xml", "gradle", "gomod", "txt"];
Expand Down
13 changes: 1 addition & 12 deletions src/config/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,7 @@ pub fn build_config_from_releaserc(raw: &str) -> Result<(Config, MigrationReport
selector: None,
}],
changelog: Some(changelog.unwrap_or_else(|| "CHANGELOG.md".to_string())),
shared_paths: Vec::new(),
depends_on: vec![],
versioning: None,
tag_template: None,
version_template: None,
hooks: None,
floating_tags: None,
latest_tag: None,
build_metadata: None,
publishers: vec![],
update_lockfiles: None,
version_source: None,
..Default::default()
};

report.warnings.push(
Expand Down
13 changes: 1 addition & 12 deletions src/config/migrate/changesets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,7 @@ fn scaffold_package(name: String, path: String) -> PackageConfig {
selector: None,
}],
changelog: Some(changelog),
shared_paths: Vec::new(),
depends_on: vec![],
versioning: None,
tag_template: None,
version_template: None,
hooks: None,
floating_tags: None,
latest_tag: None,
build_metadata: None,
publishers: vec![],
update_lockfiles: None,
version_source: None,
..Default::default()
}
}

Expand Down
13 changes: 1 addition & 12 deletions src/config/migrate/release_please.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,7 @@ fn build_package(
.clone()
.unwrap_or_else(|| "CHANGELOG.md".to_string()),
),
shared_paths: Vec::new(),
depends_on: vec![],
versioning: None,
tag_template: None,
version_template: None,
hooks: None,
floating_tags: None,
latest_tag: None,
build_metadata: None,
publishers: vec![],
update_lockfiles: None,
version_source: None,
..Default::default()
}
}

Expand Down
13 changes: 1 addition & 12 deletions src/config/migrate/standard_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,7 @@ pub(super) fn build(raw: &str) -> Result<(Config, MigrationReport)> {
path: ".".to_string(),
versioned_files,
changelog: Some("CHANGELOG.md".to_string()),
shared_paths: Vec::new(),
depends_on: vec![],
versioning: None,
tag_template: None,
version_template: None,
hooks: None,
floating_tags: None,
latest_tag: None,
build_metadata: None,
publishers: vec![],
update_lockfiles: None,
version_source: None,
..Default::default()
};

report.warnings.push(
Expand Down
13 changes: 1 addition & 12 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,7 @@ impl Config {
path: ".".to_string(),
versioned_files,
changelog: Some("CHANGELOG.md".to_string()),
shared_paths: Vec::new(),
depends_on: vec![],
versioning: None,
tag_template: None,
version_template: None,
hooks: None,
floating_tags: None,
latest_tag: None,
build_metadata: None,
publishers: vec![],
update_lockfiles: None,
version_source: None,
..Default::default()
}]
},
}
Expand Down
16 changes: 2 additions & 14 deletions src/config/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::conventional_commits::BumpType;
use super::types::{BuildMetadata, HooksConfig, PublisherConfig, VersionSourcePolicy};
use super::workspace::WorkspaceConfig;

#[derive(Debug, Deserialize, Serialize, Clone)]
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
pub struct PackageConfig {
pub name: String,
#[serde(default)]
Expand Down Expand Up @@ -384,22 +384,10 @@ mod tests {

fn pkg(path: &str, shared: &[&str]) -> PackageConfig {
PackageConfig {
build_metadata: None,
version_source: None,
name: "api".to_string(),
path: path.to_string(),
versioned_files: Vec::new(),
changelog: None,
shared_paths: shared.iter().map(|s| s.to_string()).collect(),
depends_on: Vec::new(),
versioning: None,
tag_template: None,
version_template: None,
floating_tags: None,
latest_tag: None,
hooks: None,
publishers: Vec::new(),
update_lockfiles: None,
..Default::default()
}
}

Expand Down
Loading
Loading