Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace browserify/gulp with Webpack #5918

Merged
merged 27 commits into from
Sep 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2e577dd
API Use Webpack
Aug 21, 2016
a6049ec
FIX: Use chosen from npm package.
Aug 21, 2016
8e89d08
API: Remove js/css requirements include from form fields.
Aug 23, 2016
1b527fc
FIX Webpack handles images & fonts.
Aug 26, 2016
08adac8
Updated npm-shrinkwrap in order to build lock file
chillu Aug 28, 2016
2bd4857
Add new FormBuilderModal (required for asset-admin)
chillu Aug 29, 2016
aea96f2
Enable UglifyJS mangling
chillu Aug 30, 2016
c9d964f
Fix HTMLEditorField image reference
chillu Sep 1, 2016
5f7b13e
API Removed unused images across CMS UI
chillu Sep 1, 2016
0a380a9
API Removed unused UMD builds of individual JS files
chillu Sep 7, 2016
9cb9a05
API Removed duplicated thirdparty deps
chillu Sep 7, 2016
25b511f
Build React in production mode by default
chillu Sep 10, 2016
701c700
Fixed UploadField JS dependencies
chillu Sep 10, 2016
25f4741
Removed ModelAdmin/SecurityAdmin Webpack entry points
chillu Sep 10, 2016
6be25f3
Entry point for UploadField_select.js
chillu Sep 10, 2016
e5df794
Move incorrect lang file location
Sep 13, 2016
ee10dbb
API Moved frontend assets into admin/ "module"
chillu Sep 13, 2016
2316b0d
API Remove i18n::js_i18n option
chillu Sep 13, 2016
abaebbe
FIX Manually fix issue in jquery-ui 1.9
Sep 14, 2016
8e5dd58
Removed unused dist files
chillu Sep 14, 2016
8eac22c
Separate CSS bundling in Webpack
chillu Sep 14, 2016
686c167
Removed TinyMCE NPM dep
chillu Sep 14, 2016
7d67b24
API Removed legacy Jasmine JS Unit tests
chillu Sep 15, 2016
8f23fa9
API Moved CMS-specific JavaScript to admin/thirdparty
chillu Sep 15, 2016
30174db
FIx i18n JS regression about locale selection
chillu Sep 15, 2016
556667c
Removed unused "npm run sanity"
chillu Sep 16, 2016
3d7c60f
Updated dist files
chillu Sep 14, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 20 additions & 20 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ client/dist/
admin/client/dist/

# Ignore legacy files
client/src/legacy/AssetUploadField.js
client/src/legacy/ConfirmedPasswordField.js
client/src/legacy/DateField.js
client/src/legacy/GridField.js
client/src/legacy/HtmlEditorField.js
client/src/legacy/InlineFormAction.js
client/src/legacy/PermissionCheckboxSetField.js
client/src/legacy/SelectionGroup.js
client/src/legacy/TabSet.js
client/src/legacy/TinyMCE_SSPlugin.js
client/src/legacy/ToggleCompositeField.js
client/src/legacy/ToggleField.js
client/src/legacy/TreeDropdownField.js
client/src/legacy/UploadField.js
client/src/legacy/UploadField_downloadtemplate.js
client/src/legacy/UploadField_select.js
client/src/legacy/UploadField_uploadtemplate.js
client/src/i18n.js
client/src/i18nx.js
client/src/jQuery.js
admin/client/src/legacy/AssetUploadField.js
admin/client/src/legacy/ConfirmedPasswordField.js
admin/client/src/legacy/DateField.js
admin/client/src/legacy/GridField.js
admin/client/src/legacy/HtmlEditorField.js
admin/client/src/legacy/InlineFormAction.js
admin/client/src/legacy/PermissionCheckboxSetField.js
admin/client/src/legacy/SelectionGroup.js
admin/client/src/legacy/TabSet.js
admin/client/src/legacy/TinyMCE_SSPlugin.js
admin/client/src/legacy/ToggleCompositeField.js
admin/client/src/legacy/ToggleField.js
admin/client/src/legacy/TreeDropdownField.js
admin/client/src/legacy/UploadField.js
admin/client/src/legacy/UploadField_downloadtemplate.js
admin/client/src/legacy/UploadField_select.js
admin/client/src/legacy/UploadField_uploadtemplate.js
admin/client/src/i18n.js
admin/client/src/i18nx.js
admin/client/src/jQuery.js
admin/client/src/legacy/LeftAndMain.js
admin/client/src/legacy/LeftAndMain.*.js
admin/client/src/legacy/CMSSecurity.js
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ admin/thirdparty/chosen/node_modules
node_modules/
coverage/
/**/*.js.map
/**/*.css.map
2 changes: 2 additions & 0 deletions .scss-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ scss_files: '**/client/src/**/*.scss'
exclude:
- 'client/src/styles/legacy/*'
- 'admin/client/src/styles/legacy/*'
- 'admin/client/src/font/styles.css'


