Skip to content

Commit

Permalink
add versioned documentation to the website (#5541)
Browse files Browse the repository at this point in the history
* add versioned documentation to the website

* add changelog for versioned documentation

* exclude versioned docs from specific lint rules

* use id attribute instead of name for in page anchors and remove redundant anchors

* re-create docs for v22.3 with latest changes from master
  • Loading branch information
ronami authored and cpojer committed Feb 21, 2018
1 parent 7bcdc8c commit 6ab04b7
Show file tree
Hide file tree
Showing 33 changed files with 7,842 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ module.exports = {
},
},
{
excludedFiles: 'integration-tests/__tests__/**/*',
excludedFiles: [
'integration-tests/__tests__/**/*',
'website/versioned_docs/**/*.md',
],
files: [
'examples/**/*',
'scripts/**/*',
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
([#5523](https://github.com/facebook/jest/pull/5523))
* `[jest-cli]` Support multiple glob patterns for `collectCoverageFrom`
([#5537](https://github.com/facebook/jest/pull/5537))
* `[docs]` Add versioned documentation to the website
([#5541](https://github.com/facebook/jest/pull/5541))

### Chore & Maintenance

Expand Down
3 changes: 2 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "docusaurus-build",
"gh-pages": "docusaurus-publish",
"examples": "docusaurus-examples",
"crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
"crowdin-upload":
"crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
"crowdin-download": "crowdin --config ../crowdin.yaml download -b master",
"publish-gh-pages": "docusaurus-publish",
"write-translations": "docusaurus-write-translations",
Expand Down
104 changes: 104 additions & 0 deletions website/pages/en/versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const React = require('react');

const CompLibrary = require('../../core/CompLibrary');
const Container = CompLibrary.Container;

const CWD = process.cwd();

const siteConfig = require(CWD + '/siteConfig.js');
const versions = require(CWD + '/versions.json');

class Versions extends React.Component {
render() {
const latestVersion = versions[0];
return (
<div className="docMainWrapper wrapper">
<Container className="mainContainer versionsContainer">
<div className="post">
<header className="postHeader">
<h2>{siteConfig.title + ' Versions'}</h2>
</header>
<h3 id="latest">Current version (Stable)</h3>
<p>Latest stable version of Jest</p>
<table className="versions">
<tbody>
<tr>
<th>{latestVersion}</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/en/getting-started.html`}
>
Documentation
</a>
</td>
<td>
<a href="https://github.com/facebook/jest/blob/master/CHANGELOG.md">
Release Notes
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="rc">Latest version</h3>
<p>
Here you can find the latest unreleased documentation and code.
</p>
<table className="versions">
<tbody>
<tr>
<th>master</th>
<td>
<a
href={`${
siteConfig.baseUrl
}docs/en/next/getting-started.html`}
>
Documentation
</a>
</td>
<td>
<a href="https://github.com/facebook/jest">Source Code</a>
</td>
</tr>
</tbody>
</table>
<h3 id="archive">Past Versions</h3>
<p>
Here you can find documentation for previous versions of Jest.
</p>
<table className="versions">
<tbody>
{versions.map(
version =>
version !== latestVersion && (
<tr key={version}>
<th>{version}</th>
<td>
<a
href={`${
siteConfig.baseUrl
}docs/en/${version}/getting-started.html`}
>
Documentation
</a>
</td>
</tr>
)
)}
</tbody>
</table>
</div>
</Container>
</div>
);
}
}

module.exports = Versions;
Loading

0 comments on commit 6ab04b7

Please sign in to comment.