chore: add support for alpha releases (#5551)

This commit is contained in:
Keeley Hammond 2021-07-28 16:06:26 -07:00 коммит произвёл GitHub
Родитель 49dafceab2
Коммит fccfa8f220
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 308 добавлений и 17818 удалений

Просмотреть файл

@ -127,6 +127,8 @@ releases:
stable_desc: Regular, supported releases
beta_releases: Beta Releases
beta_desc: Test your app with upcoming changes
alpha_releases: Alpha Releases
alpha_desc: Test features slightly more on the edge
nightly_releases: Nightly Releases
nightly_desc: Experiment with the latest features
next: Next

Просмотреть файл

@ -7,13 +7,17 @@ class Release {
}
isStable() {
return !this.isBeta() && !this.isNightly()
return !this.isBeta() && !this.isAlpha() && !this.isNightly()
}
isBeta() {
return this.semver.prerelease.includes('beta')
}
isAlpha() {
return this.semver.prerelease.includes('alpha')
}
isNightly() {
return this.semver.prerelease.includes('nightly')
}
@ -35,6 +39,7 @@ class Releases {
// highest version to lowest.
this.stableRelease = this.all.find((r) => r.hasNpmDistTag('latest'))
this.betaRelease = this.all.find((r) => r.hasNpmDistTag('beta'))
this.alphaRelease = this.all.find((r) => r.hasNpmDistTag('alpha'))
this.nightlyRelease = this.all.find((r) => r.hasNpmDistTag('nightly'))
}
@ -44,6 +49,8 @@ class Releases {
return this.all.filter((r) => r.isStable())
case 'beta':
return this.all.filter((r) => r.isBeta())
case 'alpha':
return this.all.filter((r) => r.isAlpha())
case 'nightly':
return this.all.filter((r) => r.isNightly())
default:

18071
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -51,7 +51,7 @@
"electron-apps": "1.8878.0",
"electron-i18n": "1.3082.0",
"electron-markdown": "^0.8.2",
"electron-releases": "3.740.0",
"electron-releases": "3.741.0",
"electron-userland-reports": "1.6.0",
"express": "^4.17.1",
"express-hbs": "^2.3.4",

Просмотреть файл

@ -2,7 +2,7 @@ const memoize = require('fast-memoize')
const { setupFeed } = require('./mainFeed')
const VALID_TYPES = new Set(['stable', 'beta', 'nightly'])
const VALID_TYPES = new Set(['stable', 'beta', 'alpha', 'nightly'])
const getReleasesForTypes = memoize((all, queryTypes) => {
const releases = []
@ -17,6 +17,8 @@ const getReleasesForTypes = memoize((all, queryTypes) => {
return r.isStable()
case 'beta':
return r.isBeta()
case 'alpha':
return r.isAlpha()
case 'nightly':
return r.isNightly()
}

Просмотреть файл

@ -211,6 +211,7 @@ app.get('/languages', routes.languages.index)
app.get('/releases', (req, res) => res.redirect(301, '/releases/stable'))
app.get('/releases/stable', routes.releases.index('stable'))
app.get('/releases/beta', routes.releases.index('beta'))
app.get('/releases/alpha', routes.releases.index('alpha'))
app.get('/releases/nightly', routes.releases.index('nightly'))
app.get('/releases.json', routes.feed.releases)
app.get('/releases.xml', routes.feed.releases)

Просмотреть файл

@ -398,6 +398,23 @@ describe('electronjs.org', () => {
})
})
test('/releases/alpha', async () => {
const $ = await get('/releases/alpha')
$('h1').text().should.include('Releases')
$('.release-entry').length.should.be.at.least(2)
$('a.releases-link-alpha').hasClass('active').should.eq(true)
const pages = $('.paginate-container .page-link').last()
const lastPage = parseInt(pages.text().trim(), 10)
lastPage.should.be.at.least(1)
const titles = $('.release-entry')
.map((i, el) => $(el).text().trim())
.get()
titles.forEach((title) => {
title.should.match(/Electron \d+\.\d+\.\d+-alpha\.\d+/)
})
})
test('/releases/nightly', async () => {
const $ = await get('/releases/nightly')
$('h1').text().should.include('Releases')

Просмотреть файл

@ -29,6 +29,14 @@
# Chromium {{releases.betaRelease.data.deps.chrome}}</span></code></pre>
</div>
</div>
<div class="electron-version">
<div id="electron-version-alpha" class="highlight highlight-dark text-left my-3 px-3">
<pre class="overflow-hidden"><code><span class="no-select">$ </span>npm i -D electron@alpha<span class="c1 no-select">
# Electron {{{releases.alphaRelease.data.version}}}
# Node {{releases.alphaRelease.data.deps.node}}
# Chromium {{releases.alphaRelease.data.deps.chrome}}</span></code></pre>
</div>
</div>
<div class="electron-version">
<div id="electron-version-nightly" class="highlight highlight-dark text-left my-3 px-3">
<pre class="overflow-hidden"><code><span class="no-select">$ </span>npm i -D electron-nightly<span class="c1 no-select">

Просмотреть файл

@ -21,6 +21,12 @@
<p>{{localized.releases.beta_desc}}</p>
</div>
</a>
<a class="releases-link-alpha {{#eq releasesPage.type 'alpha'}}active{{/eq}}" href="/releases/alpha">
<div class="menu-item" style="{{#eq releasesPage.type 'alpha'}}border-left: 1px solid #4078C0; background: #fcfcfc{{/eq}}">
<span class="octicon octicon-beaker"></span>{{localized.releases.alpha_releases}}
<p>{{localized.releases.alpha_desc}}</p>
</div>
</a>
<a class="releases-link-nightly {{#eq releasesPage.type 'nightly'}}active{{/eq}}" href="/releases/nightly">
<div class="menu-item" style="{{#eq releasesPage.type 'nightly'}}border-left: 1px solid #4078C0; background: #fcfcfc{{/eq}}">
<span class="octicon octicon-calendar"></span>{{localized.releases.nightly_releases}}
@ -76,6 +82,12 @@
<p>{{localized.releases.beta_desc}}</p>
</div>
</a>
<a class="releases-link-alpha" href="/releases/alpha">
<div class="menu-item {{#eq releasesPage.type 'alpha'}}active{{/eq}}">
<span class="octicon octicon-beaker"></span>{{localized.releases.alpha_releases}}
<p>{{localized.releases.alpha_desc}}</p>
</div>
</a>
<a class="releases-link-nightly" href="/releases/nightly">
<div class="menu-item {{#eq releasesPage.type 'nightly'}}active{{/eq}}">
<span class="octicon octicon-calendar"></span>{{localized.releases.nightly_releases}}