From 214bdbbc2b09ab3f56f0ffe1ad5930d48ec0c76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 23 Feb 2023 16:41:28 +0100 Subject: [PATCH] feat(task): add warning about package.json scripts support (#17900) --- cli/tests/testdata/task/both/package_json_selected.out | 2 ++ cli/tests/testdata/task/npx/non_existent.out | 2 ++ cli/tests/testdata/task/npx/on_own.out | 2 ++ cli/tests/testdata/task/package_json/bin.out | 2 ++ cli/tools/task.rs | 5 +++++ 5 files changed, 13 insertions(+) diff --git a/cli/tests/testdata/task/both/package_json_selected.out b/cli/tests/testdata/task/both/package_json_selected.out index 76b3a9227b7d27..1d6c7dade617be 100644 --- a/cli/tests/testdata/task/both/package_json_selected.out +++ b/cli/tests/testdata/task/both/package_json_selected.out @@ -1,5 +1,7 @@ Download http://localhost:4545/npm/registry/@denotest/bin Download http://localhost:4545/npm/registry/@denotest/bin/1.0.0.tgz +Warning Currently only basic package.json `scripts` are supported. +Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in the upcoming release. Task bin cli-esm testing this out "asdf" testing this diff --git a/cli/tests/testdata/task/npx/non_existent.out b/cli/tests/testdata/task/npx/non_existent.out index 5df04917e69cdc..6664357872c85e 100644 --- a/cli/tests/testdata/task/npx/non_existent.out +++ b/cli/tests/testdata/task/npx/non_existent.out @@ -1,2 +1,4 @@ +Warning Currently only basic package.json `scripts` are supported. +Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in the upcoming release. Task non-existent npx this-command-should-not-exist-for-you npx: could not resolve command 'this-command-should-not-exist-for-you' diff --git a/cli/tests/testdata/task/npx/on_own.out b/cli/tests/testdata/task/npx/on_own.out index 67491f7b0acb6e..9d4184fbf69f9b 100644 --- a/cli/tests/testdata/task/npx/on_own.out +++ b/cli/tests/testdata/task/npx/on_own.out @@ -1,2 +1,4 @@ +Warning Currently only basic package.json `scripts` are supported. +Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in the upcoming release. Task on-own npx npx: missing command diff --git a/cli/tests/testdata/task/package_json/bin.out b/cli/tests/testdata/task/package_json/bin.out index ed1b6b8a2dc51a..bc4687e30576dd 100644 --- a/cli/tests/testdata/task/package_json/bin.out +++ b/cli/tests/testdata/task/package_json/bin.out @@ -1,6 +1,8 @@ Download http://localhost:4545/npm/registry/@denotest/bin Download http://localhost:4545/npm/registry/@denotest/bin/0.5.0.tgz Download http://localhost:4545/npm/registry/@denotest/bin/1.0.0.tgz +Warning Currently only basic package.json `scripts` are supported. +Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in the upcoming release. Task bin @denotest/bin hi && cli-esm testing this out && npx cli-cjs test "extra" hi testing diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 523f2bc888c5a7..0eb0d14e3cc784 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -71,6 +71,11 @@ pub async fn execute_script( .to_owned(), }; let script = get_script_with_args(script, &ps); + log::info!( + "{} Currently only basic package.json `scripts` are supported.", + colors::yellow("Warning"), + ); + log::info!("{}", colors::gray("Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in the upcoming release.")); output_task(task_name, &script); let seq_list = deno_task_shell::parser::parse(&script) .with_context(|| format!("Error parsing script '{task_name}'."))?;