Skip to content

Commit

Permalink
only enable with DENO_FUTURE
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed May 6, 2024
1 parent 74d794c commit 4186e73
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@ fn discover_npmrc(
maybe_package_json_path: Option<PathBuf>,
maybe_deno_json_path: Option<PathBuf>,
) -> Result<Arc<ResolvedNpmRc>, AnyError> {
// Only support discovering `.npmrc` with `DENO_FUTURE` to not break existing
// workflows.
if !*DENO_FUTURE {
return Ok(create_default_npmrc());
}

const NPMRC_NAME: &str = ".npmrc";

fn get_env_var(var_name: &str) -> Option<String> {
Expand Down
3 changes: 3 additions & 0 deletions tests/specs/npm/npmrc/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"tempDir": true,
"args": "run -A main.js",
"envs": {
"DENO_FUTURE": "1"
},
"output": "main.out"
}
5 changes: 4 additions & 1 deletion tests/specs/npm/npmrc_bad_token/__test__.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"tempDir": true,
"args": "run -A main.js",
"output": "main.out",
"exitCode": 1
"exitCode": 1,
"envs": {
"DENO_FUTURE": "1"
}
}
5 changes: 4 additions & 1 deletion tests/specs/npm/npmrc_deno_json/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"tempDir": true,
"args": "run -A main.js",
"output": "main.out"
"output": "main.out",
"envs": {
"DENO_FUTURE": "1"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"tempDir": true,
"args": "run -A -L debug subdir/main.js",
"output": "main.out"
"output": "main.out",
"envs": {
"DENO_FUTURE": "1"
}
}

0 comments on commit 4186e73

Please sign in to comment.