Simplify config for admin removal

This commit is contained in:
Damian Mooyman 2017-03-10 13:48:26 +13:00
parent 5c96070038
commit 810dcab748
4 changed files with 14 additions and 277 deletions

View File

@ -1,11 +1,11 @@
<?php
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Assets\File;
use SilverStripe\Assets\Image;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\HtmlEditor\EmbedShortcodeProvider;
use SilverStripe\View\Parsers\ShortcodeParser;
/**
* Framework configuration file
*
@ -21,19 +21,13 @@ use SilverStripe\View\Parsers\ShortcodeParser;
*/
ShortcodeParser::get('default')
->register('file_link', array('SilverStripe\\Assets\\File', 'handle_shortcode'))
->register('embed', array('SilverStripe\\Forms\\HtmlEditor\\EmbedShortcodeProvider', 'handle_shortcode'))
->register('image', array('SilverStripe\\Assets\\Image', 'handle_shortcode'));
->register('file_link', array(File::class, 'handle_shortcode'))
->register('embed', array(EmbedShortcodeProvider::class, 'handle_shortcode'))
->register('image', array(Image::class, 'handle_shortcode'));
// Shortcode parser which only regenerates shortcodes
ShortcodeParser::get('regenerator')
->register('image', array('SilverStripe\\Assets\\Image', 'regenerate_shortcode'));
// @todo
// ->register('dbfile_link', array('DBFile', 'handle_shortcode'))
->register('image', array(Image::class, 'regenerate_shortcode'));
// If you don't want to see deprecation errors for the new APIs, change this to 3.2.0-dev.
Deprecation::notification_version('3.2.0');
// TODO Remove once new ManifestBuilder with submodule support is in place
require_once('admin/_config.php');

View File

@ -13,9 +13,7 @@
"build": "webpack --bail --progress",
"watch": "webpack --progress --config ./webpack-dev.config.js --watch",
"css": "WEBPACK_CHILD=css webpack",
"test": "jest",
"coverage": "NODE_PATH=\"./client/src:./admin/client/src\" jest --coverage",
"lint": "eslint client/src && eslint admin/client/src && sass-lint -v"
"lint": "sass-lint -v"
},
"repository": {
"type": "git",
@ -31,90 +29,17 @@
"url": "https://github.com/silverstripe/silverstripe-framework/issues"
},
"homepage": "https://github.com/silverstripe/silverstripe-framework#readme",
"dependencies": {
"apollo-client": "^0.5.5",
"babel-polyfill": "^6.7.4",
"bootstrap": "4.0.0-alpha.2",
"chosen-js": "^1.5.1",
"deep-equal": "^1.0.1",
"deep-freeze-strict": "^1.1.1",
"es6-promise": "^3.1.2",
"graphql-fragments": "^0.1.0",
"graphql-tag": "^0.1.17",
"history": "^2.1.2",
"isomorphic-fetch": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz",
"jquery-sizes": "^0.33.0",
"json-js": "^1.1.2",
"merge": "^1.2.0",
"page.js": "^4.13.3",
"qs": "^6.1.0",
"react": "^15.3.1",
"react-addons-css-transition-group": "^15.3.1",
"react-apollo": "^0.7.0",
"react-bootstrap-ss": "^0.30.6",
"react-dnd": "^2.2.3",
"react-dnd-html5-backend": "^2.2.3",
"react-dom": "^15.3.1",
"react-redux": "^4.4.1",
"react-router": "^2.4.1",
"react-router-redux": "^4.0.5",
"redux": "https://registry.npmjs.org/redux/-/redux-3.0.5.tgz",
"redux-form": "^6.0.2",
"redux-thunk": "^2.1.0",
"tether": "^1.3.2",
"url": "^0.11.0",
"validator": "^6.1.0"
},
"devDependencies": {
"autoprefixer": "^6.4.0",
"babel-core": "^6.7.4",
"babel-jest": "^19.0.0",
"babel-loader": "^6.2.5",
"babel-plugin-transform-es2015-modules-umd": "^6.6.5",
"babel-plugin-transform-object-assign": "^6.5.0",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"css-loader": "^0.23.1",
"eslint": "^2.5.3",
"eslint-config-airbnb": "^6.2.0",
"eslint-plugin-react": "^4.2.3",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"imports-loader": "^0.6.5",
"jest-cli": "^19.0.2",
"node-sass": "^3.8.0",
"postcss-loader": "^0.10.1",
"react-addons-test-utils": "^15.3.1",
"redux-logger": "^2.6.1",
"webpack": "^1.13.2",
"resolve-url-loader": "^1.6.0",
"sass-lint": "^1.9.1",
"sass-loader": "^4.0.0",
"script-loader": "^0.7.0",
"url-loader": "^0.5.8",
"webpack": "^1.13.2"
},
"jest": {
"roots": [
"admin/client/src",
"client/src"
],
"modulePaths": [
"admin/client/src",
"client/src"
],
"testMatch": [
"**/tests/**/*-test.js?(x)"
],
"transform": {
".*": "babel-jest"
}
},
"babel": {
"presets": [
"react",
"es2015"
]
"node-sass": "^3.8.0",
"css-loader": "^0.23.1",
"file-loader": "^0.9.0",
"postcss-loader": "^0.10.1"
}
}

