mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
feat(task): add unstable warning to deno task
(#13966)
This commit is contained in:
parent
a7bef54d3f
commit
748aff1e94
6 changed files with 14 additions and 7 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1079,9 +1079,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_task_shell"
|
name = "deno_task_shell"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fafb65c387677c45078adb3bb70503128cadd0ee94772167be4f7da8549434dc"
|
checksum = "b4b477c481d76502130fc5a212900fbe9da9520ad65c54c7e6a7cb129df082fb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"futures",
|
"futures",
|
||||||
|
|
|
@ -41,7 +41,7 @@ deno_doc = "0.32.0"
|
||||||
deno_graph = "0.24.0"
|
deno_graph = "0.24.0"
|
||||||
deno_lint = { version = "0.26.0", features = ["docs"] }
|
deno_lint = { version = "0.26.0", features = ["docs"] }
|
||||||
deno_runtime = { version = "0.48.0", path = "../runtime" }
|
deno_runtime = { version = "0.48.0", path = "../runtime" }
|
||||||
deno_task_shell = "0.1.8"
|
deno_task_shell = "0.1.9"
|
||||||
|
|
||||||
atty = "=0.2.14"
|
atty = "=0.2.14"
|
||||||
base64 = "=0.13.0"
|
base64 = "=0.13.0"
|
||||||
|
|
|
@ -25,7 +25,7 @@ itest!(task_boolean_logic {
|
||||||
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
|
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(task_exit_code_1 {
|
itest!(task_exit_code_5 {
|
||||||
args: "task --config task/deno.json exit_code_5",
|
args: "task --config task/deno.json exit_code_5",
|
||||||
output: "task/task_exit_code_5.out",
|
output: "task/task_exit_code_5.out",
|
||||||
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
|
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
|
||||||
|
|
3
cli/tests/testdata/task/task_exit_code_5.out
vendored
3
cli/tests/testdata/task/task_exit_code_5.out
vendored
|
@ -1,2 +1,3 @@
|
||||||
Task exit_code_5 echo $(echo 10 ; exit 2) && exit 5
|
Warning deno task is unstable and may drastically change in the future
|
||||||
|
Task exit_code_5 echo $(echo 10 ; exit 2) && exit 5
|
||||||
10
|
10
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
Warning deno task is unstable and may drastically change in the future
|
||||||
Task not found: non_existent
|
Task not found: non_existent
|
||||||
Available tasks:
|
Available tasks:
|
||||||
- boolean_logic
|
- boolean_logic
|
||||||
|
|
|
@ -52,6 +52,10 @@ pub async fn execute_script(
|
||||||
flags: Flags,
|
flags: Flags,
|
||||||
task_flags: TaskFlags,
|
task_flags: TaskFlags,
|
||||||
) -> Result<i32, AnyError> {
|
) -> Result<i32, AnyError> {
|
||||||
|
log::warn!(
|
||||||
|
"{} deno task is unstable and may drastically change in the future",
|
||||||
|
crate::colors::yellow("Warning"),
|
||||||
|
);
|
||||||
let flags = Arc::new(flags);
|
let flags = Arc::new(flags);
|
||||||
let ps = ProcState::build(flags.clone()).await?;
|
let ps = ProcState::build(flags.clone()).await?;
|
||||||
let tasks_config = get_tasks_config(ps.maybe_config_file.as_ref())?;
|
let tasks_config = get_tasks_config(ps.maybe_config_file.as_ref())?;
|
||||||
|
@ -81,13 +85,14 @@ pub async fn execute_script(
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(" ");
|
.join(" ");
|
||||||
let script = format!("{} {}", script, additional_args);
|
let script = format!("{} {}", script, additional_args);
|
||||||
|
let script = script.trim();
|
||||||
log::info!(
|
log::info!(
|
||||||
"{} {} {}",
|
"{} {} {}",
|
||||||
colors::green("Task"),
|
colors::green("Task"),
|
||||||
colors::cyan(&task_name),
|
colors::cyan(&task_name),
|
||||||
script
|
script,
|
||||||
);
|
);
|
||||||
let seq_list = deno_task_shell::parser::parse(&script)
|
let seq_list = deno_task_shell::parser::parse(script)
|
||||||
.with_context(|| format!("Error parsing script '{}'.", task_name))?;
|
.with_context(|| format!("Error parsing script '{}'.", task_name))?;
|
||||||
let env_vars = std::env::vars().collect::<HashMap<String, String>>();
|
let env_vars = std::env::vars().collect::<HashMap<String, String>>();
|
||||||
let exit_code = deno_task_shell::execute(seq_list, env_vars, cwd).await;
|
let exit_code = deno_task_shell::execute(seq_list, env_vars, cwd).await;
|
||||||
|
|
Loading…
Reference in a new issue