chore: fix develop watch (#2237)

This commit is contained in:
Tony Alves 2019-03-25 10:57:17 -07:00 committed by Shawn Erquhart
parent 7987091196
commit 0b5d6d9c20
32 changed files with 47 additions and 109 deletions

View File

@ -6,18 +6,7 @@ const isTest = process.env.NODE_ENV === 'test';
const isESM = process.env.NODE_ENV === 'esm'; const isESM = process.env.NODE_ENV === 'esm';
const presets = () => { const presets = () => {
if (isTest) { return ['@babel/preset-react', '@babel/preset-env'];
return ['@babel/preset-react', '@babel/preset-env'];
}
return [
'@babel/preset-react',
[
'@babel/preset-env',
{
modules: false,
},
],
];
}; };
const plugins = () => { const plugins = () => {
@ -33,6 +22,13 @@ const plugins = () => {
'@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-export-default-from', '@babel/plugin-proposal-export-default-from',
[
'emotion',
{
sourceMap: true,
autoLabel: true,
},
],
[ [
'module-resolver', 'module-resolver',
isESM isESM
@ -80,19 +76,6 @@ const plugins = () => {
], ],
]; ];
if (isProduction) {
return [
...defaultPlugins,
[
'emotion',
{
hoist: true,
autoLabel: true,
},
],
];
}
if (isESM) { if (isESM) {
return [ return [
...defaultPlugins, ...defaultPlugins,
@ -103,13 +86,6 @@ const plugins = () => {
NETLIFY_CMS_CORE_VERSION: `${coreVersion}`, NETLIFY_CMS_CORE_VERSION: `${coreVersion}`,
}, },
], ],
[
'emotion',
{
hoist: true,
autoLabel: true,
},
],
[ [
'inline-svg', 'inline-svg',
{ {
@ -132,27 +108,14 @@ const plugins = () => {
}, },
}, },
], ],
[
'emotion',
{
sourceMap: true,
autoLabel: true,
},
],
]; ];
} }
defaultPlugins.push('react-hot-loader/babel'); if (!isProduction) {
return [ defaultPlugins.push('react-hot-loader/babel');
...defaultPlugins, }
[
'emotion', return defaultPlugins;
{
sourceMap: true,
autoLabel: true,
},
],
];
}; };
module.exports = { module.exports = {

View File

@ -1,9 +1,8 @@
{ {
"scripts": { "scripts": {
"bootstrap": "lerna bootstrap", "bootstrap": "lerna bootstrap",
"start": "run-s clean bootstrap develop", "start": "run-s clean bootstrap build:esm develop",
"watch": "lerna run watch --parallel", "develop": "lerna run develop --parallel",
"develop": "lerna run --parallel develop",
"build": "run-s clean build:esm build:lerna", "build": "run-s clean build:esm build:lerna",
"build:lerna": "lerna run build", "build:lerna": "lerna run build",
"build:esm": "lerna run build:esm", "build:esm": "lerna run build:esm",

View File

@ -15,8 +15,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -16,8 +16,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -15,8 +15,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -15,8 +15,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -14,8 +14,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -11,7 +11,7 @@
"dist/" "dist/"
], ],
"scripts": { "scripts": {
"develop": "webpack -w", "develop": "yarn build:esm --watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -15,8 +15,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -15,8 +15,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -16,8 +16,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -12,8 +12,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -20,8 +20,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -18,8 +18,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -12,8 +12,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -16,8 +16,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -17,8 +17,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -9,3 +9,4 @@ const Widget = (opts = {}) => ({
}); });
export const NetlifyCmsWidgetDate = { Widget, controlComponent, previewComponent }; export const NetlifyCmsWidgetDate = { Widget, controlComponent, previewComponent };
export { Widget as default, controlComponent, previewComponent };

View File

@ -18,8 +18,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -9,3 +9,4 @@ const Widget = (opts = {}) => ({
}); });
export const NetlifyCmsWidgetDatetime = { Widget, controlComponent, previewComponent }; export const NetlifyCmsWidgetDatetime = { Widget, controlComponent, previewComponent };
export { Widget as default, controlComponent, previewComponent };

View File

@ -18,8 +18,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -18,8 +18,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -17,8 +17,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -17,8 +17,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -17,8 +17,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -16,8 +16,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -18,8 +18,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -17,8 +17,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -18,8 +18,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -16,8 +16,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -19,8 +19,7 @@
], ],
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"watch": "webpack -w", "develop": "yarn build:esm --watch",
"develop": "npm run watch",
"build": "cross-env NODE_ENV=production webpack", "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" "build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward"
}, },

View File

@ -11,8 +11,8 @@ import * as NetlifyCmsWidgetObject from 'netlify-cms-widget-object';
import * as NetlifyCmsWidgetRelation from 'netlify-cms-widget-relation'; import * as NetlifyCmsWidgetRelation from 'netlify-cms-widget-relation';
import * as NetlifyCmsWidgetBoolean from 'netlify-cms-widget-boolean'; import * as NetlifyCmsWidgetBoolean from 'netlify-cms-widget-boolean';
import * as NetlifyCmsWidgetMap from 'netlify-cms-widget-map'; import * as NetlifyCmsWidgetMap from 'netlify-cms-widget-map';
import * as NetlifyCmsWidgetDate from 'netlify-cms-widget-date'; import { NetlifyCmsWidgetDate } from 'netlify-cms-widget-date';
import * as NetlifyCmsWidgetDateTime from 'netlify-cms-widget-datetime'; import { NetlifyCmsWidgetDatetime } from 'netlify-cms-widget-datetime';
registerWidget( registerWidget(
'string', 'string',
@ -66,4 +66,4 @@ registerWidget(
); );
registerWidget('boolean', NetlifyCmsWidgetBoolean.controlComponent); registerWidget('boolean', NetlifyCmsWidgetBoolean.controlComponent);
registerWidget('map', NetlifyCmsWidgetMap.controlComponent, NetlifyCmsWidgetMap.previewComponent); registerWidget('map', NetlifyCmsWidgetMap.controlComponent, NetlifyCmsWidgetMap.previewComponent);
registerWidget([NetlifyCmsWidgetDate.Widget(), NetlifyCmsWidgetDateTime.Widget()]); registerWidget([NetlifyCmsWidgetDate.Widget(), NetlifyCmsWidgetDatetime.Widget()]);