feat: provide usable UMD builds for all packages (#2141)

This commit is contained in:
Tony Alves
2019-03-16 15:44:29 -07:00
committed by Shawn Erquhart
parent 1d935c704d
commit 82cc7941cc
89 changed files with 1025 additions and 712 deletions

View File

@ -1,28 +0,0 @@
const path = require('path');
const babelConfig = require('../../babel.config.js');
module.exports = {
...babelConfig,
plugins: [
...babelConfig.plugins,
'react-hot-loader/babel',
[
'module-resolver',
{
root: path.join(__dirname, 'src/components'),
alias: {
src: path.join(__dirname, 'src'),
Actions: path.join(__dirname, 'src/actions/'),
Constants: path.join(__dirname, 'src/constants/'),
Formats: path.join(__dirname, 'src/formats/'),
Integrations: path.join(__dirname, 'src/integrations/'),
Lib: path.join(__dirname, 'src/lib/'),
Reducers: path.join(__dirname, 'src/reducers/'),
Redux: path.join(__dirname, 'src/redux/'),
Routing: path.join(__dirname, 'src/routing/'),
ValueObjects: path.join(__dirname, 'src/valueObjects/'),
},
},
],
],
};

View File

@ -19,8 +19,6 @@
],
"license": "MIT",
"dependencies": {
"@emotion/core": "^10.0.9",
"@emotion/styled": "^10.0.9",
"ajv": "^6.10.0",
"ajv-errors": "^1.0.1",
"copy-text-to-clipboard": "^2.0.0",
@ -29,16 +27,9 @@
"gotrue-js": "^0.9.24",
"gray-matter": "^4.0.2",
"history": "^4.7.2",
"immutable": "^3.7.6",
"js-base64": "^2.5.1",
"js-yaml": "^3.12.2",
"jwt-decode": "^2.1.0",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"netlify-cms-editor-component-image": "^2.2.1-beta.0",
"netlify-cms-lib-auth": "^2.0.6-beta.0",
"netlify-cms-lib-util": "^2.1.3-beta.0",
"netlify-cms-ui-default": "^2.4.1-beta.0",
"node-polyglot": "^2.3.0",
"prop-types": "^15.7.2",
"react": "^16.8.4",
@ -70,11 +61,19 @@
"url": "^0.11.0",
"what-input": "^5.1.4"
},
"devDependencies": {
"cross-env": "^5.2.0",
"css-loader": "^2.1.1",
"to-string-loader": "^1.1.5",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
"peerDependencies": {
"@emotion/core": "^10.0.9",
"@emotion/styled": "^10.0.9",
"lodash": "^4.17.11",
"netlify-cms-editor-component-image": "^2.2.1-beta.0",
"netlify-cms-lib-auth": "^2.0.6-beta.0",
"netlify-cms-lib-util": "^2.1.3-beta.0",
"netlify-cms-ui-default": "^2.4.1-beta.0",
"moment": "^2.24.0",
"immutable": "^3.7.6",
"prop-types": "^15.7.2",
"react-immutable-proptypes": "^2.1.0",
"react": "^16.8.4",
"react-dom": "^16.8.4"
}
}

View File

@ -1,5 +1,5 @@
import { actions as notifActions } from 'redux-notifications';
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
const { notifSend } = notifActions;

View File

@ -1,5 +1,5 @@
import { actions as notifActions } from 'redux-notifications';
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
import { selectDeployPreview } from 'Reducers';
const { notifSend } = notifActions;

View File

@ -2,7 +2,7 @@ import uuid from 'uuid/v4';
import { actions as notifActions } from 'redux-notifications';
import { BEGIN, COMMIT, REVERT } from 'redux-optimist';
import { serializeValues } from 'Lib/serializeEntryValues';
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
import { getAsset } from 'Reducers';
import { selectFields } from 'Reducers/collections';
import { EDITORIAL_WORKFLOW } from 'Constants/publishModes';

View File

@ -1,7 +1,7 @@
import { fromJS, List, Map } from 'immutable';
import { actions as notifActions } from 'redux-notifications';
import { serializeValues } from 'Lib/serializeEntryValues';
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
import { getIntegrationProvider } from 'Integrations';
import { getAsset, selectIntegration } from 'Reducers';
import { selectFields } from 'Reducers/collections';

