Skip to content

Commit

Permalink
fix(gitHead): put back gitHead
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Haroenv committed Sep 13, 2017
1 parent 764ee85 commit 92d373d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions formatPkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export default function formatPkg(pkg) {
const version = cleaned.version ? cleaned.version : '0.0.0';
const versions = getVersions(cleaned);
const githubRepo = cleaned.repository
? getGitHubRepoInfo({ repository: cleaned.repository, versions, version })
? getGitHubRepoInfo({
repository: cleaned.repository,
gitHead: cleaned.gitHead,
})
: null;

if (!githubRepo && !lastPublisher && !author) {
Expand Down Expand Up @@ -178,14 +181,7 @@ function getKeywords(cleaned) {
return [];
}

function getGitHead({ versions, version }) {
if (versions[version] && versions[version].gitHead) {
return versions[version].gitHead;
}
return 'master';
}

function getGitHubRepoInfo({ repository, versions, version }) {
function getGitHubRepoInfo({ repository, gitHead = 'master' }) {
if (!repository || typeof repository !== 'string') return null;

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

const head = getGitHead({ versions, version });
const head = gitHead;

return {
user: result[1],
Expand Down

0 comments on commit 92d373d

Please sign in to comment.