Skip to content

Commit

Permalink
fix: the npm template of organization cannot download
Browse files Browse the repository at this point in the history
The name of organizational package was matched as shorthand url of github.

resolve #73
  • Loading branch information
Val-istar-Guo committed Jun 9, 2019
1 parent df3cd95 commit 0c94d42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/format-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ module.exports = link => {
}

throwError('Template path cannot be found. Ensure it is an exist directory.')
} else if (githubSH.test(link)) {
if (!/^github:/.test(link)) log.warn(`Don't use '${link}' anymore. And use 'github:${link}' instead.`)
return formatRepository(`https://github.com/${link.replace(/^github:/, '')}.git`)
} else if (gitUrlRegexp.test(link)) {
return formatRepository(link)
} else if (/^npm:/.test(link) && validateNpmPackageName(link.substring('npm:'.length))) {
// npm:xxxx/xxx
return { type: 'npm', url: link, owner: '', name: link.substring('npm:'.length), path: link }
} else if (githubSH.test(link)) {
if (!/^github:/.test(link)) log.warn(`Don't use '${link}' anymore. And use 'github:${link}' instead.`)
return formatRepository(`https://github.com/${link.replace(/^github:/, '')}.git`)
}

throwError(`Invalid repository url: ${link}`)
Expand Down

0 comments on commit 0c94d42

Please sign in to comment.