diff --git a/packages/app/.eslintrc.js b/packages/app/.eslintrc.js index 91bfc721..90bd58f4 100644 --- a/packages/app/.eslintrc.js +++ b/packages/app/.eslintrc.js @@ -15,7 +15,7 @@ module.exports = { 'cypress/globals': true, }, globals: { - STATIC_CMS_CORE_VERSION: false, + STATIC_CMS_APP_VERSION: false, CMS_ENV: false, }, rules: { diff --git a/packages/app/babel.config.js b/packages/app/babel.config.js index 40a4d8b8..91373013 100644 --- a/packages/app/babel.config.js +++ b/packages/app/babel.config.js @@ -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}`, }, ], [ diff --git a/packages/app/webpack.config.js b/packages/app/webpack.config.js index fc525d6f..3e1c1728 100644 --- a/packages/app/webpack.config.js +++ b/packages/app/webpack.config.js @@ -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'), diff --git a/packages/core/src/bootstrap.tsx b/packages/core/src/bootstrap.tsx index 6148ba6d..54a7bab8 100644 --- a/packages/core/src/bootstrap.tsx +++ b/packages/core/src/bootstrap.tsx @@ -81,7 +81,9 @@ function bootstrap(opts?: { /** * 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}`); } diff --git a/packages/core/src/components/ErrorBoundary.tsx b/packages/core/src/components/ErrorBoundary.tsx index 1d54d634..95e3d9c0 100644 --- a/packages/core/src/components/ErrorBoundary.tsx +++ b/packages/core/src/components/ErrorBoundary.tsx @@ -51,8 +51,10 @@ ${config} function buildIssueTemplate(config?: Config) { let version = ''; - if (typeof STATIC_CMS_CORE_VERSION === 'string') { - version = `static-cms@${STATIC_CMS_CORE_VERSION}`; + if (typeof STATIC_CMS_APP_VERSION === 'string') { + 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( version, diff --git a/packages/core/src/types/constants.d.ts b/packages/core/src/types/constants.d.ts index a94128ec..40a4ad21 100644 --- a/packages/core/src/types/constants.d.ts +++ b/packages/core/src/types/constants.d.ts @@ -1 +1,2 @@ declare const STATIC_CMS_CORE_VERSION: string; +declare const STATIC_CMS_APP_VERSION: string; diff --git a/packages/docs/.eslintrc.js b/packages/docs/.eslintrc.js index 6ae5ddb5..d2ced921 100644 --- a/packages/docs/.eslintrc.js +++ b/packages/docs/.eslintrc.js @@ -15,7 +15,6 @@ module.exports = { jest: true, }, globals: { - STATIC_CMS_CORE_VERSION: false, CMS_ENV: false, }, rules: { diff --git a/packages/tools/babel.config.js b/packages/tools/babel.config.js index 40a4d8b8..3dc431bd 100644 --- a/packages/tools/babel.config.js +++ b/packages/tools/babel.config.js @@ -56,12 +56,6 @@ function plugins() { if (isESM) { return [ ...defaultPlugins, - [ - 'transform-define', - { - STATIC_CMS_CORE_VERSION: `${coreVersion}`, - }, - ], [ 'inline-react-svg', {