diff options
author | Gar <gar+gh@danger.computer> | 2022-05-09 17:34:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 17:34:54 +0300 |
commit | 38cf29a0054544c575b6bce953f1d433dbb6a3b5 (patch) | |
tree | a11da84754f3b87a398d4f58a11c485df6b10db2 /tap-snapshots | |
parent | 48d2db6037487fd782f67bbcd2cf12e009ece17b (diff) |
fix: cleanup star/unstar (#4868)
It was querying whoami once for every package you starred/unstarred, and
incorrectly trying to determine if you weren't logged in. In fact the
function throws a descriptive message if you're not logged in already.
The whoami check was also racing with the fetch of the packument for
each package you were starring/unstarring meaning you could also get a
random 401 for a private package instead of the 'you need to log in'
message.
unstar was setting an undocumented config item to get the
shared code to unstar. The command already has a name attribute that
tells us what action we are doing so we can just use that.
Finally, the duplicated (and differing) params between the two commands
were consolidated.
Diffstat (limited to 'tap-snapshots')
-rw-r--r-- | tap-snapshots/test/lib/load-all-commands.js.test.cjs | 2 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/npm-usage.js.test.cjs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index eccb06580..67606be07 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -828,7 +828,7 @@ Usage: npm star [<pkg>...] Options: -[--registry <registry>] [--unicode] +[--registry <registry>] [--unicode] [--otp <otp>] Run "npm help star" for more info ` diff --git a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index d7ec4953d..637999134 100644 --- a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -862,7 +862,7 @@ All commands: npm star [<pkg>...] Options: - [--registry <registry>] [--unicode] + [--registry <registry>] [--unicode] [--otp <otp>] Run "npm help star" for more info |