From e9a25ec30144b09a2347c0e64da995a07262e96a Mon Sep 17 00:00:00 2001 From: Felix Schulze Date: Fri, 8 Nov 2019 01:11:39 +0100 Subject: [PATCH] update gulp, now hashes updated files Closes #4 --- gulpfile.js | 12 +++- package-lock.json | 180 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 6 ++ 3 files changed, 191 insertions(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 33b6011..cc83972 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,11 +6,11 @@ var settings = { clean: true, scripts: true, - polyfills: true, + polyfills: false, styles: true, svgs: true, copy: true, - reload: true + reload: false }; @@ -69,6 +69,7 @@ var lazypipe = require('lazypipe'); var rename = require('gulp-rename'); var header = require('gulp-header'); var package = require('./package.json'); +var hashsrc = require("gulp-hash-src"); // Scripts var jshint = require('gulp-jshint'); @@ -237,6 +238,12 @@ var copyFiles = function (done) { }; +// updates version in all assets +var updateAssetVersion = function (done) { + return src('src/copy/**/*.{php,html}') + .pipe(hashsrc({build_dir:paths.input,src_path:"/",hash_len:"6",query_name:"v"})) + .pipe(dest(paths.output)); +}; // Watch for changes to the src directory var startServer = function (done) { @@ -278,6 +285,7 @@ var watchSource = function (done) { exports.default = series( cleanDist, parallel( + updateAssetVersion, buildScripts, lintScripts, buildStyles, diff --git a/package-lock.json b/package-lock.json index 1b042cb..efb59b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -586,6 +586,12 @@ "inherits": "~2.0.0" } }, + "bluebird": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.1.tgz", + "integrity": "sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==", + "dev": true + }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -1197,8 +1203,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cosmiconfig": { "version": "5.2.1", @@ -1988,6 +1993,21 @@ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "dev": true }, + "event-stream": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.5.tgz", + "integrity": "sha512-vyibDcu5JL20Me1fP734QBH/kenBGLZap2n0+XXM7mvuUPzJ20Ydqj1aKcIeMdri1p+PU+4yAKugjN8KCVst+g==", + "dev": true, + "requires": { + "duplexer": "^0.1.1", + "from": "^0.1.7", + "map-stream": "0.0.7", + "pause-stream": "^0.0.11", + "split": "^1.0.1", + "stream-combiner": "^0.2.2", + "through": "^2.3.8" + } + }, "eventemitter3": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz", @@ -2369,6 +2389,12 @@ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", "dev": true }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true + }, "fs-extra": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", @@ -2396,6 +2422,21 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fs_helper": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/fs_helper/-/fs_helper-0.1.11.tgz", + "integrity": "sha1-x29GbDr28/O+8O6bQJP9OTafj6o=", + "requires": { + "girdle": "=0.1.15" + }, + "dependencies": { + "girdle": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/girdle/-/girdle-0.1.15.tgz", + "integrity": "sha1-+AiBnjCSqiNwmCzD7E3xmoNgWEg=" + } + } + }, "fsevents": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", @@ -3014,6 +3055,11 @@ "assert-plus": "^1.0.0" } }, + "girdle": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/girdle/-/girdle-0.2.3.tgz", + "integrity": "sha1-i6KRia38f8XgjvpzHVtVY+hsJL4=" + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -3184,6 +3230,38 @@ } } }, + "gulp-buster": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/gulp-buster/-/gulp-buster-1.1.0.tgz", + "integrity": "sha1-9Yr66AUXJfvoZ5Ky/5VjfDjH3h4=", + "dev": true, + "requires": { + "bluebird": "^3.3.5", + "gulp-util": "^3.0.7", + "lodash.defaults": "^4.0.1", + "object-assign": "^4.0.1", + "through": "^2.3.8" + } + }, + "gulp-cache-buster": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/gulp-cache-buster/-/gulp-cache-buster-0.2.1.tgz", + "integrity": "sha1-XpSE+cnHXDpvr6hUtNekAZIuA9A=", + "dev": true, + "requires": { + "event-stream": "^3.3.0", + "lodash": "^3.7.0", + "replacestream": "^2.1.0" + }, + "dependencies": { + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + } + } + }, "gulp-concat": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz", @@ -3217,6 +3295,70 @@ } } }, + "gulp-hash-src": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/gulp-hash-src/-/gulp-hash-src-0.1.6.tgz", + "integrity": "sha1-/x0xZgvMaxO7a+n8pWLuDDwDRCM=", + "requires": { + "fs_helper": "=0.1.11", + "girdle": "=0.2.3", + "through2": "=0.4.2" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "object-keys": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", + "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "through2": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.4.2.tgz", + "integrity": "sha1-2/WGYDEVHsg1K7bE22SiKSqEC5s=", + "requires": { + "readable-stream": "~1.0.17", + "xtend": "~2.1.1" + } + }, + "xtend": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", + "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", + "requires": { + "object-keys": "~0.4.0" + } + } + } + }, + "gulp-hasher": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/gulp-hasher/-/gulp-hasher-0.1.0.tgz", + "integrity": "sha1-QycyKPofN6t3wsgxDBJgkgj8iog=", + "dev": true, + "requires": { + "event-stream": "^3.3.0" + } + }, "gulp-header": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-2.0.5.tgz", @@ -3866,8 +4008,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "1.3.5", @@ -4620,6 +4761,12 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=", + "dev": true + }, "lodash.escape": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", @@ -4793,6 +4940,12 @@ "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", "dev": true }, + "map-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", + "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=", + "dev": true + }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", @@ -5599,6 +5752,15 @@ "pinkie-promise": "^2.0.0" } }, + "pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "dev": true, + "requires": { + "through": "~2.3" + } + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -6541,6 +6703,15 @@ "remove-trailing-separator": "^1.1.0" } }, + "replacestream": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-2.1.0.tgz", + "integrity": "sha1-rki6gl9rKGHIvn35d3z2p9pqmOo=", + "dev": true, + "requires": { + "through": "~2.3.4" + } + }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", @@ -7345,7 +7516,6 @@ "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", "dev": true, - "optional": true, "requires": { "through": "2" } diff --git a/package.json b/package.json index 7b1a55d..22753d4 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,11 @@ "cssnano": "^4.1.10", "del": "^3.0.0", "gulp": "^4.0.2", + "gulp-buster": "^1.1.0", + "gulp-cache-buster": "^0.2.1", "gulp-concat": "^2.6.1", "gulp-flatmap": "^1.0.2", + "gulp-hasher": "^0.1.0", "gulp-header": "^2.0.5", "gulp-jshint": "^2.1.0", "gulp-optimize-js": "^1.1.0", @@ -41,5 +44,8 @@ "jshint": "^2.9.6", "jshint-stylish": "^2.2.1", "lazypipe": "^1.0.1" + }, + "dependencies": { + "gulp-hash-src": "^0.1.6" } }