Skip to content

Commit

Permalink
Upgrade hosted-git-info.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Mar 12, 2024
1 parent 3618b03 commit 3582fe0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 90 deletions.
4 changes: 0 additions & 4 deletions .ncurc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ module.exports = {
'p-map',
'remote-git-tags',
'untildify',
// Broken in v6.0.0
// Working upgrade is in branch 'hosted-git-info', but hold off on merging due to node engine requirements: ^14.17.0 || ^16.13.0 || >=18.0.0
// https://github.com/npm/hosted-git-info/releases/tag/v6.0.0
'hosted-git-info',
// manually keep in alignment with pacote's version of make-fetch-happen
'make-fetch-happen',
// major changes required to upgrade to v3
Expand Down
93 changes: 10 additions & 83 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"fast-memoize": "^2.5.2",
"find-up": "5.0.0",
"fp-and-or": "^1.0.2",
"hosted-git-info": "^5.1.0",
"hosted-git-info": "^7.0.1",
"ini": "^4.1.2",
"js-yaml": "^4.1.0",
"json-parse-helpfulerror": "^1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/getRepoUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import exists from './exists'
const defaultBranchPath = hostedGitInfo
.fromUrl('user/repo')
?.browse('')
.match(/(\/tree\/[a-z]+)/)?.[0]
.match(/(\/tree\/[a-zA-Z]+)/)?.[0]
const regexDefaultBranchPath = new RegExp(`${defaultBranchPath}$`)

/** Gets the repo url of an installed package. */
Expand Down
2 changes: 1 addition & 1 deletion test/getRepoUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ describe('getRepoUrl', () => {
const url = await getRepoUrl('package-name', {
repository: { url: 'http://github.com/user/repo.git', directory: 'packages/specific-package' },
})
url!.should.equal('https://github.com/user/repo/tree/master/packages/specific-package')
url!.should.equal('https://github.com/user/repo/tree/HEAD/packages/specific-package')
})
})

0 comments on commit 3582fe0

Please sign in to comment.