From 69afa8718f322cf2ef5f5cf5bcecb10f1122f490 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:03:41 -0700 Subject: [PATCH] chore: tweak warning message for un-run install scripts (#24508) Previously when we printed out the packages that skipped install scripts, we didn't prefix them with `npm:`. When you pass `--allow-scripts` though, we require `npm:`, which means you can't just copy paste the package name from the warning message. --- cli/npm/managed/resolvers/local.rs | 2 +- tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run.out | 2 +- .../lifecycle_scripts/future_install_all_lifecycles_not_run.out | 2 +- tests/specs/npm/lifecycle_scripts/node_gyp_not_run.out | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/npm/managed/resolvers/local.rs b/cli/npm/managed/resolvers/local.rs index 913cf986d6..f73ba95ac8 100644 --- a/cli/npm/managed/resolvers/local.rs +++ b/cli/npm/managed/resolvers/local.rs @@ -721,7 +721,7 @@ async fn sync_resolution_with_fs( }; let packages = packages_with_scripts_not_run .iter() - .map(|p| p.to_string()) + .map(|p| format!("npm:{p}")) .collect::>() .join(", "); log::warn!("{}: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed. diff --git a/tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run.out b/tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run.out index cc42cddeef..0792674145 100644 --- a/tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run.out +++ b/tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run.out @@ -9,4 +9,4 @@ Initialize @denotest/bin@1.0.0 warning: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed. This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` (e.g. `deno cache --allow-scripts=pkg1,pkg2 `): - @denotest/node-lifecycle-scripts@1.0.0 + npm:@denotest/node-lifecycle-scripts@1.0.0 diff --git a/tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles_not_run.out b/tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles_not_run.out index e7033229b9..8db36055f8 100644 --- a/tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles_not_run.out +++ b/tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles_not_run.out @@ -10,4 +10,4 @@ Initialize @denotest/bin@1.0.0 warning: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed. This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install` (e.g. `deno cache --allow-scripts=pkg1,pkg2 ` or `deno install --allow-scripts=pkg1,pkg2`): - @denotest/node-lifecycle-scripts@1.0.0 + npm:@denotest/node-lifecycle-scripts@1.0.0 diff --git a/tests/specs/npm/lifecycle_scripts/node_gyp_not_run.out b/tests/specs/npm/lifecycle_scripts/node_gyp_not_run.out index 86bdeaefec..c718e7c862 100644 --- a/tests/specs/npm/lifecycle_scripts/node_gyp_not_run.out +++ b/tests/specs/npm/lifecycle_scripts/node_gyp_not_run.out @@ -4,6 +4,6 @@ Download http://localhost:4260/node-gyp warning: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed. This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` (e.g. `deno cache --allow-scripts=pkg1,pkg2 `): - @denotest/node-addon@1.0.0 + npm:@denotest/node-addon@1.0.0 error: Uncaught (in promise) Error: Cannot find module './build/Release/node_addon' [WILDCARD]