Skip to content

Commit

Permalink
refactor(conventional-changelog-core): update repository-url parsing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Aug 26, 2023
1 parent fd7403a commit a05edd8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 135 deletions.
9 changes: 7 additions & 2 deletions packages/conventional-changelog-core/lib/merge-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'
const fs = require('fs/promises')
const getPkgRepo = require('get-pkg-repo')
const hostedGitInfo = require('hosted-git-info')
const parseRepositoryUrl = require('@hutson/parse-repository-url')
const gitSemverTags = require('git-semver-tags')
const normalizePackageData = require('normalize-package-data')
let gitRemoteOriginUrl
Expand Down Expand Up @@ -191,7 +192,11 @@ async function mergeConfig (options, context, gitRawCommitsOpts, parserOpts, wri
context.version = context.version || pkg.version

try {
repo = getPkgRepo(pkg)
const repositoryURL = typeof pkg.repository === 'string' ? pkg.repository : pkg.repository.url
if (repositoryURL) {
// Remove parseRepositoryUrl when https://github.com/npm/hosted-git-info/issues/39 is fixed
repo = hostedGitInfo.fromUrl(repositoryURL) || parseRepositoryUrl(repositoryURL)
}
} catch (err) {
repo = {}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/conventional-changelog-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
},
"homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core#readme",
"dependencies": {
"@hutson/parse-repository-url": "^5.0.0",
"add-stream": "^1.0.0",
"conventional-changelog-writer": "^6.0.0",
"conventional-commits-parser": "^4.0.0",
"get-pkg-repo": "^5.0.0",
"git-raw-commits": "^3.0.0",
"git-remote-origin-url": "^2.0.0",
"git-semver-tags": "^5.0.0",
"hosted-git-info": "^6.1.1",
"normalize-package-data": "^6.0.0",
"read-pkg": "^8.0.0",
"read-pkg-up": "^10.0.0"
Expand Down
146 changes: 14 additions & 132 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a05edd8

Please sign in to comment.