Skip to content

Commit

Permalink
Remove semicolons
Browse files Browse the repository at this point in the history
No longer required with latest version of standard
  • Loading branch information
cookpete committed Sep 9, 2016
1 parent c6b1b18 commit 2ff61e2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
14 changes: 7 additions & 7 deletions src/templates/Compact.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ import Default from './Default'
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

export default class Compact extends Default {
mergesTitle = null;
fixesTitle = null;
commitsTitle = null;
mergesTitle = null
fixesTitle = null
commitsTitle = null

minimumChangeCount = 3;
listSpacing = '\n';
minimumChangeCount = 3
listSpacing = '\n'

renderReleaseHeading = (release, previousRelease) => {
const title = this.renderReleaseTitle(release, previousRelease)
const date = release.tag ? `\n> ${this.formatDate(release.date)}` : ''
return `#### ${title}${date}\n`
};
}

formatDate = (string) => {
const date = new Date(string)
const day = date.getDate()
const month = months[date.getMonth()]
const year = date.getFullYear()
return `${day} ${month} ${year}`
};
}
}
52 changes: 26 additions & 26 deletions src/templates/Default.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
// https://github.com/olivierlacan/keep-a-changelog

export default class Default {
logHeader = '# Change Log\nAll notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).\n\nGenerated by [auto-changelog](https://github.com/CookPete/auto-changelog)';
logHeader = '# Change Log\nAll notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).\n\nGenerated by [auto-changelog](https://github.com/CookPete/auto-changelog)'

unreleasedTitle = 'Unreleased';
mergesTitle = 'Merged';
fixesTitle = 'Fixed';
commitsTitle = 'Commits';
unreleasedTitle = 'Unreleased'
mergesTitle = 'Merged'
fixesTitle = 'Fixed'
commitsTitle = 'Commits'

commitListLimit = 3;
commitHashLength = 7;
minimumChangeCount = 1; // Minimum number of changes to show per release
commitListLimit = 3
commitHashLength = 7
minimumChangeCount = 1 // Minimum number of changes to show per release

sectionSpacing = '\n\n\n';
listSpacing = '\n\n';
sectionSpacing = '\n\n\n'
listSpacing = '\n\n'

constructor (origin) {
this.origin = `https://${origin.host}/${origin.repo}`
};
}

render = (releases) => {
return [
this.logHeader,
releases.map(this.renderRelease).join(this.sectionSpacing)
].join(this.sectionSpacing) + '\n'
};
}

renderRelease = (release, index, releases) => {
const previousRelease = releases[index + 1]
Expand All @@ -38,26 +38,26 @@ export default class Default {
log = log.concat(this.renderCommits(release.commits, backfillCount))
}
return log.join(this.listSpacing)
};
}

renderReleaseHeading = (release, previousRelease) => {
const title = this.renderReleaseTitle(release, previousRelease)
const date = release.date ? ' - ' + this.formatDate(release.date) : ''
return `## ${title}${date}`
};
}

renderReleaseTitle = (release, previousRelease) => {
let heading = release.tag || this.unreleasedTitle
if (previousRelease) {
heading = `[${heading}](${this.origin}/compare/${previousRelease.tag}...${release.tag || 'HEAD'})`
}
return heading
};
}

renderList = (title, list) => {
const heading = title ? `### ${title}\n` : ''
return heading + list
};
}

renderMerges = (merges) => {
if (merges.length === 0) return []
Expand All @@ -69,11 +69,11 @@ export default class Default {
})
}).join('\n')
return this.renderList(this.mergesTitle, list)
};
}

renderMerge = ({ message, link }) => {
return `* ${message} ${link}`
};
}

renderFixes = (fixes) => {
if (fixes.length === 0) return []
Expand All @@ -84,17 +84,17 @@ export default class Default {
}))
.join('\n')
return this.renderList(this.fixesTitle, list)
};
}

renderFix = ({ links, commit }) => {
return `* ${commit.subject} ${links.join(', ')}`
};
}

renderFixLink = (string) => {
const href = string.replace('#', this.origin + '/issues/')
const number = string.replace(new RegExp(this.origin + '/issues/', 'i'), '#')
return `[\`${number}\`](${href})`
};
}

renderCommits = (commits, limit) => {
if (commits.length === 0) return []
Expand All @@ -108,24 +108,24 @@ export default class Default {
}))
.join('\n')
return this.renderList(this.commitsTitle, list)
};
}

renderCommit = ({ subject, link }) => {
return `* ${subject} ${link}`
};
}

renderCommitLink = ({ hash }) => {
const shortHash = hash.slice(0, this.commitHashLength)
const href = `${this.origin}/commit/${hash}`
return `[\`${shortHash}\`](${href})`
};
}

sortCommits = (a, b) => {
// If we have to list commits, list the juicy ones first
return b.insertions + b.deletions - a.insertions + a.deletions
};
}

formatDate = (date) => {
return date.slice(0, 10)
};
}
}

0 comments on commit 2ff61e2

Please sign in to comment.