diff --git a/Cargo.lock b/Cargo.lock index cfc84d6..0ad98a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -144,7 +144,7 @@ dependencies = [ [[package]] name = "asphalt" -version = "2.0.0" +version = "2.0.1" dependencies = [ "anyhow", "assert_cmd", diff --git a/Cargo.toml b/Cargo.toml index bddef66..d1e11fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "asphalt" -version = "2.0.0" +version = "2.0.1" edition = "2024" description = "Upload and reference Roblox assets in code" readme = "README.md" diff --git a/README.md b/README.md index 0cb3861..c3533a1 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,8 @@ output_path = "src/shared" - A glob pattern to match files to upload. - `output_path`: string - The directory path to output the generated code. +- `output_basename`: string + - The filename of the generated files. Defaults to the input's name. - `web`: map - A map of paths relative to the input path to existing assets on Roblox. - `bleed`: boolean (optional) diff --git a/schema.json b/schema.json index b1eb540..393b2f2 100644 --- a/schema.json +++ b/schema.json @@ -105,6 +105,13 @@ "type": "boolean", "default": true }, + "output_basename": { + "description": "The basename of the file to output the generated code", + "type": [ + "string", + "null" + ] + }, "output_path": { "description": "The directory path to output the generated code", "type": "string" diff --git a/src/config.rs b/src/config.rs index 8db4f58..5a48db9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -86,6 +86,9 @@ pub struct Input { /// The directory path to output the generated code pub output_path: PathBuf, + /// The basename of the file to output the generated code + pub output_basename: Option, + /// Enable alpha bleeding images. Keep in mind that changing this setting won't invalidate your lockfile or reupload your images #[serde(default = "default_true")] pub bleed: bool, diff --git a/src/sync/mod.rs b/src/sync/mod.rs index ef8af27..e4dcff2 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -147,7 +147,9 @@ pub async fn sync(args: SyncArgs, mp: MultiProgress) -> anyhow::Result<()> { let output_path = config.project_dir.join(&input.output_path); fs::create_dir_all(&output_path).await?; - fs::write(output_path.join(format!("{input_name}.{ext}")), code).await?; + + let base_name = &input.output_basename.as_deref().unwrap_or(&input_name); + fs::write(output_path.join(format!("{base_name}.{ext}")), code).await?; } }