mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
Split EE and CE
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
a8ace25056
commit
6945c6e12d
@ -20,6 +20,7 @@ import {
|
|||||||
LoadingIndicatorPage,
|
LoadingIndicatorPage,
|
||||||
OverlayBlocker,
|
OverlayBlocker,
|
||||||
} from 'strapi-helper-plugin';
|
} from 'strapi-helper-plugin';
|
||||||
|
import TestEE from 'ee_else_ce/containers/TestEE';
|
||||||
import { SETTINGS_BASE_URL, SHOW_TUTORIALS } from '../../config';
|
import { SETTINGS_BASE_URL, SHOW_TUTORIALS } from '../../config';
|
||||||
|
|
||||||
import Header from '../../components/Header/index';
|
import Header from '../../components/Header/index';
|
||||||
@ -188,6 +189,8 @@ export class Admin extends React.Component {
|
|||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/" render={props => this.renderRoute(props, HomePage)} exact />
|
<Route path="/" render={props => this.renderRoute(props, HomePage)} exact />
|
||||||
<Route path="/me" component={ProfilePage} />
|
<Route path="/me" component={ProfilePage} />
|
||||||
|
{/* TODO remove this Route it is just made for the test */}
|
||||||
|
<Route path="/test" component={TestEE} />
|
||||||
<Route path="/plugins/:pluginId" render={this.renderPluginDispatcher} />
|
<Route path="/plugins/:pluginId" render={this.renderPluginDispatcher} />
|
||||||
<Route
|
<Route
|
||||||
path="/list-plugins"
|
path="/list-plugins"
|
||||||
|
|||||||
11
packages/strapi-admin/admin/src/containers/TestEE/index.js
Normal file
11
packages/strapi-admin/admin/src/containers/TestEE/index.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const Test = () => {
|
||||||
|
return (
|
||||||
|
<section style={{ textAlign: 'center' }}>
|
||||||
|
<h1>Admin test CE version</h1>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Test;
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const Test = () => {
|
||||||
|
return (
|
||||||
|
<section style={{ textAlign: 'center' }}>
|
||||||
|
<h1>Admin EE version</h1>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Test;
|
||||||
7
packages/strapi-admin/is_ee_env.js
Normal file
7
packages/strapi-admin/is_ee_env.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// TODO: this condition might change
|
||||||
|
|
||||||
|
const fs = require('fs-extra');
|
||||||
|
const path = require('path');
|
||||||
|
const appSrc = path.join(__dirname, 'admin', 'src');
|
||||||
|
|
||||||
|
module.exports = fs.existsSync(path.join(appSrc, 'ee'));
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
const alias = [
|
const alias = [
|
||||||
'object-assign',
|
'object-assign',
|
||||||
'whatwg-fetch',
|
'whatwg-fetch',
|
||||||
@ -52,5 +54,6 @@ module.exports = alias.reduce(
|
|||||||
'react-select/async-creatable': require.resolve('react-select/async-creatable'),
|
'react-select/async-creatable': require.resolve('react-select/async-creatable'),
|
||||||
'react-select/base': require.resolve('react-select/base'),
|
'react-select/base': require.resolve('react-select/base'),
|
||||||
'react-select/creatable': require.resolve('react-select/creatable'),
|
'react-select/creatable': require.resolve('react-select/creatable'),
|
||||||
|
ee_else_ce: path.resolve(__dirname),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|||||||
const WebpackBar = require('webpackbar');
|
const WebpackBar = require('webpackbar');
|
||||||
const isWsl = require('is-wsl');
|
const isWsl = require('is-wsl');
|
||||||
const alias = require('./webpack.alias.js');
|
const alias = require('./webpack.alias.js');
|
||||||
|
const IS_EE = require('./is_ee_env');
|
||||||
// TODO: parametrize
|
// TODO: parametrize
|
||||||
const URLs = {
|
const URLs = {
|
||||||
mode: 'host',
|
mode: 'host',
|
||||||
@ -60,9 +60,7 @@ module.exports = ({
|
|||||||
// Utilize long-term caching by adding content hashes (not compilation hashes)
|
// Utilize long-term caching by adding content hashes (not compilation hashes)
|
||||||
// to compiled assets for production
|
// to compiled assets for production
|
||||||
filename: isProduction ? '[name].[contenthash:8].js' : 'bundle.js',
|
filename: isProduction ? '[name].[contenthash:8].js' : 'bundle.js',
|
||||||
chunkFilename: isProduction
|
chunkFilename: isProduction ? '[name].[contenthash:8].chunk.js' : '[name].chunk.js',
|
||||||
? '[name].[contenthash:8].chunk.js'
|
|
||||||
: '[name].chunk.js',
|
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: optimize,
|
minimize: optimize,
|
||||||
@ -115,9 +113,7 @@ module.exports = ({
|
|||||||
require.resolve('@babel/plugin-proposal-class-properties'),
|
require.resolve('@babel/plugin-proposal-class-properties'),
|
||||||
require.resolve('@babel/plugin-syntax-dynamic-import'),
|
require.resolve('@babel/plugin-syntax-dynamic-import'),
|
||||||
require.resolve('@babel/plugin-transform-modules-commonjs'),
|
require.resolve('@babel/plugin-transform-modules-commonjs'),
|
||||||
require.resolve(
|
require.resolve('@babel/plugin-proposal-async-generator-functions'),
|
||||||
'@babel/plugin-proposal-async-generator-functions'
|
|
||||||
),
|
|
||||||
[
|
[
|
||||||
require.resolve('@babel/plugin-transform-runtime'),
|
require.resolve('@babel/plugin-transform-runtime'),
|
||||||
{
|
{
|
||||||
@ -182,16 +178,29 @@ module.exports = ({
|
|||||||
// favicon: path.resolve(__dirname, 'admin/src/favicon.ico'),
|
// favicon: path.resolve(__dirname, 'admin/src/favicon.ico'),
|
||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env.NODE_ENV': JSON.stringify(
|
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development'),
|
||||||
isProduction ? 'production' : 'development'
|
|
||||||
),
|
|
||||||
NODE_ENV: JSON.stringify(isProduction ? 'production' : 'development'),
|
NODE_ENV: JSON.stringify(isProduction ? 'production' : 'development'),
|
||||||
REMOTE_URL: JSON.stringify(options.publicPath),
|
REMOTE_URL: JSON.stringify(options.publicPath),
|
||||||
BACKEND_URL: JSON.stringify(options.backend),
|
BACKEND_URL: JSON.stringify(options.backend),
|
||||||
MODE: JSON.stringify(URLs.mode), // Allow us to define the public path for the plugins assets.
|
MODE: JSON.stringify(URLs.mode), // Allow us to define the public path for the plugins assets.
|
||||||
PUBLIC_PATH: JSON.stringify(options.publicPath),
|
PUBLIC_PATH: JSON.stringify(options.publicPath),
|
||||||
}),
|
}),
|
||||||
|
new webpack.NormalModuleReplacementPlugin(/ee_else_ce(\.*)/, function(resource) {
|
||||||
|
// We might need to improve this if we want to make it work with components
|
||||||
|
const containerPathName = resource.context.split('/containers/');
|
||||||
|
|
||||||
|
if (IS_EE) {
|
||||||
|
resource.request = resource.request.replace(
|
||||||
|
/ee_else_ce/,
|
||||||
|
path.join(containerPathName[0], 'ee')
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
resource.request = resource.request.replace(
|
||||||
|
/ee_else_ce/,
|
||||||
|
path.join(containerPathName[0])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
...webpackPlugins,
|
...webpackPlugins,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user