Skip to content

Commit

Permalink
Display LTS and Stable on the download page.
Browse files Browse the repository at this point in the history
Duplicated the download page to have two separate
pages for each release line: LTS and Stable.

Two links in the upper right corner will appear
as soon as the https://nodejs.org/dist/index.json
contains *both* an LTS and a Stable v5.x release.
Until then, no extra links will be visible.
  • Loading branch information
phillipj committed Oct 28, 2015
1 parent f9e1c8d commit e6e378d
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 91 deletions.
7 changes: 6 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const filterStylusPartials = require('./scripts/plugins/filter-stylus-partials')
const mapHandlebarsPartials = require('./scripts/plugins/map-handlebars-partials')
const anchorMarkdownHeadings = require('./scripts/plugins/anchor-markdown-headings')
const loadVersions = require('./scripts/load-versions')
const latestVersion = require('./scripts/helpers/latestversion')

/** Build **/

Expand Down Expand Up @@ -181,8 +182,12 @@ function fullbuild () {
project: {
versions,
currentVersion: versions[0].version,
currentVersions: {
stable: latestVersion.stable(versions),
lts: latestVersion.lts(versions)
},
banner: {
visible: true,
visible: false,
content: '<a href="https://nodejs.org/en/blog/release/v4.2.1/">Long Term Support Release</a>'
}
}
Expand Down
17 changes: 17 additions & 0 deletions layouts/css/page-modules/_download.styl
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
.download-header

h1
width 40%
float left

ul
margin-top 2rem
width 40%
float right
text-align right

.download-header::after
display block
clear both
content ""

.download-hero
display table
margin-bottom 1em
Expand Down
64 changes: 64 additions & 0 deletions layouts/download-stable.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="{{site.locale}}">
{{> html-head }}

<body>
{{> header }}

<div id="main">
<div class="container">
<article>
<div class="download-header">
<h1>{{downloads.headline}}</h1>
<ul class="list-divider-pipe">
<li>
<a href="/{{site.locale}}/{{site.download.link}}" title="{{downloads.display-hint}} {{downloads.lts}}">{{downloads.lts}}</a>
</li>
<li>
<a href="/{{site.locale}}/{{site.download.link}}/stable" title="{{downloads.display-hint}} {{downloads.stable}}"><strong>{{downloads.stable}}</strong></a>
</li>
</ul>
</div>

{{> download-matrix version=project.currentVersions.stable}}

<section>
<h2>{{additional.headline}}</h2>
<p>{{additional.intro}}</p>

<table class="download-matrix full-width">
<tbody>
<tr>
<th>{{additional.platform}}</th>
<th>{{additional.provider}}</th>
<th></th>
</tr>
<tr>
<th>AIX on Power Systems</th>
<td><span>IBM</span></td>
<td><a href="http://www.ibm.com/developerworks/web/nodesdk/">{{download}}</a></td>
</tr>
<tr>
<th>Linux on Power Systems</th>
<td><span>IBM</span></td>
<td><a href="http://www.ibm.com/developerworks/web/nodesdk/">{{download}}</a></td>
</tr>
<tr>
<th>Linux on System z</th>
<td><span>IBM</span></td>
<td><a href="http://www.ibm.com/developerworks/web/nodesdk/">{{download}}</a></td>
</tr>
</tbody>
</table>

</section>

</article>

</div>
</div>

{{> footer }}
<script src="/static/js/download.js" async defer></script>
</body>
</html>
105 changes: 15 additions & 90 deletions layouts/download.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,97 +8,22 @@
<div id="main">
<div class="container">
<article>
<h1>{{downloads.headline}}</h1>

<section>
<p>{{downloads.intro}}</p>

<div class="download-hero full-width">
<ul class="no-padding">
<li>
<a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-x86.msi" id="windows-downloadbutton" data-version="{{ project.currentVersion }}">
<img src="/static/images/platform-icon-win.png" height="50" width="45" alt="">
Windows Installer
<p class="small color-lightgray pad-bottom-small">node-{{project.currentVersion}}-x86.msi</p>
</a>
</li>
<li>
<a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}.pkg">
<img src="/static/images/platform-icon-osx.png" height="50" width="45" alt="">
Macintosh Installer
<p class="small color-lightgray pad-bottom-small">node-{{project.currentVersion}}.pkg</p>
</a>
</li>
<li>
<a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}.tar.gz">
<img src="/static/images/platform-icon-generic.png" height="50" width="45" alt="">
Source Code
<p class="small color-lightgray pad-bottom-small">node-{{project.currentVersion}}.tar.gz</p>
</a>
</li>
</ul>
</div>

