mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
warn if script is present but manifest does not require one
This commit is contained in:
@@ -123,14 +123,18 @@ pub async fn pack(#[context] ctx: SdkContext, #[arg] path: Option<PathBuf>) -> R
|
|||||||
})
|
})
|
||||||
.scripts({
|
.scripts({
|
||||||
let script_path = path.join(manifest.assets.scripts_path()).join("embassy.js");
|
let script_path = path.join(manifest.assets.scripts_path()).join("embassy.js");
|
||||||
if manifest.package_procedures().any(|a| a.is_script()) {
|
let needs_script = manifest.package_procedures().any(|a| a.is_script());
|
||||||
if script_path.exists() {
|
let has_script = script_path.exists();
|
||||||
Some(File::open(script_path).await?)
|
match (needs_script, has_script) {
|
||||||
} else {
|
(true, true) => Some(File::open(script_path).await?),
|
||||||
|
(true, false) => {
|
||||||
return Err(Error::new(eyre!("Script is declared in manifest, but no such script exists at ./scripts/embassy.js"), ErrorKind::Pack).into())
|
return Err(Error::new(eyre!("Script is declared in manifest, but no such script exists at ./scripts/embassy.js"), ErrorKind::Pack).into())
|
||||||
}
|
}
|
||||||
} else {
|
(false, true) => {
|
||||||
None
|
tracing::warn!("Manifest does not declare any actions that use scripts, but a script exists at ./scripts/embassy.js");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
(false, false) => None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
Reference in New Issue
Block a user