View File

@ -18,8 +18,6 @@
* - THEMES_PATH: Absolute filepath, e.g. "/var/www/my-webroot/themes"
* - FRAMEWORK_DIR: Path relative to webroot, e.g. "framework"
* - FRAMEWORK_PATH:Absolute filepath, e.g. "/var/www/my-webroot/framework"
* - FRAMEWORK_ADMIN_DIR: Path relative to webroot, e.g. "framework/admin"
* - FRAMEWORK_ADMIN_PATH: Absolute filepath, e.g. "/var/www/my-webroot/framework/admin"
* - THIRDPARTY_DIR: Path relative to webroot, e.g. "framework/thirdparty"
* - THIRDPARTY_PATH: Absolute filepath, e.g. "/var/www/my-webroot/framework/thirdparty"
* - TRUSTED_PROXY: true or false, depending on whether the X-Forwarded-* HTTP
@ -137,15 +135,9 @@ if (strpos(FRAMEWORK_PATH, BASE_PATH) === 0) {
throw new Exception("Path error: FRAMEWORK_PATH " . FRAMEWORK_PATH . " not within BASE_PATH " . BASE_PATH);
}
define('FRAMEWORK_ADMIN_DIR', $frameworkDirSlashSuffix . 'admin');
define('FRAMEWORK_ADMIN_PATH', FRAMEWORK_PATH . '/admin');
define('THIRDPARTY_DIR', $frameworkDirSlashSuffix . 'thirdparty');
define('THIRDPARTY_PATH', FRAMEWORK_PATH . '/thirdparty');
define('ADMIN_THIRDPARTY_DIR', FRAMEWORK_ADMIN_DIR . '/thirdparty');
define('ADMIN_THIRDPARTY_PATH', BASE_PATH . '/' . ADMIN_THIRDPARTY_DIR);
if (!defined('ASSETS_DIR')) {
define('ASSETS_DIR', 'assets');
}

View File

