1 | 'use strict'
|
2 | Object.defineProperty(exports, '__esModule', { value: true })
|
3 | exports.getHistorySection = void 0
|
4 | const util_js_1 = require('./util.js')
|
5 |
|
6 | function getHistorySection(data) {
|
7 |
|
8 | let link = null
|
9 | const file = data.filenamesForReadmeFiles.history
|
10 | if (file) {
|
11 | link = util_js_1.getLink({
|
12 | url: util_js_1.getFileUrl(data, file),
|
13 | text: `Discover the release history by heading on over to the <code>${file}</code> file.`,
|
14 | })
|
15 | } else if (data.github.slug) {
|
16 | link = util_js_1.getLink({
|
17 | url: `https://github.com/${data.github.slug}/releases`,
|
18 | text:
|
19 | 'Discover the release history by heading on over to the releases page.',
|
20 | })
|
21 | } else {
|
22 | throw new Error(
|
23 | 'History section either requires a HISTORY file or a Github repository'
|
24 | )
|
25 | }
|
26 |
|
27 | return '<h2>History</h2>\n\n' + link
|
28 | }
|
29 | exports.getHistorySection = getHistorySection
|