@@ -55,24 +55,23 @@ module.exports = function(eleventyConfig) {
55
55
// Load site-specific data
56
56
const siteName = process . env . ESLINT_SITE_NAME || "en" ;
57
57
58
- // Current version of ESLint
59
- const currentVersion = require ( "../package.json" ) . version ;
60
-
61
58
/**
62
59
* Determines whether the given version is a prerelease.
63
- * @param {string } version The version to check.
64
60
* @returns {boolean } `true` if it is a prerelease, `false` otherwise.
65
61
*/
66
- function isPreRelease ( version ) {
67
- return / [ a - z ] / u. test ( version ) ;
62
+ async function isPreRelease ( ) {
63
+ const eslintVersions = await require ( "./src/_data/eslintVersions" ) ( ) ;
64
+
65
+ return eslintVersions . items . some ( item => item . branch === "next" ) ;
68
66
}
69
67
70
68
eleventyConfig . addGlobalData ( "site_name" , siteName ) ;
71
69
eleventyConfig . addGlobalData ( "GIT_BRANCH" , process . env . BRANCH ) ;
72
70
eleventyConfig . addGlobalData ( "HEAD" , process . env . BRANCH === "main" ) ;
73
71
eleventyConfig . addGlobalData ( "NOINDEX" , process . env . BRANCH !== "latest" ) ;
74
72
eleventyConfig . addGlobalData ( "PATH_PREFIX" , pathPrefix ) ;
75
- eleventyConfig . addGlobalData ( "is_pre_release" , isPreRelease ( currentVersion ) ) ;
73
+ eleventyConfig . addGlobalData ( "is_pre_release" , isPreRelease ) ;
74
+ eleventyConfig . addGlobalData ( "is_number_version" , process . env . BRANCH && / ^ v \d + \. x $ / u. test ( process . env . BRANCH ) ) ;
76
75
eleventyConfig . addDataExtension ( "yml" , contents => yaml . load ( contents ) ) ;
77
76
78
77
//------------------------------------------------------------------------------
0 commit comments