@ -1,18 +1,9 @@
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
// const SprityWebpackPlugin = require('sprity-webpack-plugin');
const PATHS = {
MODULES: './node_modules',
ADMIN: './admin',
ADMIN_IMAGES: './admin/client/dist/images',
ADMIN_CSS_SRC: './admin/client/src/styles',
ADMIN_CSS_DIST: './admin/client/dist/styles',
ADMIN_THIRDPARTY: './admin/thirdparty',
ADMIN_JS_SRC: './admin/client/src',
ADMIN_JS_DIST: './admin/client/dist/js',
FRAMEWORK: '.',
FRAMEWORK_THIRDPARTY: './thirdparty',
FRAMEWORK_CSS_SRC: './client/src/styles',
@ -35,166 +26,6 @@ const SUPPORTED_BROWSERS = [
];
const config = [
{
// TODO Split out with new 'admin' module
name: 'js',
entry: {
vendor: `${PATHS.ADMIN_JS_SRC}/bundles/vendor.js`,
bundle: `${PATHS.ADMIN_JS_SRC}/bundles/bundle.js`,
'LeftAndMain.Ping': `${PATHS.ADMIN_JS_SRC}/legacy/LeftAndMain.Ping.js`,
leaktools: `${PATHS.ADMIN_JS_SRC}/legacy/leaktools.js`,
MemberImportForm: `${PATHS.ADMIN_JS_SRC}/legacy/MemberImportForm.js`,
TinyMCE_sslink: `${PATHS.ADMIN_JS_SRC}/legacy/TinyMCE_sslink.js`,
},
resolve: {
root: [__dirname, path.resolve(__dirname, PATHS.ADMIN_JS_SRC)],
modulesDirectories: [PATHS.MODULES],
},
output: {
path: 'admin/client/dist',
filename: 'js/[name].js',
},
// lib.js provies these globals and more. These references allow the framework bundle
// to access them.
externals: {
'apollo-client': 'ApolloClient',
'bootstrap-collapse': 'BootstrapCollapse',
'components/Breadcrumb/Breadcrumb': 'Breadcrumb',
'state/breadcrumbs/BreadcrumbsActions': 'BreadcrumbsActions',
'state/schema/SchemaActions': 'SchemaActions',
'components/FieldHolder/FieldHolder': 'FieldHolder',
'components/FormAction/FormAction': 'FormAction',
'components/FormBuilder/FormBuilder': 'FormBuilder',
'components/FormBuilderModal/FormBuilderModal': 'FormBuilderModal',
'components/GridField/GridField': 'GridField',
'components/Toolbar/Toolbar': 'Toolbar',
'containers/FormBuilderLoader/FormBuilderLoader': 'FormBuilderLoader',
'deep-freeze-strict': 'DeepFreezeStrict',
'graphql-fragments': 'GraphQLFragments',
'graphql-tag': 'GraphQLTag',
i18n: 'i18n',
jquery: 'jQuery',
'lib/Backend': 'Backend',
'lib/ReducerRegister': 'ReducerRegister',
'lib/ReactRouteRegister': 'ReactRouteRegister',
'lib/SilverStripeComponent': 'SilverStripeComponent',
'page.js': 'Page',
'react-addons-test-utils': 'ReactAddonsTestUtils',
'react-dom': 'ReactDom',
tether: 'Tether',
'react-apollo': 'ReactApollo',
'react-bootstrap-ss': 'ReactBootstrap',
'react-redux': 'ReactRedux',
'react-router-redux': 'ReactRouterRedux',
'react-router': 'ReactRouter',
'react-addons-css-transition-group': 'ReactAddonsCssTransitionGroup',
react: 'React',
'redux-form': 'ReduxForm',
'redux-thunk': 'ReduxThunk',
redux: 'Redux',
config: 'Config',
'lib/Router': 'Router',
qs: 'qs',
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|thirdparty)/,
loader: 'babel',
query: {
presets: ['es2015', 'react'],
plugins: ['transform-object-assign', 'transform-object-rest-spread'],
comments: false,
},
},
{
test: '/i18n.js/',
loader: 'script-loader',
},
],
},
plugins: [
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
}),
new webpack.DefinePlugin({
'process.env':{
// Builds React in production mode, avoiding console warnings
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
unused: false,
warnings: false,
},
output: {
beautify: false,
semicolons: false,
comments: false,
max_line_len: 200,
},
}),
// Most vendor libs are loaded directly into the 'vendor' bundle (through require()
// calls in vendor.js). This ensures that any further require() calls in other
// bundles aren't duplicating libs.
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
}),
],
},
{
// TODO Split out with new 'admin' module
name: 'css',
entry: {
bundle: `${PATHS.ADMIN_CSS_SRC}/bundle.scss`,
editor: `${PATHS.ADMIN_CSS_SRC}/editor.scss`,
GridField_print: `${PATHS.ADMIN_CSS_SRC}/legacy/GridField_print.scss`,
},
output: {
path: 'admin/client/dist/styles',
filename: '[name].css',
},
module: {
loaders: [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract([
'css?sourceMap&minimize&-core&discardComments',
'postcss?sourceMap',
'resolve-url',
'sass?sourceMap',
]),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract([
'css?sourceMap&minimize&-core&discardComments',
'postcss?sourceMap',
]),
},
{
test: /\.(png|gif|jpg|svg)$/,
exclude: /fonts\/([\w_-]+)\.svg$/,
loader: 'url?limit=10000&name=../images/[name].[ext]',
},
{
test: /fonts\/([\w_-]+)\.(woff|eot|ttf|svg)$/,
loader: 'file?name=../fonts/[name].[ext]',
},
],
},
postcss: [
autoprefixer({ browsers: SUPPORTED_BROWSERS }),
],
plugins: [
new ExtractTextPlugin('[name].css', { allChunks: true }),
],
},
{
name: 'framework-css',
entry: {
@ -225,12 +56,7 @@ const config = [
},
{
test: /\.(png|gif|jpg|svg)$/,
exclude: /fonts\/([\w_-]+)\.svg$/,
loader: `url-loader?limit=10000&name=../images/[name].[ext]`,
},
{
test: /fonts\/([\w_-]+)\.(woff|eot|ttf|svg)$/,
loader: 'file?name=../fonts/[name].[ext]',
loader: 'url-loader?limit=10000&name=../images/[name].[ext]',
},
],
},