Skip to content

Commit

Permalink
[TASK] Apply uglify to TypeScript builds
Browse files Browse the repository at this point in the history
The Grunt task `copy:ts_files` now modifies the uglify configuration
on-the-fly to minify the files compiled by TypeScript.

Resolves: #83251
Releases: master
Change-Id: I11faf7ae39f2605b4e8a8a6972f4f16c4b80138f
Reviewed-on: https://review.typo3.org/55639
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
  • Loading branch information
andreaskienast authored and benjaminkott committed Feb 10, 2018
1 parent 35e4d4e commit f8fe8cc
Show file tree
Hide file tree
Showing 28 changed files with 64 additions and 3,378 deletions.
39 changes: 37 additions & 2 deletions Build/Gruntfile.js
Expand Up @@ -238,7 +238,22 @@ module.exports = function (grunt) {
rename: function (dest, src) {
var srccleaned = src.replace('Resources/Private/TypeScript', 'Resources/Public/JavaScript');
srccleaned = srccleaned.replace('Tests/TypeScript', 'Tests/JavaScript');
return dest + srccleaned;
var destination = dest + srccleaned;

// Apply uglify configuration for regular files only
var config = {
uglify: {
typescript: {
files: []
}
}
};
var uglyfile = {};
uglyfile[destination] = destination;
config.uglify.typescript.files.push(uglyfile);
grunt.config.merge(config);

return destination;
}
}]
},
Expand Down Expand Up @@ -494,6 +509,26 @@ module.exports = function (grunt) {
}
}
]
},
typescript: {
options: {
banner: '/*\n' +
' * This file is part of the TYPO3 CMS project.\n' +
' *\n' +
' * It is free software; you can redistribute it and/or modify it under\n' +
' * the terms of the GNU General Public License, either version 2\n' +
' * of the License, or any later version.\n' +
' *\n' +
' * For the full copyright and license information, please read the\n' +
' * LICENSE.txt file that was distributed with this source code.\n' +
' *\n' +
' * The TYPO3 project - inspiring people to share!' +
'\n' +
' */' +
'\n'
},
// Generated by copy:ts_files task
files: {}
}
}
});
Expand Down Expand Up @@ -573,7 +608,7 @@ module.exports = function (grunt) {
* - 2) Compiles all TypeScript files (*.ts) which are located in sysext/<EXTKEY>/Resources/Private/TypeScript/*.ts
* - 3) Copy all generated JavaScript and Map files to public folders
*/
grunt.registerTask('scripts', ['tsconfig', 'tslint', 'tsclean', 'exec:ts', 'copy:ts_files']);
grunt.registerTask('scripts', ['tsconfig', 'tslint', 'tsclean', 'exec:ts', 'copy:ts_files', 'uglify:typescript']);

/**
* grunt tsclean task
Expand Down
Expand Up @@ -10,17 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BackendException = (function () {
function BackendException(message, code) {
if (message === void 0) { message = ''; }
if (code === void 0) { code = 0; }
this.message = message;
this.code = code;
}
return BackendException;
}());
exports.BackendException = BackendException;
});
define(["require","exports"],function(a,b){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(a,b){void 0===a&&(a=""),void 0===b&&(b=0),this.message=a,this.code=b}return a}();b.BackendException=c});
39 changes: 1 addition & 38 deletions typo3/sysext/backend/Resources/Public/JavaScript/ColorPicker.js
Expand Up @@ -10,41 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require", "exports", "jquery", "TYPO3/CMS/Core/Contrib/jquery.minicolors"], function (require, exports, $) {
"use strict";
/**
* Module: TYPO3/CMS/Backend/ColorPicker
* contains all logic for the color picker used in FormEngine
* @exports TYPO3/CMS/Backend/ColorPicker
*/
var ColorPicker = (function () {
/**
* The constructor, set the class properties default values
*/
function ColorPicker() {
this.selector = '.t3js-color-picker';
}
/**
* Initialize the color picker for the given selector
*/
ColorPicker.prototype.initialize = function () {
$(this.selector).minicolors({
format: 'hex',
position: 'bottom left',
theme: 'bootstrap',
});
$(document).on('change', '.t3js-colorpicker-value-trigger', function (event) {
var $element = $(event.target);
if ($element.val() !== '') {
$element.closest('.t3js-formengine-field-item')
.find('.t3js-color-picker')
.val($element.val())
.trigger('paste');
$element.val('');
}
});
};
return ColorPicker;
}());
return new ColorPicker();
});
define(["require","exports","jquery","TYPO3/CMS/Core/Contrib/jquery.minicolors"],function(a,b,c){"use strict";var d=function(){function a(){this.selector=".t3js-color-picker"}return a.prototype.initialize=function(){c(this.selector).minicolors({format:"hex",position:"bottom left",theme:"bootstrap"}),c(document).on("change",".t3js-colorpicker-value-trigger",function(a){var b=c(a.target);""!==b.val()&&(b.closest(".t3js-formengine-field-item").find(".t3js-color-picker").val(b.val()).trigger("paste"),b.val(""))})},a}();return new d});
147 changes: 1 addition & 146 deletions typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f8fe8cc

Please sign in to comment.