fix: output app version number just like core (#962)
This commit is contained in:
parent
e7dd7bdb2a
commit
bf0c5b6971
@ -15,7 +15,7 @@ module.exports = {
|
|||||||
'cypress/globals': true,
|
'cypress/globals': true,
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
STATIC_CMS_CORE_VERSION: false,
|
STATIC_CMS_APP_VERSION: false,
|
||||||
CMS_ENV: false,
|
CMS_ENV: false,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const coreVersion = require('./package.json').version;
|
const appVersion = require('./package.json').version;
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
const isTest = process.env.NODE_ENV === 'test';
|
const isTest = process.env.NODE_ENV === 'test';
|
||||||
const isESM = process.env.NODE_ENV === 'esm';
|
const isESM = process.env.NODE_ENV === 'esm';
|
||||||
@ -59,7 +59,7 @@ function plugins() {
|
|||||||
[
|
[
|
||||||
'transform-define',
|
'transform-define',
|
||||||
{
|
{
|
||||||
STATIC_CMS_CORE_VERSION: `${coreVersion}`,
|
STATIC_CMS_APP_VERSION: `${appVersion}`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -3,6 +3,7 @@ const webpack = require('webpack');
|
|||||||
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
||||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
const pkg = require('./package.json');
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
const devServerPort = parseInt(process.env.STATIC_CMS_DEV_SERVER_PORT || `${8080}`);
|
const devServerPort = parseInt(process.env.STATIC_CMS_DEV_SERVER_PORT || `${8080}`);
|
||||||
@ -90,6 +91,9 @@ module.exports = {
|
|||||||
process: 'process/browser',
|
process: 'process/browser',
|
||||||
Buffer: ['buffer', 'Buffer'],
|
Buffer: ['buffer', 'Buffer'],
|
||||||
}),
|
}),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
STATIC_CMS_APP_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||||
|
}),
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
|
@ -81,7 +81,9 @@ function bootstrap<F extends BaseField = UnknownField>(opts?: {
|
|||||||
/**
|
/**
|
||||||
* Log the version number.
|
* Log the version number.
|
||||||
*/
|
*/
|
||||||
if (typeof STATIC_CMS_CORE_VERSION === 'string') {
|
if (typeof STATIC_CMS_APP_VERSION === 'string') {
|
||||||
|
console.info(`[StaticCMS] Using @staticcms/app ${STATIC_CMS_APP_VERSION}`);
|
||||||
|
} else if (typeof STATIC_CMS_CORE_VERSION === 'string') {
|
||||||
console.info(`[StaticCMS] Using @staticcms/core ${STATIC_CMS_CORE_VERSION}`);
|
console.info(`[StaticCMS] Using @staticcms/core ${STATIC_CMS_CORE_VERSION}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,10 @@ ${config}
|
|||||||
|
|
||||||
function buildIssueTemplate(config?: Config) {
|
function buildIssueTemplate(config?: Config) {
|
||||||
let version = '';
|
let version = '';
|
||||||
if (typeof STATIC_CMS_CORE_VERSION === 'string') {
|
if (typeof STATIC_CMS_APP_VERSION === 'string') {
|
||||||
version = `static-cms@${STATIC_CMS_CORE_VERSION}`;
|
version = `@staticcms/app@${STATIC_CMS_APP_VERSION}`;
|
||||||
|
} else if (typeof STATIC_CMS_CORE_VERSION === 'string') {
|
||||||
|
version = `@staticcms/core@${STATIC_CMS_CORE_VERSION}`;
|
||||||
}
|
}
|
||||||
const template = getIssueTemplate(
|
const template = getIssueTemplate(
|
||||||
version,
|
version,
|
||||||
|
1
packages/core/src/types/constants.d.ts
vendored
1
packages/core/src/types/constants.d.ts
vendored
@ -1 +1,2 @@
|
|||||||
declare const STATIC_CMS_CORE_VERSION: string;
|
declare const STATIC_CMS_CORE_VERSION: string;
|
||||||
|
declare const STATIC_CMS_APP_VERSION: string;
|
||||||
|
@ -15,7 +15,6 @@ module.exports = {
|
|||||||
jest: true,
|
jest: true,
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
STATIC_CMS_CORE_VERSION: false,
|
|
||||||
CMS_ENV: false,
|
CMS_ENV: false,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -56,12 +56,6 @@ function plugins() {
|
|||||||
if (isESM) {
|
if (isESM) {
|
||||||
return [
|
return [
|
||||||
...defaultPlugins,
|
...defaultPlugins,
|
||||||
[
|
|
||||||
'transform-define',
|
|
||||||
{
|
|
||||||
STATIC_CMS_CORE_VERSION: `${coreVersion}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'inline-react-svg',
|
'inline-react-svg',
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user