severity: error

Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ script:
- "if [ \"$BEHAT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"\" ]; then vendor/bin/behat @framework; fi"
- "if [ \"$PHPUNIT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"1\" ]; then vendor/bin/phpunit cms/tests; fi"
- "if [ \"$BEHAT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"1\" ]; then vendor/bin/behat @cms; fi"
- "if [ \"$NPM_TEST\" = \"1\" ]; then npm run sanity; fi"
- "if [ \"$NPM_TEST\" = \"1\" ]; then npm run test; fi"

after_failure:
Expand Down
3 changes: 3 additions & 0 deletions Core/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@
define('THIRDPARTY_DIR', FRAMEWORK_DIR . '/thirdparty');
define('THIRDPARTY_PATH', BASE_PATH . '/' . THIRDPARTY_DIR);

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');
}
Expand Down
5 changes: 2 additions & 3 deletions Dev/Install/client/dist/styles/install.css

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Dev/Install/client/src/styles/install.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ body {
letter-spacing: -0.5px;
}
h1 {
background: transparent url(../../../admin/images/logo.gif) no-repeat left top;
background: transparent url(../images/logo.gif) no-repeat left top;
text-indent: -9999px;
height: 164px;
width: 161px;
Expand Down Expand Up @@ -173,7 +173,7 @@ body {
padding-left: 20px;
color: #666;
margin-top: 0;
background: transparent url(../../../admin/images/question.png) no-repeat left 1px;
background: transparent url(../images/question.png) no-repeat left 1px;
&.requirementsHelpText {
margin-top: 17px;
}
Expand Down Expand Up @@ -410,9 +410,9 @@ body {
text-decoration: none;
font-weight: normal;
padding-right: 21px;
background: transparent url(../../../admin/images/arrows.png) no-repeat right top;
background: transparent url(../images/arrows.png) no-repeat right top;
&:hover {
background: transparent url(../../../admin/images/arrows.png) no-repeat right -40px;
background: transparent url(../images/arrows.png) no-repeat right -40px;
}
}
}
Expand Down
21 changes: 0 additions & 21 deletions Forms/AssetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,27 +501,6 @@ public function extraClass() {
}

public function Field($properties = array()) {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/ssui.core.js');
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/client/lang');

Requirements::combine_files('uploadfield.js', array(
// @todo jquery templates is a project no longer maintained and should be retired at some point.
THIRDPARTY_DIR . '/javascript-templates/tmpl.js',
THIRDPARTY_DIR . '/javascript-loadimage/load-image.js',
THIRDPARTY_DIR . '/jquery-fileupload/jquery.iframe-transport.js',
THIRDPARTY_DIR . '/jquery-fileupload/cors/jquery.xdr-transport.js',
THIRDPARTY_DIR . '/jquery-fileupload/jquery.fileupload.js',
THIRDPARTY_DIR . '/jquery-fileupload/jquery.fileupload-ui.js',
FRAMEWORK_DIR . '/client/dist/js/UploadField_uploadtemplate.js',
FRAMEWORK_DIR . '/client/dist/js/UploadField_downloadtemplate.js',
FRAMEWORK_DIR . '/client/dist/js/UploadField.js',
));
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); // TODO hmmm, remove it?
Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/UploadField.css');

// Calculated config as per jquery.fileupload-ui.js
$config = array(
'allowedMaxFileNumber' => 1, // Only one file allowed for AssetField
Expand Down
2 changes: 0 additions & 2 deletions Forms/CheckboxSetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class CheckboxSetField extends MultiSelectField {
* @return DBHTMLText
*/
public function Field($properties = array()) {
Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/CheckboxSetField.css');

$properties = array_merge($properties, array(
'Options' => $this->getOptions()
));
Expand Down
10 changes: 6 additions & 4 deletions Forms/ConfirmedPasswordField.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
*
* Optionally hides the fields by default and shows a link to toggle their
* visibility.
*
* Caution: The form field does not include any JavaScript or CSS when used outside of the CMS context,
* since the required frontend dependencies are included through CMS bundling.
*/
class ConfirmedPasswordField extends FormField {

Expand Down Expand Up @@ -54,6 +57,9 @@ class ConfirmedPasswordField extends FormField {
* This behaviour works unobtrusively, without JavaScript enabled
* the fields show, validate and save by default.
*
* Caution: The form field does not include any JavaScript or CSS when used outside of the CMS context,
* since the required frontend dependencies are included through CMS bundling.
*
* @param boolean $showOnClick
*/
protected $showOnClick = false;
Expand Down Expand Up @@ -172,10 +178,6 @@ public function setTitle($title)
* @return string
*/
public function Field($properties = array()) {
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/client/dist/js/ConfirmedPasswordField.js');
Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/ConfirmedPasswordField.css');

$content = '';

if($this->showOnClick) {
Expand Down
3 changes: 3 additions & 0 deletions Forms/DateField.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
* Example: <code>$myDateField->setConfig('jQueryUI.showWeek', true);</code>
* See http://docs.jquery.com/UI/Datepicker for details.
*
* Caution: The form field does not include any JavaScript or CSS when used outside of the CMS context,
* since the required frontend dependencies are included through CMS bundling.
*
* # Localization
*
* The field will get its default locale from {@link i18n::get_locale()}, and set the `dateformat`
Expand Down
6 changes: 0 additions & 6 deletions Forms/DateField_View_JQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,10 @@ public function onBeforeRender()
public function onAfterRender($html)
{
if ($this->getField()->getConfig('showcalendar')) {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');

// Include language files (if required)
if ($this->jqueryLocaleFile) {
Requirements::javascript($this->jqueryLocaleFile);
}

Requirements::javascript(FRAMEWORK_DIR . "/client/dist/js/DateField.js");
}

return $html;
Expand Down
1 change: 0 additions & 1 deletion Forms/DatetimeField.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public function FieldHolder($properties = array()) {
* @return string
*/
public function Field($properties = array()) {
Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/DatetimeField.css');
return parent::Field($properties);
}

Expand Down
13 changes: 3 additions & 10 deletions Forms/GridField/GridField.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
* $gridField = new GridField('ExampleGrid', 'Example grid', new DataList('Page'));
* </code>
*
* Caution: The form field does not include any JavaScript or CSS when used outside of the CMS context,
* since the required frontend dependencies are included through CMS bundling.
*
* @see SS_List
*
* @property GridState_Data $State The gridstate of this object
Expand Down Expand Up @@ -306,16 +309,6 @@ public function getState($getData = true) {
* @return string
*/
public function FieldHolder($properties = array()) {
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/GridField.css');

Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
Requirements::javascript(FRAMEWORK_DIR . '/client/dist/js/i18n.js');
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/client/lang');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_DIR . '/client/dist/js/GridField.js');

$columns = $this->getColumns();

$list = $this->getManipulatedList();
Expand Down
3 changes: 3 additions & 0 deletions Forms/HTMLEditor/HTMLEditorField.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
/**
* A TinyMCE-powered WYSIWYG HTML editor field with image and link insertion and tracking capabilities. Editor fields
* are created from <textarea> tags, which are then converted with JavaScript.
*
* Caution: The form field does not include any JavaScript or CSS when used outside of the CMS context,
* since the required frontend dependencies are included through CMS bundling.
*/
class HTMLEditorField extends TextareaField {

Expand Down
2 changes: 1 addition & 1 deletion Forms/HTMLEditor/HTMLEditorField_Embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function getPreviewURL()
}

// Default media
return FRAMEWORK_DIR . '/images/default_media.png';
return FRAMEWORK_ADMIN_DIR . '/client/dist/images/src/default_media.png';
}

public function getName()
Expand Down
2 changes: 1 addition & 1 deletion Forms/HTMLEditor/HTMLEditorField_Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function MediaForm()
$remoteURL->addExtraClass('remoteurl');
$fromWeb->addExtraClass('content ss-uploadfield htmleditorfield-from-web');

Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/AssetUploadField.css');
Requirements::css(FRAMEWORK_ADMIN_DIR . '/client/dist/styles/AssetUploadField.css');
$computerUploadField = UploadField::create('AssetUploadField', '');
$computerUploadField->setConfig('previewMaxWidth', 40);
$computerUploadField->setConfig('previewMaxHeight', 30);
Expand Down
17 changes: 4 additions & 13 deletions Forms/HTMLEditor/TinyMCEConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TinyMCEConfig extends HTMLEditorConfig {
* @config
* @var string
*/
private static $base_dir = 'framework/thirdparty/tinymce';
private static $base_dir = 'framework/admin/thirdparty/tinymce';

/**
* TinyMCE JS settings
Expand Down Expand Up @@ -448,13 +448,13 @@ public function getScriptURL() {
// If gzip is disabled just return core script url
$useGzip = HTMLEditorField::config()->get('use_gzip');
if(!$useGzip) {
return THIRDPARTY_DIR . '/tinymce/tinymce.min.js';
return ADMIN_THIRDPARTY_DIR . '/tinymce/tinymce.min.js';
}

// tinyMCE JS requirement
require_once THIRDPARTY_PATH . '/tinymce/tiny_mce_gzip.php';
require_once ADMIN_THIRDPARTY_PATH . '/tinymce/tiny_mce_gzip.php';
$tag = TinyMCE_Compressor::renderTag(array(
'url' => THIRDPARTY_DIR . '/tinymce/tiny_mce_gzip.php',
'url' => ADMIN_THIRDPARTY_DIR . '/tinymce/tiny_mce_gzip.php',
'plugins' => implode(',', $this->getInternalPlugins()),
'themes' => $this->getTheme(),
'languages' => $this->getOption('language')
Expand All @@ -464,16 +464,7 @@ public function getScriptURL() {
}

public function init() {
// These should be 'provides' by bundle-dist.js
Requirements::javascript(FRAMEWORK_DIR . "/thirdparty/jquery/jquery.js");
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/ssui.core.js');

// include TinyMCE Javascript
Requirements::javascript($this->getScriptURL());
Requirements::javascript(FRAMEWORK_DIR ."/client/dist/js/HtmlEditorField.js");

Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
}
}
23 changes: 3 additions & 20 deletions Forms/InlineFormAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

/**
* Render a button that will submit the form its contained in through ajax.
* If you want to add custom behaviour, please set {@link includeDefaultJS()} to FALSE
*
* Caution: The form field does not include any JavaScript or CSS when used outside of the CMS context,
* since the required frontend dependencies are included through CMS bundling.
*
* @see framework/client/dist/js/InlineFormAction.js
*/
class InlineFormAction extends FormField {

protected $includeDefaultJS = true;

/**
* Create a new action button.
*
Expand All @@ -35,13 +35,6 @@ public function performReadonlyTransformation() {
* @return string
*/
public function Field($properties = array()) {
if($this->includeDefaultJS) {
Requirements::javascriptTemplate(
FRAMEWORK_DIR . '/client/dist/js/InlineFormAction.js',
array('ID'=>$this->ID())
);
}

return FormField::create_tag('input', array(
'type' => 'submit',
'name' => sprintf('action_%s', $this->getName()),
Expand All @@ -54,14 +47,4 @@ public function Field($properties = array()) {
public function Title() {
return false;
}

/**
* Optionally disable the default javascript include (framework/client/dist/js/InlineFormAction.js),
* which routes to an "admin-custom"-URL.
*
* @param $bool boolean
*/
public function includeDefaultJS($bool) {
$this->includeDefaultJS = (bool)$bool;
}
}
1 change: 0 additions & 1 deletion Forms/MemberDatetimeOptionsetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class MemberDatetimeOptionsetField extends OptionsetField {
private $descriptionTemplate = '';

public function Field($properties = array()) {
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/MemberDatetimeOptionsetField.js');
$options = array();
$odd = false;

Expand Down
7 changes: 3 additions & 4 deletions Forms/SelectionGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
* );
* $field = new SelectionGroup('MyGroup', $items);
* </code>
*
* Caution: The form field does not include any JavaScript or CSS when used outside of the CMS context,
* since the required frontend dependencies are included through CMS bundling.
*/
class SelectionGroup extends CompositeField {

Expand Down Expand Up @@ -118,10 +121,6 @@ public function hasData() {
}

public function FieldHolder($properties = array()) {
Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/client/dist/js/SelectionGroup.js');
Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/SelectionGroup.css');

return parent::FieldHolder($properties);
}
}
Loading