Skip to content

Commit be5249c

Browse files
committed
add slug to component manifest, use it if needed
1 parent 7ed1ccb commit be5249c

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

crates/cli/src/commands/components/init.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ pub async fn run(_opts: Options) -> anyhow::Result<()> {
5353
Manifest {
5454
manifest_version: manifest::MANIFEST_VERSION,
5555
component: Component {
56-
name: component_name,
56+
name: component_name.clone(),
57+
slug: Some(slug::slugify(&component_name)),
5758
version: "0.1.0".to_string(),
5859
wit_world_version: "0.4.0".to_string(),
5960
category: *component_category.value,

crates/cli/src/commands/components/push.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ pub async fn run(opts: Options) -> anyhow::Result<()> {
8383
.into_inner(),
8484
};
8585

86-
let component_slug = slug::slugify(&manifest.component.name);
86+
let component_slug = match manifest.component.slug {
87+
Some(ref slug) => slug.clone(),
88+
None => slug::slugify(&manifest.component.name),
89+
};
8790

8891
let (do_update, component) = match client
8992
.get_component_by_slug()

crates/cli/src/components/manifest.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub struct Manifest {
2222
#[serde(rename_all = "kebab-case")]
2323
pub struct Component {
2424
pub name: String,
25+
pub slug: Option<String>,
2526
pub version: String,
2627
#[serde(with = "Category")]
2728
pub category: api_types::ComponentCreateInputCategory,

0 commit comments

Comments
 (0)