-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Show prerelease version in dropdown (#18135)
* docs: Show prerelease version in dropdown fixes #17943 * Update docs/src/_data/eslintNextVersion.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Update docs/src/_includes/components/nav-version-switcher.html Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Update versions-list.html --------- Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
- Loading branch information
1 parent
e462524
commit 7db5bb2
Showing
5 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @fileoverview | ||
* @author Nicholas C. Zakas | ||
*/ | ||
|
||
//----------------------------------------------------------------------------- | ||
// Requirements | ||
//----------------------------------------------------------------------------- | ||
|
||
const eleventyFetch = require("@11ty/eleventy-fetch"); | ||
|
||
//----------------------------------------------------------------------------- | ||
// Exports | ||
//----------------------------------------------------------------------------- | ||
|
||
module.exports = async function() { | ||
|
||
// if we're on the next branch, we can just read the package.json file | ||
if (process.env.BRANCH === "next") { | ||
return require("../../package.json").version; | ||
} | ||
|
||
// otherwise, we need to fetch the latest version from the GitHub API | ||
const url = "https://raw.githubusercontent.com/eslint/eslint/next/docs/package.json"; | ||
|
||
const response = await eleventyFetch(url, { | ||
duration: "1d", | ||
type: "json" | ||
}); | ||
|
||
return response.version; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters