Skip to content

Commit

Permalink
docs: copy & use main package version in docs on release (#16252)
Browse files Browse the repository at this point in the history
* docs: update docs package ver from main on release

fixes #16212

* docs: read docs package ver instead of main

fixes #16212

* docs: add newline to updated docs package json

Co-authored-by: Milos Djermanovic <[email protected]>

* docs: update docs package json version

Co-authored-by: Milos Djermanovic <[email protected]>
  • Loading branch information
jugalthakkar and mdjermanovic authored Sep 5, 2022
1 parent 42bfbd7 commit 1ae8236
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Makefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "docs-eslint",
"private": true,
"version": "1.0.0",
"version": "8.23.0",
"description": "",
"main": "index.js",
"keywords": [],
Expand Down
4 changes: 2 additions & 2 deletions docs/src/_data/eslintVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit 1ae8236

Please sign in to comment.