fix: log accurate version by distribution (#1531)
This commit is contained in:
parent
668a53a079
commit
95a76ad790
6
packages/netlify-cms-core/src/bootstrap.js
vendored
6
packages/netlify-cms-core/src/bootstrap.js
vendored
@ -20,7 +20,11 @@ function bootstrap(opts = {}) {
|
|||||||
/**
|
/**
|
||||||
* Log the version number.
|
* Log the version number.
|
||||||
*/
|
*/
|
||||||
console.log(`Netlify CMS version ${NETLIFY_CMS_VERSION}`);
|
if (NETLIFY_CMS_VERSION) {
|
||||||
|
console.log(`netlify-cms ${NETLIFY_CMS_VERSION}`);
|
||||||
|
} else if (NETLIFY_CMS_CORE_VERSION) {
|
||||||
|
console.log(`netlify-cms-core ${NETLIFY_CMS_CORE_VERSION}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get DOM element where app will mount.
|
* Get DOM element where app will mount.
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const pkg = require('./package.json');
|
||||||
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
|
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
|
||||||
const { getConfig, rules, plugins } = require('../../scripts/webpack.js');
|
const { getConfig, rules, plugins } = require('../../scripts/webpack.js');
|
||||||
|
|
||||||
@ -47,6 +49,10 @@ module.exports = {
|
|||||||
...Object.entries(plugins)
|
...Object.entries(plugins)
|
||||||
.filter(([ key ]) => key !== 'friendlyErrors')
|
.filter(([ key ]) => key !== 'friendlyErrors')
|
||||||
.map(([ _, plugin ]) => plugin()),
|
.map(([ _, plugin ]) => plugin()),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
NETLIFY_CMS_VERSION: null,
|
||||||
|
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||||
|
}),
|
||||||
new FriendlyErrorsWebpackPlugin({
|
new FriendlyErrorsWebpackPlugin({
|
||||||
compilationSuccessInfo: {
|
compilationSuccessInfo: {
|
||||||
messages: ['Netlify CMS is now running at http://localhost:8080'],
|
messages: ['Netlify CMS is now running at http://localhost:8080'],
|
||||||
|
@ -1 +1 @@
|
|||||||
console.warn('The `cms.js` file is deprecated and will be removed in the next major release. Please use `netlify-cms.js` instead.');
|
console.warn('You seem to be loading Netlify CMS by fetching `dist/cms.js` from a CDN. That file is deprecated and will be removed in the next major release. Please use `dist/netlify-cms.js` instead.')
|
||||||
|
@ -1,26 +1,38 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const pkg = require('./package.json');
|
||||||
const coreWebpackConfig = require('../netlify-cms-core/webpack.config.js');
|
const coreWebpackConfig = require('../netlify-cms-core/webpack.config.js');
|
||||||
|
|
||||||
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
|
|
||||||
|
const baseConfig = {
|
||||||
|
...coreWebpackConfig,
|
||||||
|
context: path.join(__dirname, 'src'),
|
||||||
|
entry: './index.js',
|
||||||
|
plugins: [
|
||||||
|
...coreWebpackConfig.plugins.filter(plugin => !plugin instanceof webpack.DefinePlugin),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
NETLIFY_CMS_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||||
|
NETLIFY_CMS_CORE_VERSION: null,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
{
|
baseConfig,
|
||||||
...coreWebpackConfig,
|
|
||||||
context: path.join(__dirname, 'src'),
|
|
||||||
entry: './index.js',
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output the same script a second time, but named `cms.js`, and with a
|
* Output the same script a second time, but named `cms.js`, and with a
|
||||||
* deprecation notice.
|
* deprecation notice.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
...coreWebpackConfig,
|
...baseConfig,
|
||||||
context: path.join(__dirname, 'src'),
|
|
||||||
entry: [
|
entry: [
|
||||||
...coreWebpackConfig.entry,
|
|
||||||
path.join(__dirname, 'scripts/deprecate-old-dist.js'),
|
path.join(__dirname, 'scripts/deprecate-old-dist.js'),
|
||||||
|
baseConfig.entry,
|
||||||
],
|
],
|
||||||
output: {
|
output: {
|
||||||
...coreWebpackConfig.output,
|
...baseConfig.output,
|
||||||
filename: 'dist/cms.js',
|
filename: 'dist/cms.js',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -25,9 +25,6 @@ const rules = () => ({
|
|||||||
|
|
||||||
const plugins = () => {
|
const plugins = () => {
|
||||||
return {
|
return {
|
||||||
define: () => new webpack.DefinePlugin({
|
|
||||||
NETLIFY_CMS_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
|
||||||
}),
|
|
||||||
ignoreEsprima: () => new webpack.IgnorePlugin(/^esprima$/, /js-yaml/),
|
ignoreEsprima: () => new webpack.IgnorePlugin(/^esprima$/, /js-yaml/),
|
||||||
ignoreMomentOptionalDeps: () => new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
ignoreMomentOptionalDeps: () => new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
||||||
friendlyErrors: () => new FriendlyErrorsWebpackPlugin(),
|
friendlyErrors: () => new FriendlyErrorsWebpackPlugin(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user