Skip to content

Commit 92d373d

Browse files
committed
fix(gitHead): put back gitHead
This was broken by #53 or npm not having gitHead in versions anymore. fixes #64 Not exactly sure how I wrote that first version, but it was totally wrong, I think I copy-pasted something wrong
1 parent 764ee85 commit 92d373d

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

formatPkg.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export default function formatPkg(pkg) {
2525
const version = cleaned.version ? cleaned.version : '0.0.0';
2626
const versions = getVersions(cleaned);
2727
const githubRepo = cleaned.repository
28-
? getGitHubRepoInfo({ repository: cleaned.repository, versions, version })
28+
? getGitHubRepoInfo({
29+
repository: cleaned.repository,
30+
gitHead: cleaned.gitHead,
31+
})
2932
: null;
3033

3134
if (!githubRepo && !lastPublisher && !author) {
@@ -178,14 +181,7 @@ function getKeywords(cleaned) {
178181
return [];
179182
}
180183

181-
function getGitHead({ versions, version }) {
182-
if (versions[version] && versions[version].gitHead) {
183-
return versions[version].gitHead;
184-
}
185-
return 'master';
186-
}
187-
188-
function getGitHubRepoInfo({ repository, versions, version }) {
184+
function getGitHubRepoInfo({ repository, gitHead = 'master' }) {
189185
if (!repository || typeof repository !== 'string') return null;
190186

191187
const result = repository.match(
@@ -200,7 +196,7 @@ function getGitHubRepoInfo({ repository, versions, version }) {
200196
return null;
201197
}
202198

203-
const head = getGitHead({ versions, version });
199+
const head = gitHead;
204200

205201
return {
206202
user: result[1],

0 commit comments

Comments
 (0)