File tree 5 files changed +33
-14
lines changed
5 files changed +33
-14
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ function bootstrap(opts = {}) {
20
20
/**
21
21
* Log the version number.
22
22
*/
23
- console . log ( `Netlify CMS version ${ NETLIFY_CMS_VERSION } ` ) ;
23
+ if ( NETLIFY_CMS_VERSION ) {
24
+ console . log ( `netlify-cms ${ NETLIFY_CMS_VERSION } ` ) ;
25
+ } else if ( NETLIFY_CMS_CORE_VERSION ) {
26
+ console . log ( `netlify-cms-core ${ NETLIFY_CMS_CORE_VERSION } ` ) ;
27
+ }
24
28
25
29
/**
26
30
* Get DOM element where app will mount.
Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' ) ;
2
+ const webpack = require ( 'webpack' ) ;
3
+ const pkg = require ( './package.json' ) ;
2
4
const FriendlyErrorsWebpackPlugin = require ( 'friendly-errors-webpack-plugin' ) ;
3
5
const { getConfig, rules, plugins } = require ( '../../scripts/webpack.js' ) ;
4
6
@@ -47,6 +49,10 @@ module.exports = {
47
49
...Object . entries ( plugins )
48
50
. filter ( ( [ key ] ) => key !== 'friendlyErrors' )
49
51
. map ( ( [ _ , plugin ] ) => plugin ( ) ) ,
52
+ new webpack . DefinePlugin ( {
53
+ NETLIFY_CMS_VERSION : null ,
54
+ NETLIFY_CMS_CORE_VERSION : JSON . stringify ( `${ pkg . version } ${ isProduction ? '' : '-dev' } ` ) ,
55
+ } ) ,
50
56
new FriendlyErrorsWebpackPlugin ( {
51
57
compilationSuccessInfo : {
52
58
messages : [ 'Netlify CMS is now running at http://localhost:8080' ] ,
Original file line number Diff line number Diff line change 1
- console . warn ( 'The ` cms.js` file is deprecated and will be removed in the next major release. Please use `netlify-cms.js` instead.' ) ;
1
+ 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.' )
Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' ) ;
2
+ const webpack = require ( 'webpack' ) ;
3
+ const pkg = require ( './package.json' ) ;
2
4
const coreWebpackConfig = require ( '../netlify-cms-core/webpack.config.js' ) ;
3
5
6
+ const isProduction = process . env . NODE_ENV === 'production' ;
7
+
8
+ const baseConfig = {
9
+ ...coreWebpackConfig ,
10
+ context : path . join ( __dirname , 'src' ) ,
11
+ entry : './index.js' ,
12
+ plugins : [
13
+ ...coreWebpackConfig . plugins . filter ( plugin => ! plugin instanceof webpack . DefinePlugin ) ,
14
+ new webpack . DefinePlugin ( {
15
+ NETLIFY_CMS_VERSION : JSON . stringify ( `${ pkg . version } ${ isProduction ? '' : '-dev' } ` ) ,
16
+ NETLIFY_CMS_CORE_VERSION : null ,
17
+ } ) ,
18
+ ] ,
19
+ } ;
20
+
4
21
module . exports = [
5
- {
6
- ...coreWebpackConfig ,
7
- context : path . join ( __dirname , 'src' ) ,
8
- entry : './index.js' ,
9
- } ,
22
+ baseConfig ,
10
23
11
24
/**
12
25
* Output the same script a second time, but named `cms.js`, and with a
13
26
* deprecation notice.
14
27
*/
15
28
{
16
- ...coreWebpackConfig ,
17
- context : path . join ( __dirname , 'src' ) ,
29
+ ...baseConfig ,
18
30
entry : [
19
- ...coreWebpackConfig . entry ,
20
31
path . join ( __dirname , 'scripts/deprecate-old-dist.js' ) ,
32
+ baseConfig . entry ,
21
33
] ,
22
34
output : {
23
- ...coreWebpackConfig . output ,
35
+ ...baseConfig . output ,
24
36
filename : 'dist/cms.js' ,
25
37
} ,
26
38
} ,
Original file line number Diff line number Diff line change @@ -25,9 +25,6 @@ const rules = () => ({
25
25
26
26
const plugins = ( ) => {
27
27
return {
28
- define : ( ) => new webpack . DefinePlugin ( {
29
- NETLIFY_CMS_VERSION : JSON . stringify ( `${ pkg . version } ${ isProduction ? '' : '-dev' } ` ) ,
30
- } ) ,
31
28
ignoreEsprima : ( ) => new webpack . IgnorePlugin ( / ^ e s p r i m a $ / , / j s - y a m l / ) ,
32
29
ignoreMomentOptionalDeps : ( ) => new webpack . IgnorePlugin ( / ^ \. \/ l o c a l e $ / , / m o m e n t $ / ) ,
33
30
friendlyErrors : ( ) => new FriendlyErrorsWebpackPlugin ( ) ,
You can’t perform that action at this time.
0 commit comments