mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix: only enable byonm if workspace root has pkg json (#25379)
Closes #25355
This commit is contained in:
parent
b9b4b0dd67
commit
b5695d02df
7 changed files with 21 additions and 2 deletions
|
@ -1740,7 +1740,7 @@ fn resolve_node_modules_folder(
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
} else if let Some(state) = &*NPM_PROCESS_STATE {
|
} else if let Some(state) = &*NPM_PROCESS_STATE {
|
||||||
return Ok(state.local_node_modules_path.as_ref().map(PathBuf::from));
|
return Ok(state.local_node_modules_path.as_ref().map(PathBuf::from));
|
||||||
} else if workspace.package_jsons().next().is_some() {
|
} else if root_folder.pkg_json.is_some() {
|
||||||
let node_modules_dir = resolve_from_root(root_folder, cwd);
|
let node_modules_dir = resolve_from_root(root_folder, cwd);
|
||||||
if let Ok(deno_dir) = deno_dir_provider.get_or_create() {
|
if let Ok(deno_dir) = deno_dir_provider.get_or_create() {
|
||||||
// `deno_dir.root` can be symlink in macOS
|
// `deno_dir.root` can be symlink in macOS
|
||||||
|
|
|
@ -1393,7 +1393,7 @@ impl ConfigData {
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let byonm = match node_modules_dir {
|
let byonm = match node_modules_dir {
|
||||||
Some(mode) => mode == NodeModulesDirMode::Manual,
|
Some(mode) => mode == NodeModulesDirMode::Manual,
|
||||||
None => member_dir.workspace.package_jsons().next().is_some(),
|
None => member_dir.workspace.root_pkg_json().is_some(),
|
||||||
};
|
};
|
||||||
if byonm {
|
if byonm {
|
||||||
lsp_log!(" Enabled 'bring your own node_modules'.");
|
lsp_log!(" Enabled 'bring your own node_modules'.");
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "run -A pkg_json/main.ts",
|
||||||
|
"output": "pkg_json/main.out"
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"lock": false,
|
||||||
|
"workspace": ["pkg_json"]
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Download http://localhost:4260/chalk
|
||||||
|
Download http://localhost:4260/chalk/chalk-5.0.1.tgz
|
||||||
|
Hi
|
|
@ -0,0 +1,3 @@
|
||||||
|
import chalk from "chalk";
|
||||||
|
|
||||||
|
console.log(chalk.green("Hi"));
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"chalk": "*"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue