chore: improve build output (#2258)

This commit is contained in:
Tony Alves
2019-04-04 11:16:06 -07:00
committed by Shawn Erquhart
parent 54fde06050
commit f5e148f9a7
36 changed files with 47 additions and 43 deletions

View File

@ -9,7 +9,7 @@
"scripts": {
"develop": "yarn build:esm --watch",
"build": "cross-env NODE_ENV=production webpack",
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward -s"
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore **/__tests__ --root-mode upward -s"
},
"keywords": [
"netlify",

View File

@ -3,6 +3,15 @@ import './backends';
import './widgets';
import './editor-components';
if (typeof window !== 'undefined') {
/**
* Log the version number.
*/
if (typeof NETLIFY_CMS_APP_VERSION === 'string') {
console.log(`netlify-cms-app ${NETLIFY_CMS_APP_VERSION}`);
}
}
export const NetlifyCmsApp = {
...CMS,
};

View File

@ -1,4 +1,3 @@
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
const { getConfig, plugins } = require('../../scripts/webpack');
@ -9,15 +8,12 @@ console.log(`${pkg.version}${isProduction ? '' : '-dev'}`);
const baseConfig = {
...baseWebpackConfig,
context: path.join(__dirname, 'src'),
entry: './index.js',
plugins: [
...Object.entries(plugins)
.filter(([key]) => key !== 'friendlyErrors')
.map(([, plugin]) => plugin()),
new webpack.DefinePlugin({
NETLIFY_CMS_VERSION: JSON.stringify(`- app - ${pkg.version}${isProduction ? '' : '-dev'}`),
NETLIFY_CMS_CORE_VERSION: null,
NETLIFY_CMS_APP_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
}),
],
};