"use strict"; /** * 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 { Container } = require("../../core/CompLibrary"); const CWD = process.cwd(); const versions = require(`${CWD}/versions.json`); const rootPackageJson = require(`${CWD}/../package.json`); const defaultBranchVersion = rootPackageJson.version; const isDefaultBranchDevVersion = defaultBranchVersion.endsWith("-dev"); const devVersion = isDefaultBranchDevVersion ? defaultBranchVersion : null; const latestVersion = isDefaultBranchDevVersion ? rootPackageJson.devDependencies.prettier : defaultBranchVersion; const [latestDocsVersion, ...pastDocsVersions] = versions; function Versions(props) { const { config: siteConfig } = props; return (

{siteConfig.title} Versions

{pastDocsVersions.length > 0 && pastDocsVersions.map((pastDocsVersion, index) => { const pastMajorVersion = pastDocsVersion.replace(/^v/, ""); return ( ); })}
Version Install with Documentation
{latestVersion} npm install prettier {latestDocsVersion} {" "} (latest)
{devVersion} npm install prettier/prettier next {" "} (main)
{pastMajorVersion}.x npm install prettier@ {pastMajorVersion} {pastDocsVersion}
); } module.exports = Versions;