From 959739f609dddacde3bbe9ecede2f409214fb34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 23 May 2024 22:26:23 +0100 Subject: FUTURE: initial support for .npmrc file (#23560) This commit adds initial support for ".npmrc" files. Currently we only discover ".npmrc" files next to "package.json" files and discovering these files in user home dir is left for a follow up. This pass supports "_authToken" and "_auth" configuration for providing authentication. LSP support has been left for a follow up PR. Towards https://github.com/denoland/deno/issues/16105 --- tests/specs/npm/npmrc_not_next_to_package_json/.npmrc | 2 ++ tests/specs/npm/npmrc_not_next_to_package_json/__test__.jsonc | 9 +++++++++ tests/specs/npm/npmrc_not_next_to_package_json/main.out | 6 ++++++ tests/specs/npm/npmrc_not_next_to_package_json/subdir/main.js | 5 +++++ .../specs/npm/npmrc_not_next_to_package_json/subdir/package.json | 7 +++++++ 5 files changed, 29 insertions(+) create mode 100644 tests/specs/npm/npmrc_not_next_to_package_json/.npmrc create mode 100644 tests/specs/npm/npmrc_not_next_to_package_json/__test__.jsonc create mode 100644 tests/specs/npm/npmrc_not_next_to_package_json/main.out create mode 100644 tests/specs/npm/npmrc_not_next_to_package_json/subdir/main.js create mode 100644 tests/specs/npm/npmrc_not_next_to_package_json/subdir/package.json (limited to 'tests/specs/npm/npmrc_not_next_to_package_json') diff --git a/tests/specs/npm/npmrc_not_next_to_package_json/.npmrc b/tests/specs/npm/npmrc_not_next_to_package_json/.npmrc new file mode 100644 index 000000000..18887e8d3 --- /dev/null +++ b/tests/specs/npm/npmrc_not_next_to_package_json/.npmrc @@ -0,0 +1,2 @@ +@denotest:registry=http://127.0.0.1:4261/ +//127.0.0.1:4261/denotest/:_authToken=private-reg-token diff --git a/tests/specs/npm/npmrc_not_next_to_package_json/__test__.jsonc b/tests/specs/npm/npmrc_not_next_to_package_json/__test__.jsonc new file mode 100644 index 000000000..fa545c290 --- /dev/null +++ b/tests/specs/npm/npmrc_not_next_to_package_json/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "envs": { + "DENO_FUTURE": "1" + }, + "tempDir": true, + "args": "install -A -L debug", + "output": "main.out", + "cwd": "subdir" +} diff --git a/tests/specs/npm/npmrc_not_next_to_package_json/main.out b/tests/specs/npm/npmrc_not_next_to_package_json/main.out new file mode 100644 index 000000000..8f42fb6d8 --- /dev/null +++ b/tests/specs/npm/npmrc_not_next_to_package_json/main.out @@ -0,0 +1,6 @@ +[# This test is still downloading code, because we have a private registry] +[# that serves the same packages. The important bit is the message below.] +[WILDCARD] No .npmrc file found +[WILDCARD] +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/npm/npmrc_not_next_to_package_json/subdir/main.js b/tests/specs/npm/npmrc_not_next_to_package_json/subdir/main.js new file mode 100644 index 000000000..81dd521da --- /dev/null +++ b/tests/specs/npm/npmrc_not_next_to_package_json/subdir/main.js @@ -0,0 +1,5 @@ +import { getValue, setValue } from "@denotest/esm-basic"; + +console.log(getValue()); +setValue(42); +console.log(getValue()); diff --git a/tests/specs/npm/npmrc_not_next_to_package_json/subdir/package.json b/tests/specs/npm/npmrc_not_next_to_package_json/subdir/package.json new file mode 100644 index 000000000..99feed9d8 --- /dev/null +++ b/tests/specs/npm/npmrc_not_next_to_package_json/subdir/package.json @@ -0,0 +1,7 @@ +{ + "name": "npmrc_test", + "version": "0.0.1", + "dependencies": { + "@denotest/esm-basic": "1.0.0" + } +} -- cgit v1.2.3