UNPKG

889 BJavaScriptView Raw
1'use strict'
2Object.defineProperty(exports, '__esModule', { value: true })
3exports.getHistorySection = void 0
4const util_js_1 = require('./util.js')
5// Get History Section
6function getHistorySection(data) {
7 // Prepare
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 // Return
27 return '<h2>History</h2>\n\n' + link
28}
29exports.getHistorySection = getHistorySection