mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Update peerdependencies and fix duplicate modules
This commit is contained in:
parent
751a794ca8
commit
e1d619065b
@ -12,8 +12,6 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
// import { ConnectedRouter } from 'react-router-redux';
|
||||
import basename from './utils/basename';
|
||||
|
||||
import { merge } from 'lodash';
|
||||
import {
|
||||
@ -25,6 +23,8 @@ import {
|
||||
// unsetHasUserPlugin,
|
||||
} from './containers/App/actions';
|
||||
import { showNotification } from './containers/NotificationProvider/actions';
|
||||
|
||||
import basename from './utils/basename';
|
||||
import injectReducer from './utils/injectReducer';
|
||||
import injectSaga from './utils/injectSaga';
|
||||
|
||||
|
||||
@ -4,24 +4,19 @@
|
||||
|
||||
import { createStore, applyMiddleware, compose } from 'redux';
|
||||
import { fromJS } from 'immutable';
|
||||
import { routerMiddleware } from 'react-router-redux';
|
||||
// import { routerMiddleware } from 'react-router-redux';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
import createReducer from './reducers';
|
||||
|
||||
const sagaMiddleware = createSagaMiddleware();
|
||||
|
||||
export default function configureStore(initialState = {}, history) {
|
||||
export default function configureStore(initialState = {}) {
|
||||
// Create the store with two middlewares
|
||||
// 1. sagaMiddleware: Makes redux-sagas work
|
||||
// 2. routerMiddleware: Syncs the location/URL path to the state
|
||||
const middlewares = [
|
||||
sagaMiddleware,
|
||||
routerMiddleware(history),
|
||||
];
|
||||
const middlewares = [sagaMiddleware];
|
||||
|
||||
const enhancers = [
|
||||
applyMiddleware(...middlewares),
|
||||
];
|
||||
const enhancers = [applyMiddleware(...middlewares)];
|
||||
|
||||
// If Redux DevTools Extension is installed use it, otherwise use Redux compose
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
@ -33,7 +28,7 @@ export default function configureStore(initialState = {}, history) {
|
||||
// TODO Try to remove when `react-router-redux` is out of beta, LOCATION_CHANGE should not be fired more than once after hot reloading
|
||||
// Prevent recomputing reducers for `replaceReducer`
|
||||
shouldHotReload: false,
|
||||
name: `Strapi - Dashboard`,
|
||||
name: 'Strapi - Dashboard',
|
||||
})
|
||||
: compose;
|
||||
/* eslint-enable */
|
||||
@ -41,7 +36,7 @@ export default function configureStore(initialState = {}, history) {
|
||||
const store = createStore(
|
||||
createReducer(),
|
||||
fromJS(initialState),
|
||||
composeEnhancers(...enhancers)
|
||||
composeEnhancers(...enhancers),
|
||||
);
|
||||
|
||||
// Extensions
|
||||
|
||||
@ -296,10 +296,6 @@ Admin.childContextTypes = {
|
||||
updatePlugin: PropTypes.func,
|
||||
};
|
||||
|
||||
Admin.defaultProps = {
|
||||
getHook: () => {},
|
||||
};
|
||||
|
||||
Admin.propTypes = {
|
||||
admin: PropTypes.shape({
|
||||
autoReload: PropTypes.bool,
|
||||
@ -378,12 +374,12 @@ const withLocaleToggleReducer = injectReducer({
|
||||
key: 'localeToggle',
|
||||
reducer: localeToggleReducer,
|
||||
});
|
||||
// const withHooks = injectHooks({ key: 'admin' });
|
||||
const withHooks = injectHooks({ key: 'admin' });
|
||||
|
||||
export default compose(
|
||||
withReducer,
|
||||
withLocaleToggleReducer,
|
||||
withSaga,
|
||||
withConnect,
|
||||
// withHooks,
|
||||
withHooks,
|
||||
)(Admin);
|
||||
|
||||
@ -15,8 +15,10 @@ import LoadingIndicatorPage from 'components/LoadingIndicatorPage';
|
||||
import OverlayBlocker from 'components/OverlayBlocker';
|
||||
|
||||
import injectReducer from '../../../utils/injectReducer';
|
||||
import history from '../../../utils/history';
|
||||
import configureStore from '../../../configureStore';
|
||||
import { messages } from '../../../i18n';
|
||||
import { store } from '../../../createStore';
|
||||
// import { store } from '../../../createStore';
|
||||
import Header from '../../../components/Header/index';
|
||||
import Onboarding from '../../Onboarding';
|
||||
import Logout from '../../../components/Logout';
|
||||
@ -39,6 +41,9 @@ import {
|
||||
|
||||
import styles from '../styles.scss';
|
||||
|
||||
const initialState = {};
|
||||
const store = configureStore(initialState, history);
|
||||
|
||||
const withLocaleToggleReducer = injectReducer({
|
||||
key: 'localeToggle',
|
||||
reducer: localeToggleReducer,
|
||||
|
||||
@ -13,8 +13,6 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
// From strapi-helper-plugin
|
||||
import { LoadingIndicatorPage } from 'strapi-helper-plugin';
|
||||
|
||||
import '../../styles/main.scss';
|
||||
|
||||
@ -1,15 +1,5 @@
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { get } from 'lodash';
|
||||
import {
|
||||
all,
|
||||
fork,
|
||||
call,
|
||||
put,
|
||||
select,
|
||||
takeLatest,
|
||||
take,
|
||||
cancel,
|
||||
} from 'redux-saga/effects';
|
||||
import { all, fork, call, put, select, takeLatest } from 'redux-saga/effects';
|
||||
import { auth, request } from 'strapi-helper-plugin';
|
||||
import { pluginDeleted } from '../App/actions';
|
||||
import { selectLocale } from '../LanguageProvider/selectors';
|
||||
@ -96,9 +86,5 @@ export function* pluginsGet() {
|
||||
// Individual exports for testing
|
||||
export default function* defaultSaga() {
|
||||
yield fork(takeLatest, ON_DELETE_PLUGIN_CONFIRM, deletePlugin);
|
||||
const loadPluginsWatcher = yield fork(takeLatest, GET_PLUGINS, pluginsGet);
|
||||
|
||||
yield take(LOCATION_CHANGE);
|
||||
|
||||
yield cancel(loadPluginsWatcher);
|
||||
yield fork(takeLatest, GET_PLUGINS, pluginsGet);
|
||||
}
|
||||
|
||||
@ -1,14 +1,4 @@
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import {
|
||||
all,
|
||||
call,
|
||||
cancel,
|
||||
fork,
|
||||
put,
|
||||
select,
|
||||
take,
|
||||
takeLatest,
|
||||
} from 'redux-saga/effects';
|
||||
import { all, call, fork, put, select, takeLatest } from 'redux-saga/effects';
|
||||
|
||||
import { request } from 'strapi-helper-plugin';
|
||||
|
||||
@ -92,14 +82,6 @@ export function* getData() {
|
||||
|
||||
// Individual exports for testing
|
||||
export default function* defaultSaga() {
|
||||
const loadDataWatcher = yield fork(
|
||||
takeLatest,
|
||||
GET_AVAILABLE_AND_INSTALLED_PLUGINS,
|
||||
getData,
|
||||
);
|
||||
yield fork(takeLatest, GET_AVAILABLE_AND_INSTALLED_PLUGINS, getData);
|
||||
yield fork(takeLatest, DOWNLOAD_PLUGIN, pluginDownload);
|
||||
|
||||
yield take(LOCATION_CHANGE);
|
||||
|
||||
yield cancel(loadDataWatcher);
|
||||
}
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
/**
|
||||
* Common configuration for the app in both dev an prod mode
|
||||
*/
|
||||
// /**
|
||||
// * Common configuration for the app in both dev an prod mode
|
||||
// */
|
||||
|
||||
import { Provider } from 'react-redux';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { ConnectedRouter } from 'react-router-redux';
|
||||
import LanguageProvider from './containers/LanguageProvider';
|
||||
import App from './containers/App';
|
||||
import { history, store } from './createStore';
|
||||
// import { Provider } from 'react-redux';
|
||||
// import React from 'react';
|
||||
// import ReactDOM from 'react-dom';
|
||||
// import { ConnectedRouter } from 'react-router-redux';
|
||||
// import LanguageProvider from './containers/LanguageProvider';
|
||||
// import App from './containers/App';
|
||||
// import { history, store } from './createStore';
|
||||
|
||||
const render = translatedMessages => {
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<LanguageProvider messages={translatedMessages}>
|
||||
<ConnectedRouter history={history}>
|
||||
<App store={store} />
|
||||
</ConnectedRouter>
|
||||
</LanguageProvider>
|
||||
</Provider>,
|
||||
document.getElementById('app'),
|
||||
);
|
||||
};
|
||||
// const render = translatedMessages => {
|
||||
// ReactDOM.render(
|
||||
// <Provider store={store}>
|
||||
// <LanguageProvider messages={translatedMessages}>
|
||||
// <ConnectedRouter history={history}>
|
||||
// <App store={store} />
|
||||
// </ConnectedRouter>
|
||||
// </LanguageProvider>
|
||||
// </Provider>,
|
||||
// document.getElementById('app'),
|
||||
// );
|
||||
// };
|
||||
|
||||
export default render;
|
||||
// export default render;
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"crypto": "^1.0.1",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
"history": "^4.9.0",
|
||||
"hoist-non-react-statics": "^2.5.5",
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"immutable": "^3.8.2",
|
||||
"intl": "^1.2.5",
|
||||
@ -46,12 +46,11 @@
|
||||
"react-helmet": "^5.2.0",
|
||||
"react-intl": "^2.8.0",
|
||||
"react-loadable": "^5.5.0",
|
||||
"react-router": "^4.3.1",
|
||||
"react-redux": "^5.0.7",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-router-redux": "^5.0.0-alpha.9",
|
||||
"react-redux": "^5.1.1",
|
||||
"react-router": "^5.0.0",
|
||||
"react-router-dom": "^5.0.0",
|
||||
"react-transition-group": "^2.9.0",
|
||||
"reactstrap": "^8.0.0",
|
||||
"reactstrap": "^5.0.0",
|
||||
"redux": "^4.0.1",
|
||||
"redux-immutable": "^4.0.0",
|
||||
"redux-saga": "^0.16.0",
|
||||
@ -111,4 +110,4 @@
|
||||
"npm": ">= 6.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
17
packages/strapi-admin/webpack.alias.js
Normal file
17
packages/strapi-admin/webpack.alias.js
Normal file
@ -0,0 +1,17 @@
|
||||
const path = require('path');
|
||||
const alias = [
|
||||
'core-js',
|
||||
'create-react-context',
|
||||
'invariant',
|
||||
'hoist-non-react-statics',
|
||||
'object-assign',
|
||||
'react-popper',
|
||||
'reactstrap',
|
||||
'whatwg-fetch',
|
||||
];
|
||||
|
||||
module.exports = alias.reduce((acc, curr) => {
|
||||
acc[curr] = path.resolve(__dirname, 'node_modules', curr);
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
@ -10,6 +10,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const WebpackDashboard = require('webpack-dashboard/plugin');
|
||||
const OpenBrowserWebpackPlugin = require('open-browser-webpack-plugin');
|
||||
const DuplicatePckgChecker = require('duplicate-package-checker-webpack-plugin');
|
||||
const alias = require('./webpack.alias.js');
|
||||
|
||||
const devMode = process.env.NODE_ENV !== 'production';
|
||||
const prodMode = process.env.NODE_ENV === 'production';
|
||||
@ -26,44 +27,41 @@ const PORT = 4000;
|
||||
|
||||
const webpackPlugins = devMode
|
||||
? [
|
||||
new WebpackDashboard(),
|
||||
new DuplicatePckgChecker({
|
||||
verbose: true,
|
||||
exclude(instance) {
|
||||
return instance.name === 'core-js';
|
||||
},
|
||||
}),
|
||||
new OpenBrowserWebpackPlugin({
|
||||
url: `http://localhost:${PORT}/${URLs.publicPath}`,
|
||||
}),
|
||||
]
|
||||
new WebpackDashboard(),
|
||||
new DuplicatePckgChecker({
|
||||
verbose: true,
|
||||
}),
|
||||
new OpenBrowserWebpackPlugin({
|
||||
url: `http://localhost:${PORT}/${URLs.publicPath}`,
|
||||
}),
|
||||
]
|
||||
: [
|
||||
new webpack.IgnorePlugin({
|
||||
resourceRegExp: /^\.\/locale$/,
|
||||
contextRegExp: /moment$/,
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
new webpack.IgnorePlugin({
|
||||
resourceRegExp: /^\.\/locale$/,
|
||||
contextRegExp: /moment$/,
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
// Options similar to the same options in webpackOptions.output
|
||||
// both options are optional
|
||||
filename: devMode ? '[name].css' : '[name].[chunkhash].js',
|
||||
chunkFilename: devMode
|
||||
filename: devMode ? '[name].css' : '[name].[chunkhash].js',
|
||||
chunkFilename: devMode
|
||||
? '[name].chunk.css'
|
||||
: '[name].[chunkhash].chunkhash.css',
|
||||
}),
|
||||
];
|
||||
}),
|
||||
];
|
||||
|
||||
// Use style loader in dev mode to optimize compilation
|
||||
const scssLoader = devMode
|
||||
? ['style-loader']
|
||||
: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
fallback: require.resolve('style-loader'),
|
||||
publicPath: URLs.publicPath,
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
fallback: require.resolve('style-loader'),
|
||||
publicPath: URLs.publicPath,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
@ -216,15 +214,7 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
// modules: [
|
||||
// // TODO handle resolved paths
|
||||
// // path.resolve(__dirname, 'admin/src'),
|
||||
// // path.resolve(__dirname, '../strapi-helper-plugin/lib/src'),
|
||||
// // path.resolve(__dirname, 'node_modules/strapi-helper-plugin/lib/src'),
|
||||
// // path.resolve(__dirname, 'node_modules/strapi-helper-plugin/node_modules'),
|
||||
// // path.resolve(__dirname, 'node_modules'),
|
||||
// // 'node_modules',
|
||||
// ],
|
||||
alias,
|
||||
symlinks: false,
|
||||
extensions: ['.js', '.jsx', '.react.js'],
|
||||
},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// // CommonPropTypes
|
||||
export { default as routerPropTypes } from './commonPropTypes/router/index.js';
|
||||
export { default as routerPropTypes } from './commonPropTypes/router';
|
||||
|
||||
// // Components
|
||||
export { default as BackHeader } from './components/BackHeader';
|
||||
|
||||
@ -30,11 +30,15 @@
|
||||
"lint:admin"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"immutable": "^3.8.2",
|
||||
"invariant": "^2.2.1",
|
||||
"react": "^16.0.0",
|
||||
"react-router": "^5.0.0",
|
||||
"reactstrap": "^5.0.0",
|
||||
"react-dom": "^16.0.0",
|
||||
"react-intl": "^2.8.0",
|
||||
"react-router": "^5.0.0",
|
||||
"react-router-dom": "^5.0.0",
|
||||
"react-intl": "^2.8.0"
|
||||
"react-transition-group": "^2.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.4.3",
|
||||
@ -80,12 +84,10 @@
|
||||
"react-dom": "^16.8.6",
|
||||
"react-intl": "^2.8.0",
|
||||
"react-loadable": "^5.5.0",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-router-redux": "^5.0.0-alpha.9",
|
||||
"react-router-dom": "^5.0.0",
|
||||
"react-transition-group": "^2.5.0",
|
||||
"reactstrap": "^5.0.0",
|
||||
"reselect": "^3.0.1",
|
||||
"styled-components": "^3.2.6",
|
||||
"whatwg-fetch": "^2.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user