fix: output app version number just like core (#962)

This commit is contained in:
Daniel Lautzenheiser
2023-10-31 09:12:26 -04:00
committed by GitHub
parent e7dd7bdb2a
commit bf0c5b6971
8 changed files with 15 additions and 13 deletions

View File

@ -15,7 +15,7 @@ module.exports = {
'cypress/globals': true,
},
globals: {
STATIC_CMS_CORE_VERSION: false,
STATIC_CMS_APP_VERSION: false,
CMS_ENV: false,
},
rules: {

View File

@ -1,6 +1,6 @@
const path = require('path');
const coreVersion = require('./package.json').version;
const appVersion = require('./package.json').version;
const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const isESM = process.env.NODE_ENV === 'esm';
@ -59,7 +59,7 @@ function plugins() {
[
'transform-define',
{
STATIC_CMS_CORE_VERSION: `${coreVersion}`,
STATIC_CMS_APP_VERSION: `${appVersion}`,
},
],
[

View File

@ -3,6 +3,7 @@ const webpack = require('webpack');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const pkg = require('./package.json');
const isProduction = process.env.NODE_ENV === 'production';
const devServerPort = parseInt(process.env.STATIC_CMS_DEV_SERVER_PORT || `${8080}`);
@ -90,6 +91,9 @@ module.exports = {
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
new webpack.DefinePlugin({
STATIC_CMS_APP_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
}),
].filter(Boolean),
output: {
path: path.resolve(__dirname, 'dist'),