chore: add date in changelog

Change-Id: I91502c88852ff3ae61ba45c835d76bd21ec1e8ce
This commit is contained in:
xiaodemen 2022-01-17 15:58:23 +08:00 committed by GU Yiling
parent 932dde1ea5
commit 6237398af9
2 changed files with 7 additions and 6 deletions

View File

@ -1,13 +1,13 @@
import { readFileSync } from 'fs'
import cheerio from 'cheerio'
import { render } from './page'
const VERSION_RE = /^(\d+\.\d+\.\d+(?:-[a-z]+(?:\.\d+)?)?)(?:\s+"([^"]+)")?$/i
const VERSION_RE = /^(\d+\.\d+\.\d+(?:-[a-z]+(?:\.\d+)?)?)(?:\s+"([^"]+)")?(?:\s+\((\d{4}-\d{2}-\d{2})\))?$/i
function getVersion (title = '') {
const [, version, codeName] = title.trim().match(VERSION_RE) || []
const [, version, codeName, date] = title.trim().match(VERSION_RE) || []
if (!version) {
return null
}
return [version, codeName]
return [version, codeName, date]
}
const TYPE_MAP = {
@ -65,10 +65,11 @@ function extract (html) {
$versions.each((_, el) => {
const $version = $(el)
const [version, codeName] = getVersion($(el).text()) || []
const [version, codeName, date] = getVersion($(el).text()) || []
const versionLog = {
version,
codeName,
date,
changeset: []
}

View File

@ -75,7 +75,7 @@
</veui-fieldset>
</veui-form>
<section
v-for="{ version, codeName, changeset } of filteredChangelog"
v-for="{ version, codeName, date, changeset } of filteredChangelog"
:key="version"
class="version-item"
data-markdown
@ -90,7 +90,7 @@
<nuxt-link
:to="`#${getHash(version)}`"
>
{{ version }}<small v-if="codeName">{{ codeName }}</small>
{{ version }}<small v-if="codeName">{{ codeName }}</small><small v-if="date">{{ date }}</small>
</nuxt-link>
</h2>
<ul class="changeset">