diff options
Diffstat (limited to 'cli/tools/task.rs')
-rw-r--r-- | cli/tools/task.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 0110d1741..23da5b4fb 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -29,13 +29,24 @@ use std::sync::Arc; pub async fn execute_script( flags: Arc<Flags>, task_flags: TaskFlags, - using_run: bool, ) -> Result<i32, AnyError> { let factory = CliFactory::from_flags(flags); let cli_options = factory.cli_options()?; let start_dir = &cli_options.start_dir; if !start_dir.has_deno_or_pkg_json() { - bail!("deno task couldn't find deno.json(c). See https://docs.deno.com/go/config") + if task_flags.is_run { + bail!( + r#"deno run couldn't find deno.json(c). +If you meant to run a script, specify it, e.g., `deno run ./script.ts`. +To run a task, ensure the config file exists. +Examples: +- Script: `deno run ./script.ts` +- Task: `deno run dev` +See https://docs.deno.com/go/config"# + ) + } else { + bail!("deno task couldn't find deno.json(c). See https://docs.deno.com/go/config") + } } let force_use_pkg_json = std::env::var_os(crate::task_runner::USE_PKG_JSON_HIDDEN_ENV_VAR_NAME) @@ -142,7 +153,7 @@ pub async fn execute_script( } }, None => { - if using_run { + if task_flags.is_run { return Err(anyhow!("Task not found: {}", task_name)); } log::error!("Task not found: {}", task_name); |