From 0b5d6d9c2001e772babc2f5115158244593230bd Mon Sep 17 00:00:00 2001 From: Tony Alves Date: Mon, 25 Mar 2019 10:57:17 -0700 Subject: [PATCH] chore: fix develop watch (#2237) --- babel.config.js | 63 ++++--------------- package.json | 5 +- .../package.json | 3 +- .../package.json | 3 +- .../netlify-cms-backend-github/package.json | 3 +- .../netlify-cms-backend-gitlab/package.json | 3 +- .../netlify-cms-backend-test/package.json | 3 +- packages/netlify-cms-core/package.json | 2 +- .../netlify-cms-default-exports/package.json | 3 +- .../package.json | 3 +- packages/netlify-cms-lib-auth/package.json | 3 +- packages/netlify-cms-lib-util/package.json | 3 +- .../package.json | 3 +- .../package.json | 3 +- packages/netlify-cms-ui-default/package.json | 3 +- .../netlify-cms-widget-boolean/package.json | 3 +- packages/netlify-cms-widget-date/package.json | 3 +- packages/netlify-cms-widget-date/src/index.js | 1 + .../netlify-cms-widget-datetime/package.json | 3 +- .../netlify-cms-widget-datetime/src/index.js | 1 + packages/netlify-cms-widget-file/package.json | 3 +- .../netlify-cms-widget-image/package.json | 3 +- packages/netlify-cms-widget-list/package.json | 3 +- packages/netlify-cms-widget-map/package.json | 3 +- .../netlify-cms-widget-markdown/package.json | 3 +- .../netlify-cms-widget-number/package.json | 3 +- .../netlify-cms-widget-object/package.json | 3 +- .../netlify-cms-widget-relation/package.json | 3 +- .../netlify-cms-widget-select/package.json | 3 +- .../netlify-cms-widget-string/package.json | 3 +- packages/netlify-cms-widget-text/package.json | 3 +- packages/netlify-cms/src/widgets.js | 6 +- 32 files changed, 47 insertions(+), 109 deletions(-) diff --git a/babel.config.js b/babel.config.js index 56d12432..6122171e 100644 --- a/babel.config.js +++ b/babel.config.js @@ -6,18 +6,7 @@ const isTest = process.env.NODE_ENV === 'test'; const isESM = process.env.NODE_ENV === 'esm'; const presets = () => { - if (isTest) { - return ['@babel/preset-react', '@babel/preset-env']; - } - return [ - '@babel/preset-react', - [ - '@babel/preset-env', - { - modules: false, - }, - ], - ]; + return ['@babel/preset-react', '@babel/preset-env']; }; const plugins = () => { @@ -33,6 +22,13 @@ const plugins = () => { '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-export-default-from', + [ + 'emotion', + { + sourceMap: true, + autoLabel: true, + }, + ], [ 'module-resolver', isESM @@ -80,19 +76,6 @@ const plugins = () => { ], ]; - if (isProduction) { - return [ - ...defaultPlugins, - [ - 'emotion', - { - hoist: true, - autoLabel: true, - }, - ], - ]; - } - if (isESM) { return [ ...defaultPlugins, @@ -103,13 +86,6 @@ const plugins = () => { NETLIFY_CMS_CORE_VERSION: `${coreVersion}`, }, ], - [ - 'emotion', - { - hoist: true, - autoLabel: true, - }, - ], [ 'inline-svg', { @@ -132,27 +108,14 @@ const plugins = () => { }, }, ], - [ - 'emotion', - { - sourceMap: true, - autoLabel: true, - }, - ], ]; } - defaultPlugins.push('react-hot-loader/babel'); - return [ - ...defaultPlugins, - [ - 'emotion', - { - sourceMap: true, - autoLabel: true, - }, - ], - ]; + if (!isProduction) { + defaultPlugins.push('react-hot-loader/babel'); + } + + return defaultPlugins; }; module.exports = { diff --git a/package.json b/package.json index 3a0b5d68..f3be95d8 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { "scripts": { "bootstrap": "lerna bootstrap", - "start": "run-s clean bootstrap develop", - "watch": "lerna run watch --parallel", - "develop": "lerna run --parallel develop", + "start": "run-s clean bootstrap build:esm develop", + "develop": "lerna run develop --parallel", "build": "run-s clean build:esm build:lerna", "build:lerna": "lerna run build", "build:esm": "lerna run build:esm", diff --git a/packages/netlify-cms-backend-bitbucket/package.json b/packages/netlify-cms-backend-bitbucket/package.json index 914ef275..87958f6e 100644 --- a/packages/netlify-cms-backend-bitbucket/package.json +++ b/packages/netlify-cms-backend-bitbucket/package.json @@ -15,8 +15,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-backend-git-gateway/package.json b/packages/netlify-cms-backend-git-gateway/package.json index 8a608bee..a2d3e993 100644 --- a/packages/netlify-cms-backend-git-gateway/package.json +++ b/packages/netlify-cms-backend-git-gateway/package.json @@ -16,8 +16,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-backend-github/package.json b/packages/netlify-cms-backend-github/package.json index 0467245f..b30661f7 100644 --- a/packages/netlify-cms-backend-github/package.json +++ b/packages/netlify-cms-backend-github/package.json @@ -15,8 +15,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-backend-gitlab/package.json b/packages/netlify-cms-backend-gitlab/package.json index c80d2b03..812b935f 100644 --- a/packages/netlify-cms-backend-gitlab/package.json +++ b/packages/netlify-cms-backend-gitlab/package.json @@ -15,8 +15,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-backend-test/package.json b/packages/netlify-cms-backend-test/package.json index 2a0a46a6..757d8d72 100644 --- a/packages/netlify-cms-backend-test/package.json +++ b/packages/netlify-cms-backend-test/package.json @@ -14,8 +14,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-core/package.json b/packages/netlify-cms-core/package.json index dcd96e5a..5786c8ce 100644 --- a/packages/netlify-cms-core/package.json +++ b/packages/netlify-cms-core/package.json @@ -11,7 +11,7 @@ "dist/" ], "scripts": { - "develop": "webpack -w", + "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" }, diff --git a/packages/netlify-cms-default-exports/package.json b/packages/netlify-cms-default-exports/package.json index 1d670af0..55462800 100644 --- a/packages/netlify-cms-default-exports/package.json +++ b/packages/netlify-cms-default-exports/package.json @@ -15,8 +15,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-editor-component-image/package.json b/packages/netlify-cms-editor-component-image/package.json index 139c29b4..375ab01c 100644 --- a/packages/netlify-cms-editor-component-image/package.json +++ b/packages/netlify-cms-editor-component-image/package.json @@ -15,8 +15,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-lib-auth/package.json b/packages/netlify-cms-lib-auth/package.json index 1751978e..f9e78df7 100644 --- a/packages/netlify-cms-lib-auth/package.json +++ b/packages/netlify-cms-lib-auth/package.json @@ -16,8 +16,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-lib-util/package.json b/packages/netlify-cms-lib-util/package.json index 23478504..16708440 100644 --- a/packages/netlify-cms-lib-util/package.json +++ b/packages/netlify-cms-lib-util/package.json @@ -12,8 +12,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-media-library-cloudinary/package.json b/packages/netlify-cms-media-library-cloudinary/package.json index 8d9846ad..1aebdc95 100644 --- a/packages/netlify-cms-media-library-cloudinary/package.json +++ b/packages/netlify-cms-media-library-cloudinary/package.json @@ -20,8 +20,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-media-library-uploadcare/package.json b/packages/netlify-cms-media-library-uploadcare/package.json index 1258f72f..e42d969f 100644 --- a/packages/netlify-cms-media-library-uploadcare/package.json +++ b/packages/netlify-cms-media-library-uploadcare/package.json @@ -18,8 +18,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-ui-default/package.json b/packages/netlify-cms-ui-default/package.json index 9c04bef5..bbe4c523 100644 --- a/packages/netlify-cms-ui-default/package.json +++ b/packages/netlify-cms-ui-default/package.json @@ -12,8 +12,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-boolean/package.json b/packages/netlify-cms-widget-boolean/package.json index 1a5c9e97..8fed935f 100644 --- a/packages/netlify-cms-widget-boolean/package.json +++ b/packages/netlify-cms-widget-boolean/package.json @@ -16,8 +16,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-date/package.json b/packages/netlify-cms-widget-date/package.json index 95cbf016..1d8067f2 100644 --- a/packages/netlify-cms-widget-date/package.json +++ b/packages/netlify-cms-widget-date/package.json @@ -17,8 +17,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-date/src/index.js b/packages/netlify-cms-widget-date/src/index.js index 1e6fc599..fb3d1883 100644 --- a/packages/netlify-cms-widget-date/src/index.js +++ b/packages/netlify-cms-widget-date/src/index.js @@ -9,3 +9,4 @@ const Widget = (opts = {}) => ({ }); export const NetlifyCmsWidgetDate = { Widget, controlComponent, previewComponent }; +export { Widget as default, controlComponent, previewComponent }; diff --git a/packages/netlify-cms-widget-datetime/package.json b/packages/netlify-cms-widget-datetime/package.json index ad2c5c12..96332d05 100644 --- a/packages/netlify-cms-widget-datetime/package.json +++ b/packages/netlify-cms-widget-datetime/package.json @@ -18,8 +18,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-datetime/src/index.js b/packages/netlify-cms-widget-datetime/src/index.js index ee7a42e8..01bb74bd 100644 --- a/packages/netlify-cms-widget-datetime/src/index.js +++ b/packages/netlify-cms-widget-datetime/src/index.js @@ -9,3 +9,4 @@ const Widget = (opts = {}) => ({ }); export const NetlifyCmsWidgetDatetime = { Widget, controlComponent, previewComponent }; +export { Widget as default, controlComponent, previewComponent }; diff --git a/packages/netlify-cms-widget-file/package.json b/packages/netlify-cms-widget-file/package.json index 9f8aced4..7818c12e 100644 --- a/packages/netlify-cms-widget-file/package.json +++ b/packages/netlify-cms-widget-file/package.json @@ -18,8 +18,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-image/package.json b/packages/netlify-cms-widget-image/package.json index 13609b76..2cdf7f83 100644 --- a/packages/netlify-cms-widget-image/package.json +++ b/packages/netlify-cms-widget-image/package.json @@ -18,8 +18,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-list/package.json b/packages/netlify-cms-widget-list/package.json index 3844f52e..884fb865 100644 --- a/packages/netlify-cms-widget-list/package.json +++ b/packages/netlify-cms-widget-list/package.json @@ -17,8 +17,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-map/package.json b/packages/netlify-cms-widget-map/package.json index 800f875a..33756a63 100644 --- a/packages/netlify-cms-widget-map/package.json +++ b/packages/netlify-cms-widget-map/package.json @@ -17,8 +17,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-markdown/package.json b/packages/netlify-cms-widget-markdown/package.json index 7aa50e37..5656bc17 100644 --- a/packages/netlify-cms-widget-markdown/package.json +++ b/packages/netlify-cms-widget-markdown/package.json @@ -17,8 +17,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-number/package.json b/packages/netlify-cms-widget-number/package.json index 10941ac2..6c1d9346 100644 --- a/packages/netlify-cms-widget-number/package.json +++ b/packages/netlify-cms-widget-number/package.json @@ -16,8 +16,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-object/package.json b/packages/netlify-cms-widget-object/package.json index 6fef628f..1b6598ce 100644 --- a/packages/netlify-cms-widget-object/package.json +++ b/packages/netlify-cms-widget-object/package.json @@ -18,8 +18,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-relation/package.json b/packages/netlify-cms-widget-relation/package.json index ea200aaa..c02967d0 100644 --- a/packages/netlify-cms-widget-relation/package.json +++ b/packages/netlify-cms-widget-relation/package.json @@ -17,8 +17,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-select/package.json b/packages/netlify-cms-widget-select/package.json index 4b7ac46e..ee5966ab 100644 --- a/packages/netlify-cms-widget-select/package.json +++ b/packages/netlify-cms-widget-select/package.json @@ -18,8 +18,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-string/package.json b/packages/netlify-cms-widget-string/package.json index c794454f..58f80ac1 100644 --- a/packages/netlify-cms-widget-string/package.json +++ b/packages/netlify-cms-widget-string/package.json @@ -16,8 +16,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms-widget-text/package.json b/packages/netlify-cms-widget-text/package.json index 6d9aaa7b..e8c3fae7 100644 --- a/packages/netlify-cms-widget-text/package.json +++ b/packages/netlify-cms-widget-text/package.json @@ -19,8 +19,7 @@ ], "sideEffects": false, "scripts": { - "watch": "webpack -w", - "develop": "npm run watch", + "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" }, diff --git a/packages/netlify-cms/src/widgets.js b/packages/netlify-cms/src/widgets.js index ce0476b8..c14ee6c5 100644 --- a/packages/netlify-cms/src/widgets.js +++ b/packages/netlify-cms/src/widgets.js @@ -11,8 +11,8 @@ import * as NetlifyCmsWidgetObject from 'netlify-cms-widget-object'; import * as NetlifyCmsWidgetRelation from 'netlify-cms-widget-relation'; import * as NetlifyCmsWidgetBoolean from 'netlify-cms-widget-boolean'; import * as NetlifyCmsWidgetMap from 'netlify-cms-widget-map'; -import * as NetlifyCmsWidgetDate from 'netlify-cms-widget-date'; -import * as NetlifyCmsWidgetDateTime from 'netlify-cms-widget-datetime'; +import { NetlifyCmsWidgetDate } from 'netlify-cms-widget-date'; +import { NetlifyCmsWidgetDatetime } from 'netlify-cms-widget-datetime'; registerWidget( 'string', @@ -66,4 +66,4 @@ registerWidget( ); registerWidget('boolean', NetlifyCmsWidgetBoolean.controlComponent); registerWidget('map', NetlifyCmsWidgetMap.controlComponent, NetlifyCmsWidgetMap.previewComponent); -registerWidget([NetlifyCmsWidgetDate.Widget(), NetlifyCmsWidgetDateTime.Widget()]); +registerWidget([NetlifyCmsWidgetDate.Widget(), NetlifyCmsWidgetDatetime.Widget()]);