View File

@ -1,7 +1,7 @@
import { Map } from 'immutable';
import { actions as notifActions } from 'redux-notifications';
import { getBlobSHA } from 'netlify-cms-lib-util';
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
import { createAssetProxy } from 'ValueObjects/AssetProxy';
import { selectIntegration } from 'Reducers';
import { getIntegrationProvider } from 'Integrations';

View File

@ -1,4 +1,4 @@
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
import { getIntegrationProvider } from 'Integrations';
import { selectIntegration } from 'Reducers';

View File

@ -12,7 +12,7 @@ import { GlobalStyles } from 'netlify-cms-ui-default';
import { ErrorBoundary } from 'UI';
import App from 'App/App';
import 'EditorWidgets';
import 'src/mediaLibrary';
import 'coreSrc/mediaLibrary';
import 'what-input';
const ROOT_ID = 'nc-root';

View File

@ -10,7 +10,7 @@ import { Notifs } from 'redux-notifications';
import TopBarProgress from 'react-topbar-progress-indicator';
import { loadConfig } from 'Actions/config';
import { loginUser, logoutUser } from 'Actions/auth';
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
import { createNewEntry } from 'Actions/collections';
import { openMediaLibrary } from 'Actions/mediaLibrary';
import MediaLibrary from 'MediaLibrary/MediaLibrary';

View File

@ -1,4 +1,55 @@
import bootstrap from './bootstrap';
import registry from 'Lib/registry';
import {
registerPreviewStyle,
getPreviewStyles,
registerPreviewTemplate,
getPreviewTemplate,
registerWidget,
getWidget,
resolveWidget,
registerEditorComponent,
getEditorComponents,
registerWidgetValueSerializer,
getWidgetValueSerializer,
registerBackend,
getBackend,
registerMediaLibrary,
getMediaLibrary,
} from 'Lib/registry';
export { registry as default, bootstrap as init };
export const NetlifyCmsCore = {
registerPreviewStyle,
getPreviewStyles,
registerPreviewTemplate,
getPreviewTemplate,
registerWidget,
getWidget,
resolveWidget,
registerEditorComponent,
getEditorComponents,
registerWidgetValueSerializer,
getWidgetValueSerializer,
registerBackend,
getBackend,
registerMediaLibrary,
getMediaLibrary,
init: bootstrap,
};
export {
registerPreviewStyle,
getPreviewStyles,
registerPreviewTemplate,
getPreviewTemplate,
registerWidget,
getWidget,
resolveWidget,
registerEditorComponent,
getEditorComponents,
registerWidgetValueSerializer,
getWidgetValueSerializer,
registerBackend,
getBackend,
registerMediaLibrary,
getMediaLibrary,
bootstrap as init,
};

View File

@ -1,5 +1,5 @@
import { resolvePath } from 'netlify-cms-lib-util';
import { currentBackend } from 'src/backend';
import { currentBackend } from 'coreSrc/backend';
import store from 'Redux';
import { getIntegrationProvider } from 'Integrations';
import { selectIntegration } from 'Reducers';

View File

@ -1,43 +1,21 @@
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
const { getConfig, rules } = require('../../scripts/webpack.js');
const { getConfig } = require('../../scripts/webpack.js');
const isProduction = process.env.NODE_ENV === 'production';
const baseConfig = getConfig();
const versionPlugin = new webpack.DefinePlugin({
NETLIFY_CMS_VERSION: null,
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
});
module.exports = {
...baseConfig,
context: path.join(__dirname, 'src'),
entry: ['./index.js'],
module: {
rules: [
...Object.entries(rules)
.filter(([key]) => key !== 'js')
.map(([, rule]) => rule()),
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
configFile: path.join(__dirname, 'babel.config.js'),
},
},
},
{
test: /\.css$/,
include: [/(ol|redux-notifications|react-datetime)/],
use: ['to-string-loader', 'css-loader'],
},
],
},
plugins: [
...baseConfig.plugins,
new webpack.DefinePlugin({
NETLIFY_CMS_VERSION: null,
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
}),
],
const configs = () => {
return getConfig().map(config => {
return {
...config,
plugins: [...config.plugins, versionPlugin],
};
});
};
module.exports = configs();