Skip to content

Commit bf9f9ff

Browse files
committed
feat(vcs): determined host from the git details of the existing project
1 parent c3b186c commit bf9f9ff

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/vcs-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ suite('vcs', () => {
2222
test('that the existing details are determined from the remote origin', async () => {
2323
const owner = any.word();
2424
const name = any.word();
25+
const host = any.word();
2526
const remoteUrl = any.url();
2627
const repository = any.simpleObject();
2728
const projectRoot = any.string();
2829
Repository.open.withArgs(projectRoot).resolves(repository);
2930
Remote.lookup.withArgs(repository, 'origin').resolves({url: () => remoteUrl});
30-
hostedGitInfo.fromUrl.withArgs(remoteUrl).returns({user: owner, project: name});
31+
hostedGitInfo.fromUrl.withArgs(remoteUrl).returns({user: owner, project: name, type: host});
3132

32-
assert.deepEqual(await determineExistingHostDetails({projectRoot}), {owner, name});
33+
assert.deepEqual(await determineExistingHostDetails({projectRoot}), {owner, name, host});
3334
});
3435
});
3536
});

src/vcs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import hostedGitInfo from 'hosted-git-info';
33

44
export async function determineExistingHostDetails({projectRoot}) {
55
const remoteOrigin = await Remote.lookup(await Repository.open(projectRoot), 'origin');
6-
const {user: owner, project: name} = hostedGitInfo.fromUrl(remoteOrigin.url());
6+
const {user: owner, project: name, type: host} = hostedGitInfo.fromUrl(remoteOrigin.url());
77

8-
return {owner, name};
8+
return {owner, name, host};
99
}

0 commit comments

Comments
 (0)