npm-check-updates 11.2.3 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,12 +11,22 @@ const getSortedVersions = async (name, declaration, options) => {
11
11
  // if present, github: is parsed as the protocol. This is not valid when passed into remote-git-tags.
12
12
  declaration = declaration.replace(/^github:/, '')
13
13
  const { auth, protocol, host, path } = parseGithubUrl(declaration)
14
- const url = `${protocol ? protocol.replace('git+', '') : 'https:'}//${auth ? auth + '@' : ''}${host}/${path}`
14
+ let tagsPromise = Promise.resolve()
15
+ const protocolKnown = protocol != null
16
+ if (protocolKnown) {
17
+ tagsPromise = tagsPromise.then(() => remoteGitTags(`${protocol ? protocol.replace('git+', '') : 'https:'}//${auth ? auth + '@' : ''}${host}/${path}`))
18
+ }
19
+ else {
20
+ // try ssh first, then https on failure
21
+ tagsPromise = tagsPromise.then(() => remoteGitTags(`ssh://git@${host}/${path}`))
22
+ .catch(() => remoteGitTags(`https://${auth ? auth + '@' : ''}${host}/${path}`))
23
+ }
24
+
15
25
  let tagMap = new Map()
16
26
 
17
27
  // fetch remote tags
18
28
  try {
19
- tagMap = await remoteGitTags(url)
29
+ tagMap = await tagsPromise
20
30
  }
21
31
  // catch a variety of errors that occur on invalid or private repos
22
32
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-check-updates",
3
- "version": "11.2.3",
3
+ "version": "11.3.0",
4
4
  "author": "Tomas Junnonen <tomas1@gmail.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [