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_basic_auth/.npmrc | 4 ++++ tests/specs/npm/npmrc_basic_auth/__test__.jsonc | 13 +++++++++++++ tests/specs/npm/npmrc_basic_auth/install.out | 9 +++++++++ tests/specs/npm/npmrc_basic_auth/main.js | 8 ++++++++ tests/specs/npm/npmrc_basic_auth/main.out | 3 +++ tests/specs/npm/npmrc_basic_auth/package.json | 8 ++++++++ 6 files changed, 45 insertions(+) create mode 100644 tests/specs/npm/npmrc_basic_auth/.npmrc create mode 100644 tests/specs/npm/npmrc_basic_auth/__test__.jsonc create mode 100644 tests/specs/npm/npmrc_basic_auth/install.out create mode 100644 tests/specs/npm/npmrc_basic_auth/main.js create mode 100644 tests/specs/npm/npmrc_basic_auth/main.out create mode 100644 tests/specs/npm/npmrc_basic_auth/package.json (limited to 'tests/specs/npm/npmrc_basic_auth') diff --git a/tests/specs/npm/npmrc_basic_auth/.npmrc b/tests/specs/npm/npmrc_basic_auth/.npmrc new file mode 100644 index 000000000..0624091f0 --- /dev/null +++ b/tests/specs/npm/npmrc_basic_auth/.npmrc @@ -0,0 +1,4 @@ +@denotest:registry=http://127.0.0.1:4261/ +//127.0.0.1:4261/denotest/:_authToken=private-reg-token +@denotest2:registry=http://127.0.0.1:4262/ +//127.0.0.1:4262/denotest2/:_authToken=private-reg-token2 diff --git a/tests/specs/npm/npmrc_basic_auth/__test__.jsonc b/tests/specs/npm/npmrc_basic_auth/__test__.jsonc new file mode 100644 index 000000000..44298ed2f --- /dev/null +++ b/tests/specs/npm/npmrc_basic_auth/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "envs": { + "DENO_FUTURE": "1" + }, + "tempDir": true, + "steps": [{ + "args": "install", + "output": "install.out" + }, { + "args": "run -A main.js", + "output": "main.out" + }] +} diff --git a/tests/specs/npm/npmrc_basic_auth/install.out b/tests/specs/npm/npmrc_basic_auth/install.out new file mode 100644 index 000000000..7484405db --- /dev/null +++ b/tests/specs/npm/npmrc_basic_auth/install.out @@ -0,0 +1,9 @@ +⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag. +[UNORDERED_START] +Download http://127.0.0.1:4261/@denotest/basic +Download http://127.0.0.1:4262/@denotest2/basic +Download http://localhost:4261/@denotest/basic/1.0.0.tgz +Download http://localhost:4262/@denotest2/basic/1.0.0.tgz +Initialize @denotest2/basic@1.0.0 +Initialize @denotest/basic@1.0.0 +[UNORDERED_END] diff --git a/tests/specs/npm/npmrc_basic_auth/main.js b/tests/specs/npm/npmrc_basic_auth/main.js new file mode 100644 index 000000000..66b393636 --- /dev/null +++ b/tests/specs/npm/npmrc_basic_auth/main.js @@ -0,0 +1,8 @@ +import { getValue, setValue } from "@denotest/basic"; +import * as test from "@denotest2/basic"; + +console.log(getValue()); +setValue(42); +console.log(getValue()); + +console.log(test.getValue()); diff --git a/tests/specs/npm/npmrc_basic_auth/main.out b/tests/specs/npm/npmrc_basic_auth/main.out new file mode 100644 index 000000000..bbe210bdb --- /dev/null +++ b/tests/specs/npm/npmrc_basic_auth/main.out @@ -0,0 +1,3 @@ +0 +42 +0 diff --git a/tests/specs/npm/npmrc_basic_auth/package.json b/tests/specs/npm/npmrc_basic_auth/package.json new file mode 100644 index 000000000..274d1ed7f --- /dev/null +++ b/tests/specs/npm/npmrc_basic_auth/package.json @@ -0,0 +1,8 @@ +{ + "name": "npmrc_test", + "version": "0.0.1", + "dependencies": { + "@denotest/basic": "1.0.0", + "@denotest2/basic": "1.0.0" + } +} -- cgit v1.2.3