From 3582fe0e21a212c6b7f7712d72e3d0e03b77afd5 Mon Sep 17 00:00:00 2001 From: Raine Revere Date: Tue, 12 Mar 2024 22:16:29 +0000 Subject: [PATCH] Upgrade hosted-git-info. --- .ncurc.js | 4 -- package-lock.json | 93 +++++------------------------------------ package.json | 2 +- src/lib/getRepoUrl.ts | 2 +- test/getRepoUrl.test.ts | 2 +- 5 files changed, 13 insertions(+), 90 deletions(-) diff --git a/.ncurc.js b/.ncurc.js index 765cfd40..7813c4c4 100644 --- a/.ncurc.js +++ b/.ncurc.js @@ -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 diff --git a/package-lock.json b/package-lock.json index d19e85c6..53f29b55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,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", @@ -863,14 +863,6 @@ "node": ">= 14" } }, - "node_modules/@npmcli/agent/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/@npmcli/agent/node_modules/socks-proxy-agent": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz", @@ -922,14 +914,6 @@ "node": ">=16" } }, - "node_modules/@npmcli/git/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/@npmcli/git/node_modules/which": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", @@ -2435,14 +2419,6 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/cacache/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/cacheable-lookup": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", @@ -4733,15 +4709,14 @@ } }, "node_modules/hosted-git-info": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.2.1.tgz", - "integrity": "sha512-xIcQYMnhcx2Nr4JTjsFmwwnr9vldugPy9uVm0o87bjqqWMv9GaqsTeT+i99wTl0mk1uLxJtHxLb8kymqTENQsw==", - "license": "ISC", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", + "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", "dependencies": { - "lru-cache": "^7.5.1" + "lru-cache": "^10.0.1" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/html-escaper": { @@ -5864,12 +5839,11 @@ } }, "node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "license": "ISC", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", + "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", "engines": { - "node": ">=12" + "node": "14 || >=16.14" } }, "node_modules/make-dir": { @@ -6550,25 +6524,6 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/normalize-package-data/node_modules/hosted-git-info": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", - "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", - "dependencies": { - "lru-cache": "^10.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/normalize-package-data/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -6637,25 +6592,6 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npm-package-arg/node_modules/hosted-git-info": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", - "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", - "dependencies": { - "lru-cache": "^10.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm-package-arg/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/npm-packlist": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-8.0.0.tgz", @@ -7194,15 +7130,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", - "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", - "license": "ISC", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/path-to-regexp": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", diff --git a/package.json b/package.json index 509f0401..997631a8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/lib/getRepoUrl.ts b/src/lib/getRepoUrl.ts index 406ea584..ce3a6405 100644 --- a/src/lib/getRepoUrl.ts +++ b/src/lib/getRepoUrl.ts @@ -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. */ diff --git a/test/getRepoUrl.test.ts b/test/getRepoUrl.test.ts index 1ebf6065..579502d3 100644 --- a/test/getRepoUrl.test.ts +++ b/test/getRepoUrl.test.ts @@ -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') }) })