From 9e1703c16bad595644169190fe6e75b3c55fd1ac Mon Sep 17 00:00:00 2001 From: Nicolas Charpentier Date: Tue, 28 Nov 2023 14:13:11 -0500 Subject: [PATCH] Read Recharts version from npm (#288) * Read Recharts latest version from npm API * Fetch npm API as part of build job --- .github/workflows/deploy-website.yml | 2 +- src/views/IndexView.js | 4 ++-- webpack.config.prod.js | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index b3a946db..88955fcb 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -35,7 +35,7 @@ jobs: - name: Install dependencies run: npm install - name: Build with npm - run: npm run build + run: RECHARTS_LATEST_VERSION=`curl -X GET "https://registry.npmjs.org/recharts/latest" | jq --raw-output '.version'` npm run build - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact diff --git a/src/views/IndexView.js b/src/views/IndexView.js index f1ab6ec3..7163036e 100644 --- a/src/views/IndexView.js +++ b/src/views/IndexView.js @@ -6,7 +6,6 @@ import { getLocaleType, localeGet } from '../utils/LocaleUtils'; import './IndexView.scss'; import 'simple-line-icons/scss/simple-line-icons.scss'; import users from '../docs/users/users'; -import rechartsPackageJson from 'recharts/package.json'; const data = [ { @@ -69,8 +68,9 @@ class IndexView extends PureComponent {

+   {localeGet(locale, 'home', 'install')} -  v{rechartsPackageJson.version} + {process.env.RECHARTS_LATEST_VERSION ? ` v${process.env.RECHARTS_LATEST_VERSION}` : undefined}