Skip to content

Commit 69b0c01

Browse files
authored
Merge pull request #1164 from zpratt/fix-hosted-github
2 parents 9ce50a4 + 6584c7d commit 69b0c01

File tree

4 files changed

+53
-7
lines changed

4 files changed

+53
-7
lines changed

package-lock.json

Lines changed: 47 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"@form8ion/project": "^18.0.0",
5555
"@form8ion/results-reporter": "^1.1.0",
5656
"@travi/cli-messages": "^1.0.4",
57-
"hosted-git-info": "^7.0.0",
57+
"git-url-parse": "^14.0.0",
5858
"simple-git": "^3.16.0"
5959
},
6060
"devDependencies": {

src/vcs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {simpleGit} from 'simple-git';
2-
import hostedGitInfo from 'hosted-git-info';
2+
import GitUrlParse from 'git-url-parse';
33

44
export async function determineExistingHostDetails({projectRoot}) {
55
const git = simpleGit(projectRoot);
66
const remoteOrigin = await git.remote(['get-url', 'origin']);
7-
const {user: owner, project: name, type: host} = hostedGitInfo.fromUrl(remoteOrigin);
7+
const {user: owner, project: name, type: host} = GitUrlParse(remoteOrigin);
88

99
return {owner, name, host};
1010
}

src/vcs.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as simpleGit from 'simple-git';
2-
import hostedGitInfo from 'hosted-git-info';
2+
import GitUrlParse from 'git-url-parse';
33

44
import {afterEach, describe, expect, it, vi} from 'vitest';
55
import any from '@travi/any';
@@ -8,7 +8,7 @@ import {when} from 'jest-when';
88
import {determineExistingHostDetails} from './vcs.js';
99

1010
vi.mock('simple-git');
11-
vi.mock('hosted-git-info');
11+
vi.mock('git-url-parse');
1212

1313
describe('vcs', () => {
1414
afterEach(() => {
@@ -24,7 +24,7 @@ describe('vcs', () => {
2424
const remote = vi.fn();
2525
when(simpleGit.simpleGit).calledWith(projectRoot).mockReturnValue({remote});
2626
when(remote).calledWith(['get-url', 'origin']).mockResolvedValue(remoteUrl);
27-
when(hostedGitInfo.fromUrl).calledWith(remoteUrl).mockReturnValue({user: owner, project: name, type: host});
27+
when(GitUrlParse).calledWith(remoteUrl).mockReturnValue({user: owner, project: name, type: host});
2828

2929
expect(await determineExistingHostDetails({projectRoot})).toEqual({owner, name, host});
3030
});

0 commit comments

Comments
 (0)