<table class="download-matrix full-width">
<tbody>
<tr>
<th>Windows Installer (.msi)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-x86.msi">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-x64.msi">64-bit</a></td>
</tr>

<tr>
<th>Windows Binary (.exe)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/win-x86/node.exe">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/win-x64/node.exe">64-bit</a></td>
</tr>

<tr>
<th>Mac OS X Installer (.pkg)</th>
<td colspan="6"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}.pkg">64-bit</a></td>
</tr>

<tr>
<th>Mac OS X Binaries (.tar.gz)</th>
<td colspan="6"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-darwin-x64.tar.gz">64-bit</a></td>
</tr>

<tr>
<th>Linux Binaries (.tar.gz)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-linux-x86.tar.gz">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-linux-x64.tar.gz">64-bit</a></td>
</tr>

<tr>
<th>SunOS Binaries (.tar.gz)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-sunos-x86.tar.gz">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-sunos-x64.tar.gz">64-bit</a></td>
</tr>

<tr>
<th>ARM Binaries (.tar.gz)</th>
<td colspan="2"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-linux-armv6l.tar.gz">ARMv6</a></td>
<td colspan="2"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-linux-armv7l.tar.gz">ARMv7</a></td>
<td colspan="2"><a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}-linux-arm64.tar.gz">ARMv8</a></td>
</tr>

<tr>
<th>Source Code</th>
<td colspan="6">
<a href="https://nodejs.org/dist/{{project.currentVersion}}/node-{{project.currentVersion}}.tar.gz">node-{{project.currentVersion}}.tar.gz</a>
</td>
</tr>
</tbody>
</table>

{{downloads.currentVersion}}: <strong>{{project.currentVersion}}</strong>
<ul>
<li><a href="https://nodejs.org/dist/{{project.currentVersion}}">{{site.all-downloads}}</a></li>
<li><a href="/{{site.locale}}/{{site.download.package-manager.link}}">{{site.download.package-manager.text}}</a></li>
<li><a href="/{{site.locale}}/{{site.download.releases.link}}/">{{site.download.releases.text}}</a></li>
<div class="download-header">
<h1>{{downloads.headline}}</h1>

