Skip to content

Commit

Permalink
Add Release Schedule
Browse files Browse the repository at this point in the history
Pulls data from nodejs/Release#380

Fixes: #1889
  • Loading branch information
fhemberger committed Nov 11, 2018
1 parent 376193f commit a159b1c
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 1 deletion.
35 changes: 35 additions & 0 deletions layouts/about-release-schedule.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="{{site.locale}}" {{#if site.rtl}}dir="rtl"{{/if}}>
{{> html-head }}

<body>
{{> header }}

<div id="main">
<div class="container has-side-nav">

{{> navigation key='about'}}

<article>
<h1>{{ title }}</h1>

<p>
<img alt="{{ title }}" src="https://raw.githubusercontent.com/nodejs/Release/master/schedule.png">
</p>

{{{ release-schedule }}}

<p>
<small>{{ schedule-footer }}</small>
</p>


{{{ contents }}}
</article>

</div>
</div>

{{> footer }}
</body>
</html>
20 changes: 20 additions & 0 deletions layouts/css/page-modules/_release-schedule.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
table.release-schedule
width 100%
font-size 1rem
border 1px solid $light-gray2

td
padding 5px

> thead
font-weight 600
text-align left

> tbody
border-top 1px solid $light-gray2

tr:nth-child(odd)
background-color $light-gray3

tr:nth-child(even)
background-color $white
1 change: 1 addition & 0 deletions layouts/css/styles.styl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@import 'page-modules/_scrollToTop'
@import 'page-modules/_anchorLinks'
@import 'page-modules/_prev-next-navigation'
@import 'page-modules/_release-schedule'

.intro
margin-top 140px
Expand Down
18 changes: 18 additions & 0 deletions locale/en/about/release-schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
layout: about-release-schedule.hbs
title: Release Schedule
statuses:
maintenance: 'Maintenance LTS'
active: 'Active LTS'
current: 'Current'
pending: 'Pending'
columns:
- 'Release'
- 'Status'
- 'Codename'
- 'Initial Release'
- 'Active LTS Start'
- 'Maintenance LTS Start'
- 'End-of-life'
schedule-footer: Dates are subject to change.
---
4 changes: 4 additions & 0 deletions locale/en/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"link": "about/releases",
"text": "Releases"
},
"release-schedule": {
"link": "about/release-schedule",
"text": "Release Schedule"
},
"resources": {
"link": "about/resources",
"text": "Resources"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"serve": "node server.js",
"external:survey": "rsync -avz --exclude 'node_modules*' --exclude 'package*' external/survey-2018/ build/en/user-survey-report",
"gzip": "find build -type f \\( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.xml' -o -name '*.json' \\) -exec gzip -kf9 {} \\;",
"deploy": "npm run build && npm run external:survey && npm run gzip",
"deploy": "npm run load-schedule && npm run build && npm run external:survey && npm run gzip",
"load-versions": "node scripts/load-versions.js",
"load-schedule": "curl -sS https://raw.githubusercontent.com/nodejs/Release/master/schedule.json -o source/schedule.json",
"start": "npm run serve",
"test": "npm run test:lint && npm run test:unit && npm run test:smoke",
"test:lint": "standard && htmllint **/*.hbs && stylint layouts/css",
Expand Down
62 changes: 62 additions & 0 deletions scripts/helpers/release-schedule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict'

const schedule = require('../../source/schedule.json')

const today = new Date()
const datify = (release, key) => new Date(schedule[release][key])

module.exports = context => {
const statuses = context.data.root.statuses

const header = context.data.root.columns
.map(column => `<th>${column}</th>\n`)
.join('')

let content = ''

Object.keys(schedule)
.filter(release => datify(release, 'end') > today)
.forEach(release => {
const codename = schedule[release].codename
const codenameLink = codename
? `<a href="https://nodejs.org/download/release/latest-${codename.toLowerCase()}/">${codename}</a>`
: ''

const releaseLink = datify(release, 'start') < today
? `<a href="https://nodejs.org/download/release/latest-${release}.x/">${release}</a>`
: release

let status

if (datify(release, 'start') > today) {
status = statuses.pending
} else if (!schedule[release].lts || datify(release, 'lts') > today) {
status = statuses.current
} else if (datify(release, 'maintenance') < today) {
status = statuses.maintenance
} else if (datify(release, 'lts') < today) {
status = statuses.active
}

content += `<tr>
<td>${releaseLink}</td>
<td>${status}</td>
<td>${codenameLink}</td>
<td>${schedule[release].start || ''}</td>
<td>${schedule[release].lts || ''}</td>
<td>${schedule[release].maintenance || ''}</td>
<td>${schedule[release].end || ''}</td>
</tr>`
})

return `
<table class="release-schedule">
<thead>
<tr>${header}</tr>
</thead>
<tbody>
${content}
</tbody>
</table>
`
}
65 changes: 65 additions & 0 deletions source/schedule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"v0.10": {
"start": "2013-03-11",
"end": "2016-10-31"
},
"v0.12": {
"start": "2015-02-06",
"end": "2016-12-31"
},
"v4": {
"start": "2015-09-08",
"lts": "2015-10-12",
"maintenance": "2017-04-01",
"end": "2018-04-30",
"codename": "Argon"
},
"v5": {
"start": "2015-10-29",
"maintenance": "2016-04-30",
"end": "2016-06-30"
},
"v6": {
"start": "2016-04-26",
"lts": "2016-10-18",
"maintenance": "2018-04-30",
"end": "2019-04-01",
"codename": "Boron"
},
"v7": {
"start": "2016-10-25",
"maintenance": "2017-04-30",
"end": "2017-06-30"
},
"v8": {
"start": "2017-05-30",
"lts": "2017-10-31",
"maintenance": "2019-04-01",
"end": "2019-12-31",
"codename": "Carbon"
},
"v9": {
"start": "2017-10-01",
"maintenance": "2018-04-01",
"end": "2018-06-30"
},
"v10": {
"start": "2018-04-24",
"lts": "2018-10-30",
"maintenance": "2020-04-01",
"end": "2021-04-01",
"codename": "Dubnium"
},
"v11": {
"start": "2018-10-23",
"maintenance": "2019-04-01",
"end": "2019-06-30"
},
"v12": {
"start": "2019-04-23",
"lts": "2019-10-22",
"maintenance": "2021-04-01",
"end": "2022-04-01",
"codename": ""
}
}

0 comments on commit a159b1c

Please sign in to comment.