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 { readFileSync } from 'fs'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import { render } from './page' 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 = '') { function getVersion (title = '') {
const [, version, codeName] = title.trim().match(VERSION_RE) || [] const [, version, codeName, date] = title.trim().match(VERSION_RE) || []
if (!version) { if (!version) {
return null return null
} }
return [version, codeName] return [version, codeName, date]
} }
const TYPE_MAP = { const TYPE_MAP = {
@ -65,10 +65,11 @@ function extract (html) {
$versions.each((_, el) => { $versions.each((_, el) => {
const $version = $(el) const $version = $(el)
const [version, codeName] = getVersion($(el).text()) || [] const [version, codeName, date] = getVersion($(el).text()) || []
const versionLog = { const versionLog = {
version, version,
codeName, codeName,
date,
changeset: [] changeset: []
} }

View File

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