summaryrefslogtreecommitdiff
path: root/tests/registry
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-05-29 17:45:22 -0700
committerGitHub <noreply@github.com>2024-05-29 17:45:22 -0700
commita379009bfdddc56d6400740ad7be86f8930952ab (patch)
treea1198bce9d62d9c2a59073921707c31b894c8eee /tests/registry
parente084fe10a98556d4630b54bdda2ce23b3b5b8a60 (diff)
fix(cli): Prefer npm bin entries provided by packages closer to the root (#24024)
Fixes #24012. In the case of multiple packages providing a binary with a same name, we were basically leaving the results undefined (since we set up things in parallel, and whichever got set up first won). In addition, we were warning about these cases, even though it's a situation that's expected to occur. Instead, in the case of a collision in the binary names, we prefer the binary provided by the package with the least depth in the dependency tree. While I was at it, I also took moved more code to `bin_entries.rs` since it was starting to get a bit cluttered.
Diffstat (limited to 'tests/registry')
-rw-r--r--tests/registry/npm/@denotest/bin/0.7.0/cli-no-ext3
-rw-r--r--tests/registry/npm/@denotest/bin/0.7.0/cli.mjs3
-rw-r--r--tests/registry/npm/@denotest/bin/0.7.0/package.json8
-rw-r--r--tests/registry/npm/@denotest/transitive-bin/1.0.0/cli-cjs.js1
-rw-r--r--tests/registry/npm/@denotest/transitive-bin/1.0.0/package.json10
5 files changed, 25 insertions, 0 deletions
diff --git a/tests/registry/npm/@denotest/bin/0.7.0/cli-no-ext b/tests/registry/npm/@denotest/bin/0.7.0/cli-no-ext
new file mode 100644
index 000000000..1cad127ca
--- /dev/null
+++ b/tests/registry/npm/@denotest/bin/0.7.0/cli-no-ext
@@ -0,0 +1,3 @@
+#!/usr/bin/env -S node
+
+console.log("@denotest/bin 0.7.0");
diff --git a/tests/registry/npm/@denotest/bin/0.7.0/cli.mjs b/tests/registry/npm/@denotest/bin/0.7.0/cli.mjs
new file mode 100644
index 000000000..1cad127ca
--- /dev/null
+++ b/tests/registry/npm/@denotest/bin/0.7.0/cli.mjs
@@ -0,0 +1,3 @@
+#!/usr/bin/env -S node
+
+console.log("@denotest/bin 0.7.0");
diff --git a/tests/registry/npm/@denotest/bin/0.7.0/package.json b/tests/registry/npm/@denotest/bin/0.7.0/package.json
new file mode 100644
index 000000000..d66b6e34d
--- /dev/null
+++ b/tests/registry/npm/@denotest/bin/0.7.0/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@denotest/bin",
+ "version": "0.7.0",
+ "bin": {
+ "cli-esm": "./cli.mjs",
+ "cli-no-ext": "./cli-no-ext"
+ }
+}
diff --git a/tests/registry/npm/@denotest/transitive-bin/1.0.0/cli-cjs.js b/tests/registry/npm/@denotest/transitive-bin/1.0.0/cli-cjs.js
new file mode 100644
index 000000000..f517654b9
--- /dev/null
+++ b/tests/registry/npm/@denotest/transitive-bin/1.0.0/cli-cjs.js
@@ -0,0 +1 @@
+console.log("@denotest/transitive-bin 1.0.0");
diff --git a/tests/registry/npm/@denotest/transitive-bin/1.0.0/package.json b/tests/registry/npm/@denotest/transitive-bin/1.0.0/package.json
new file mode 100644
index 000000000..84d780516
--- /dev/null
+++ b/tests/registry/npm/@denotest/transitive-bin/1.0.0/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "@denotest/transitive-bin",
+ "version": "1.0.0",
+ "dependencies": {
+ "@denotest/bin": "1.0.0"
+ },
+ "bin": {
+ "cli-cjs": "cli-cjs.js"
+ }
+} \ No newline at end of file