Skip to content

Commit

Permalink
fix(install/global): warn about not including auto-discovered config …
Browse files Browse the repository at this point in the history
…file (#27745)

Closes #17855
  • Loading branch information
dsherret authored and bartlomieju committed Jan 30, 2025
1 parent 14081fb commit 690da47
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli/tools/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ async fn install_global(
.load_and_type_check_files(&[install_flags_global.module_url.clone()])
.await?;

if matches!(flags.config_flag, ConfigFlag::Discover)
&& cli_options.workspace().deno_jsons().next().is_some()
{
log::warn!("{} discovered config file will be ignored in the installed command. Use the --config flag if you wish to include it.", crate::colors::yellow("Warning"));
}

// create the install shim
create_install_shim(http_client, &flags, install_flags_global).await
}
Expand Down
5 changes: 5 additions & 0 deletions tests/specs/install/global/warn_config_file/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tempDir": true,
"args": "install --root ./bins -g --name my-cli main.js",
"output": "install.out"
}
2 changes: 2 additions & 0 deletions tests/specs/install/global/warn_config_file/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
3 changes: 3 additions & 0 deletions tests/specs/install/global/warn_config_file/install.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Warning discovered config file will be ignored in the installed command. Use the --config flag if you wish to include it.
✅ Successfully installed my-cli
[WILDCARD]
1 change: 1 addition & 0 deletions tests/specs/install/global/warn_config_file/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(1);

0 comments on commit 690da47

Please sign in to comment.