Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-05-09 19:26:35 +0300
committerGitHub <noreply@github.com>2022-05-09 19:26:35 +0300
commit5baa4a7c64319485604982f9060702a7cee8a85c (patch)
tree55ce901dbe1db23e519a703dac66e1b3f1142b3b /lib/utils
parent86f443e97aa58c1a06b8eb6f523656274234bb71 (diff)
fix: consolidate bugs, docs, repo command logic (#4857)
All three of these commands do the same thing: open a manifest and find a url inside to open it. The finding of that manifest was not very consistent across these three commands. Some work with workspaces while others don't. Some work correctly with `--prefix` while others don't. This PR consolidates these commands so that they all are consistent in how they find the manifest being referenced. The specifics of which url they open are still left to each command. The util that only these three commands were using was consolidated into their base class.
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/hosted-git-info-from-manifest.js14
1 files changed, 0 insertions, 14 deletions
diff --git a/lib/utils/hosted-git-info-from-manifest.js b/lib/utils/hosted-git-info-from-manifest.js
deleted file mode 100644
index 9592b0b3a..000000000
--- a/lib/utils/hosted-git-info-from-manifest.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// given a manifest, try to get the hosted git info from it based on
-// repository (if a string) or repository.url (if an object)
-// returns null if it's not a valid repo, or not a known hosted repo
-const hostedGitInfo = require('hosted-git-info')
-module.exports = mani => {
- const r = mani.repository
- const rurl = !r ? null
- : typeof r === 'string' ? r
- : typeof r === 'object' && typeof r.url === 'string' ? r.url
- : null
-
- // hgi returns undefined sometimes, but let's always return null here
- return (rurl && hostedGitInfo.fromUrl(rurl.replace(/^git\+/, ''))) || null
-}