From f422459be25d7cf57371083f0e657ac599b52e72 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Thu, 1 Nov 2018 11:37:32 +0100 Subject: [PATCH] Gulp task improvement. --- gulpfile.js | 25 ++-- js/Contao.js | 1 - package-lock.json | 131 ++++++++++++------ package.json | 4 +- .../Resources/public/js/contao-leaflet.js | 2 +- 5 files changed, 105 insertions(+), 58 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index e06fe29..b374b38 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,34 +1,35 @@ -const { series, src, watch, dest, parallel} = require('gulp'); -const del = require('del'); +const { series, src, watch, dest, parallel, task} = require('gulp'); +const del = require('promised-del'); const uglify = require('gulp-uglify'); const concat = require('gulp-concat'); var paths = { minified: 'contao-leaflet.js', - scripts: ['js/*.js'], + scripts: ['js/vendor/*.js', 'js/*.js'], dest: 'src/Bundle/Resources/public/js' }; -function cleanTask (cb) { - del([paths.dest + '/' + paths.minified]); - cb(); +function clean () { + return del([paths.dest + '/' + paths.minified]); } -const buildTask = series(cleanTask, function (cb) { +function build () { return src(paths.scripts) .pipe(concat(paths.minified)) .pipe(uglify()) .pipe(dest(paths.dest)); -}); +} + +const buildTasks = series(clean, build); function watchTask () { watch( paths.scripts, - buildTask + buildTasks ) } -exports.clean = cleanTask; +exports.clean = clean; exports.watch = watchTask; -exports.build = buildTask; -exports.default = buildTask; +exports.build = buildTasks; +exports.default = buildTasks; diff --git a/js/Contao.js b/js/Contao.js index 91368a5..3d763d8 100644 --- a/js/Contao.js +++ b/js/Contao.js @@ -329,7 +329,6 @@ L.Contao = L.Evented.extend({ return value; }, - /** * Apply the filter to a request url. * diff --git a/package-lock.json b/package-lock.json index c848874..4763bb0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -157,6 +157,11 @@ "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" }, + "async": { + "version": "1.5.2", + "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, "async-done": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.1.tgz", @@ -618,26 +623,6 @@ } } }, - "del": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", - "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", - "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - } - } - }, "detect-file": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", @@ -654,6 +639,15 @@ "stream-shift": "^1.0.0" } }, + "each-async": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz", + "integrity": "sha1-3uUim98KtrogEqOV4bhpq/iBNHM=", + "requires": { + "onetime": "^1.0.0", + "set-immediate-shim": "^1.0.0" + } + }, "each-props": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz", @@ -1508,18 +1502,6 @@ "which": "^1.2.14" } }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, "glogg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", @@ -2168,11 +2150,6 @@ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -2270,6 +2247,11 @@ "wrappy": "1" } }, + "onetime": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=" + }, "ordered-read-streams": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", @@ -2286,11 +2268,6 @@ "lcid": "^1.0.0" } }, - "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==" - }, "parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -2403,6 +2380,71 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, + "promised-del": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/promised-del/-/promised-del-1.0.2.tgz", + "integrity": "sha1-voAvuP8mB+qrxAZnjTN+tKJO39U=", + "requires": { + "del": "^1.1.1", + "promise": "^6.0.1" + }, + "dependencies": { + "asap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz", + "integrity": "sha1-sqRdpf36ILBJb8N2jMJ8EvqRan0=" + }, + "del": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/del/-/del-1.2.1.tgz", + "integrity": "sha1-rtblvNfLcyXfNPVjEl+iZbLBoBQ=", + "requires": { + "each-async": "^1.0.0", + "globby": "^2.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^3.0.0", + "rimraf": "^2.2.8" + } + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globby": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-2.1.0.tgz", + "integrity": "sha1-npGSvNM/Srak+JTl5+qLcTITxII=", + "requires": { + "array-union": "^1.0.1", + "async": "^1.2.1", + "glob": "^5.0.3", + "object-assign": "^3.0.0" + } + }, + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=" + }, + "promise": { + "version": "6.1.0", + "resolved": "http://registry.npmjs.org/promise/-/promise-6.1.0.tgz", + "integrity": "sha1-LOcp9rlLRcJoka0GAsXJDgTG7vY=", + "requires": { + "asap": "~1.0.0" + } + } + } + }, "pump": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", @@ -2615,6 +2657,11 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", diff --git a/package.json b/package.json index 615e4b9..e594f29 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "description": "Leaflet maps for Contao", "main": "gulpfile.js", "dependencies": { - "del": "^3.0.0", "gulp": "^4.0.0", "gulp-cli": "^2.0.1", "gulp-concat": "^2.6.1", - "gulp-uglify": "^3.0.1" + "gulp-uglify": "^3.0.1", + "promised-del": "^1.0.2" }, "devDependencies": {}, "scripts": { diff --git a/src/Bundle/Resources/public/js/contao-leaflet.js b/src/Bundle/Resources/public/js/contao-leaflet.js index cdf4ee8..5f44c77 100644 --- a/src/Bundle/Resources/public/js/contao-leaflet.js +++ b/src/Bundle/Resources/public/js/contao-leaflet.js @@ -1 +1 @@ -L.Contao=L.Evented.extend({statics:{ATTRIBUTION:' | netzmacht'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images/",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,o){return this.maps[t]=o,this.fire("map:added",{id:t,map:o}),this},getMap:function(t){return void 0===this.maps[t]?null:this.maps[t]},addIcon:function(t,o){return this.icons[t]=o,this.fire("icon:added",{id:t,icon:o}),this},loadIcons:function(t){for(var o=0;oe[0]?1:0}),n._entries&&(n._entries={});for(var t=0;tnetzmacht'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images/",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,e){return this.maps[t]=e,this.fire("map:added",{id:t,map:e}),this},getMap:function(t){return void 0===this.maps[t]?null:this.maps[t]},addIcon:function(t,e){return this.icons[t]=e,this.fire("icon:added",{id:t,icon:e}),this},loadIcons:function(t){for(var e=0;e