From 1ae8236a2e71c9dead20ba9da60d8cc9e317859a Mon Sep 17 00:00:00 2001 From: Jugal Thakkar <2640821+jugalthakkar@users.noreply.github.com> Date: Mon, 5 Sep 2022 23:08:35 +0530 Subject: [PATCH] docs: copy & use main package version in docs on release (#16252) * docs: update docs package ver from main on release fixes https://github.com/eslint/eslint/issues/16212 * docs: read docs package ver instead of main fixes https://github.com/eslint/eslint/issues/16212 * docs: add newline to updated docs package json Co-authored-by: Milos Djermanovic * docs: update docs package json version Co-authored-by: Milos Djermanovic --- Makefile.js | 7 +++++++ docs/package.json | 2 +- docs/src/_data/eslintVersion.js | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile.js b/Makefile.js index 1f353687398..a4b9f8bc4c1 100644 --- a/Makefile.js +++ b/Makefile.js @@ -287,6 +287,13 @@ function generateRelease() { generateBlogPost(releaseInfo); commitSiteToGit(`v${releaseInfo.version}`); + echo("Updating version in docs package"); + const docsPackagePath = path.join(__dirname, "docs", "package.json"); + const docsPackage = require(docsPackagePath); + + docsPackage.version = releaseInfo.version; + fs.writeFileSync(docsPackagePath, `${JSON.stringify(docsPackage, null, 4)}\n`); + echo("Updating commit with docs data"); exec("git add docs/ && git commit --amend --no-edit"); exec(`git tag -a -f v${releaseInfo.version} -m ${releaseInfo.version}`); diff --git a/docs/package.json b/docs/package.json index 558d41f97a9..6137ce86a2e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,7 +1,7 @@ { "name": "docs-eslint", "private": true, - "version": "1.0.0", + "version": "8.23.0", "description": "", "main": "index.js", "keywords": [], diff --git a/docs/src/_data/eslintVersion.js b/docs/src/_data/eslintVersion.js index cd60276b37a..24964276c0d 100644 --- a/docs/src/_data/eslintVersion.js +++ b/docs/src/_data/eslintVersion.js @@ -14,7 +14,7 @@ const path = require("path"); // Initialization //----------------------------------------------------------------------------- -const pkgPath = path.resolve(__dirname, "../../../package.json"); +const pkgPath = path.resolve(__dirname, "../../package.json"); const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8")); const { ESLINT_VERSION } = process.env; @@ -23,7 +23,7 @@ const { ESLINT_VERSION } = process.env; //----------------------------------------------------------------------------- /* - * Because we want to differentiate between the development branch and the + * Because we want to differentiate between the development branch and the * most recent release, we need a way to override the version. The * ESLINT_VERSION environment variable allows us to set this to override * the value displayed on the website. The most common case is we will set