{{#if project.currentVersions.stable}}
<ul class="list-divider-pipe">
<li>
<a href="/{{site.locale}}/{{site.download.link}}" title="{{downloads.display-hint}} {{downloads.lts}}"><strong>{{downloads.lts}}</strong></a>
</li>
<li>
<a href="/{{site.locale}}/{{site.download.link}}/stable" title="{{downloads.display-hint}} {{downloads.stable}}">{{downloads.stable}}</a>
</li>
</ul>
<p>{{downloads.buildDisclaimer}}</p>
</section>
{{/if}}
</div>

{{> download-matrix version=project.currentVersions.lts}}

<section>
<h2>{{additional.headline}}</h2>
Expand Down
89 changes: 89 additions & 0 deletions layouts/partials/download-matrix.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<section>
<p>{{downloads.intro}}</p>

<div class="download-hero full-width">
<ul class="no-padding">
<li>
<a href="https://nodejs.org/dist/{{version}}/node-{{version}}-x86.msi" id="windows-downloadbutton" data-version="{{version}}">
<img src="/static/images/platform-icon-win.png" height="50" width="45" alt="">
Windows Installer
<p class="small color-lightgray pad-bottom-small">node-{{version}}-x86.msi</p>
</a>
</li>
<li>
<a href="https://nodejs.org/dist/{{version}}/node-{{version}}.pkg">
<img src="/static/images/platform-icon-osx.png" height="50" width="45" alt="">
Macintosh Installer
<p class="small color-lightgray pad-bottom-small">node-{{version}}.pkg</p>
</a>
</li>
<li>
<a href="https://nodejs.org/dist/{{version}}/node-{{version}}.tar.gz">
<img src="/static/images/platform-icon-generic.png" height="50" width="45" alt="">
Source Code
<p class="small color-lightgray pad-bottom-small">node-{{version}}.tar.gz</p>
</a>
</li>
</ul>
</div>

<table class="download-matrix full-width">
<tbody>
<tr>
<th>Windows Installer (.msi)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-x86.msi">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-x64.msi">64-bit</a></td>
</tr>

<tr>
<th>Windows Binary (.exe)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/win-x86/node.exe">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/win-x64/node.exe">64-bit</a></td>
</tr>

<tr>
<th>Mac OS X Installer (.pkg)</th>
<td colspan="6"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}.pkg">64-bit</a></td>
</tr>

<tr>
<th>Mac OS X Binaries (.tar.gz)</th>
<td colspan="6"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-darwin-x64.tar.gz">64-bit</a></td>
</tr>

<tr>
<th>Linux Binaries (.tar.gz)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-linux-x86.tar.gz">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-linux-x64.tar.gz">64-bit</a></td>
</tr>

<tr>
<th>SunOS Binaries (.tar.gz)</th>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-sunos-x86.tar.gz">32-bit</a></td>
<td colspan="3"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-sunos-x64.tar.gz">64-bit</a></td>
</tr>

<tr>
<th>ARM Binaries (.tar.gz)</th>
<td colspan="2"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-linux-armv6l.tar.gz">ARMv6</a></td>
<td colspan="2"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-linux-armv7l.tar.gz">ARMv7</a></td>
<td colspan="2"><a href="https://nodejs.org/dist/{{version}}/node-{{version}}-linux-arm64.tar.gz">ARMv8</a></td>
</tr>

<tr>
<th>Source Code</th>
<td colspan="6">
<a href="https://nodejs.org/dist/{{version}}/node-{{version}}.tar.gz">node-{{version}}.tar.gz</a>
</td>
</tr>
</tbody>
</table>

{{downloads.currentVersion}}: <strong>{{version}}</strong>
<ul>
<li><a href="https://nodejs.org/dist/{{version}}">{{site.all-downloads}}</a></li>
<li><a href="/{{site.locale}}/{{site.download.package-manager.link}}">{{site.download.package-manager.text}}</a></li>
<li><a href="/{{site.locale}}/{{site.download.releases.link}}/">{{site.download.releases.text}}</a></li>
</ul>
<p>{{downloads.buildDisclaimer}}</p>
</section>
3 changes: 3 additions & 0 deletions locale/en/download/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: Download
download: Download
downloads:
headline: Downloads
lts: LTS
stable: Stable
display-hint: Display downloads for
intro: >
Download the Node.js source code or a pre-built installer for your platform, and start developing today.
currentVersion: Current version
Expand Down
20 changes: 20 additions & 0 deletions locale/en/download/stable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
layout: download-stable.hbs
title: Download
download: Download
downloads:
headline: Downloads
lts: LTS
stable: Stable
display-hint: Display downloads for
intro: >
Download the Node.js source code or a pre-built installer for your platform, and start developing today.
currentVersion: Current stable version
buildDisclaimer: "Note: Python 2.6 or 2.7 is required to build from source tarballs."
additional:
headline: Additional Platforms
intro: >
Members of the Node.js community maintain unofficial builds of Node.js for additional platforms. Note that such builds are not supported by the Node.js core team and may not yet be at the same build level as current Node.js release.
platform: Platform
provider: Provider
---
10 changes: 10 additions & 0 deletions scripts/helpers/latestversion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict'

const semver = require('semver')

exports.stable = (versions) => {
const matched = versions.find((version) => typeof version.lts === 'undefined').version
return semver.gte(matched, '5.0.0') ? matched : undefined
}

exports.lts = (versions) => versions.find((version) => typeof version.lts !== 'undefined').version

0 comments on commit e6e378d

Please sign in to comment.