1 | 'use strict'
|
2 |
|
3 | const Q = require('q')
|
4 | const readFile = Q.denodeify(require('fs').readFile)
|
5 | const resolve = require('path').resolve
|
6 |
|
7 | module.exports = Q.all([
|
8 | readFile(resolve(__dirname, './templates/template.hbs'), 'utf-8'),
|
9 | readFile(resolve(__dirname, './templates/header.hbs'), 'utf-8'),
|
10 | readFile(resolve(__dirname, './templates/commit.hbs'), 'utf-8')
|
11 | ])
|
12 | .spread((template, header, commit) => {
|
13 | const writerOpts = getWriterOpts()
|
14 |
|
15 | writerOpts.mainTemplate = template
|
16 | writerOpts.headerPartial = header
|
17 | writerOpts.commitPartial = commit
|
18 |
|
19 | return writerOpts
|
20 | })
|
21 |
|
22 | function getWriterOpts () {
|
23 | return {
|
24 | transform: (commit) => {
|
25 | if (!commit.component || typeof commit.component !== 'string') {
|
26 | return
|
27 | }
|
28 |
|
29 | if (typeof commit.hash === 'string') {
|
30 | commit.shortHash = commit.hash.substring(0, 7)
|
31 | }
|
32 |
|
33 | commit.references.forEach(function (reference) {
|
34 | if (reference.prefix === '#') {
|
35 | reference.originalIssueTracker = 'https://bugs.jquery.com/ticket/'
|
36 | }
|
37 | })
|
38 |
|
39 | return commit
|
40 | },
|
41 | groupBy: 'component',
|
42 | commitGroupsSort: 'title',
|
43 | commitsSort: ['component', 'shortDesc']
|
44 | }
|
45 | }
|