Przeglądaj źródła

Update dependencies (#280)

* Remove an always failing test
* Update dependencies
* Revert 'temporary' npm package to v0.0.8
* Update Node version in Vagrantfile
Gaël Métais 6 lat temu
rodzic
commit
b6e8768767

+ 1 - 1
.gitignore

@@ -1,8 +1,8 @@
 node_modules
+package-lock.json
 .tmp
 .vagrant
 results/*
 coverage
 front/build
-
 har.json

+ 1 - 1
bin/cli.js

@@ -26,7 +26,7 @@ var cli = meow({
         '  --reporter           The output format: "json" or "xml". Default is "json".',
         ''
     ].join('\n'),
-    pkg: '../package.json'
+    pkg: require('../package.json')
 });
 
 

+ 1 - 1
front/src/css/screenshot.css

@@ -2,6 +2,6 @@
   text-align: center;
 }
 .screenshot .screenshotWrapper {
-  font-size: 2.08333333333333em;
+  font-size: 2.08333333em;
   margin-bottom: 0.5em;
 }

+ 7 - 111
lib/tools/redownload/fileMinifier.js

@@ -141,123 +141,19 @@ var FileMinifier = function() {
     // Uglify
     function minifyJs(body) {
         
-        // Splitting the Uglify function because it sometime takes too long (more than 10 seconds)
-        // I hope that, by splitting, it can be a little more asynchronous, so the application doesn't freeze.
-
-        return splittedUglifyStep1(body)
-        .delay(1)
-        .then(splittedUglifyStep2)
-        .delay(1)
-        .then(function(ast) {
-            // Only do the compression step for smaller files
-            // otherwise it can take a very long time compared to the gain
-            if (body.length < 200*1024) {
-                return splittedUglifyStep3(ast);
-            } else {
-                debug('Skipping step 3 because the file is too big (%d bytes)!', body.length);
-                return ast;
-            }
-        })
-        .delay(1)
-        .then(splittedUglifyStep4)
-        .delay(1)
-        .then(splittedUglifyStep5)
-        .delay(1)
-        .then(splittedUglifyStep6)
-        .delay(1)
-        .then(splittedUglifyStep7);
-
-    }
-
-    function splittedUglifyStep1(code) {
-        var deferred = Q.defer();
-        var startTime = Date.now();
-
-        try {
-            var toplevel_ast = UglifyJS.parse(code);
-
-            var endTime = Date.now();
-            debug('Uglify step 1 took %dms', endTime - startTime);
-            deferred.resolve(toplevel_ast);
-
-        } catch(err) {
-            debug('JS syntax error, Uglify\'s parser failed (step 1)');
-            deferred.reject(err);
-        }
-
-        return deferred.promise;
-    }
-
-    function splittedUglifyStep2(toplevel) {
-        var deferred = Q.defer();
-        var startTime = Date.now();
-
-        toplevel.figure_out_scope();
-
-        var endTime = Date.now();
-        debug('Uglify step 2 took %dms', endTime - startTime);
-        deferred.resolve(toplevel);
-        return deferred.promise;
-    }
-
-    function splittedUglifyStep3(toplevel) {
-        var deferred = Q.defer();
-        var startTime = Date.now();
-
-        var compressor = UglifyJS.Compressor({warnings: false});
-        var compressed_ast = toplevel.transform(compressor);
-
-        var endTime = Date.now();
-        debug('Uglify step 3 took %dms', endTime - startTime);
-        deferred.resolve(compressed_ast);
-        return deferred.promise;
-    }
-
-    function splittedUglifyStep4(compressed_ast) {
-        var deferred = Q.defer();
-        var startTime = Date.now();
-
-        compressed_ast.figure_out_scope();
-
-        var endTime = Date.now();
-        debug('Uglify step 4 took %dms', endTime - startTime);
-        deferred.resolve(compressed_ast);
-        return deferred.promise;
-    }
-
-    function splittedUglifyStep5(compressed_ast) {
         var deferred = Q.defer();
         var startTime = Date.now();
 
-        compressed_ast.compute_char_frequency();
-
-        var endTime = Date.now();
-        debug('Uglify step 5 took %dms', endTime - startTime);
-        deferred.resolve(compressed_ast);
-        return deferred.promise;
-    }
-
-    function splittedUglifyStep6(compressed_ast) {
-        var deferred = Q.defer();
-        var startTime = Date.now();
-
-        compressed_ast.mangle_names();
+        var result = UglifyJS.minify(body, {
+            // Only do the compression step for smaller files
+            // otherwise it can take a very long time compared to the gain
+            compress: (body.length < 200*1024)
+        });
 
         var endTime = Date.now();
-        debug('Uglify step 6 took %dms', endTime - startTime);
-        deferred.resolve(compressed_ast);
-        return deferred.promise;
-    }
+        debug('Uglify took %dms', endTime - startTime);
+        deferred.resolve(result.code);
 
-    function splittedUglifyStep7(compressed_ast) {
-        var deferred = Q.defer();
-        var startTime = Date.now();
-
-        var code = compressed_ast.print_to_string();
-
-        var endTime = Date.now();
-        debug('Uglify step 7 took %dms', endTime - startTime);
-        deferred.resolve(code);
         return deferred.promise;
     }
 

+ 43 - 44
package.json

@@ -16,72 +16,71 @@
     "yellowlabtools": "./bin/cli.js"
   },
   "engines": {
-    "node": ">= 4.0"
+    "node": ">= 6.0"
   },
   "main": "./lib/index.js",
   "dependencies": {
-    "angular": "1.6.8",
-    "angular-animate": "1.6.8",
+    "angular": "1.7.7",
+    "angular-animate": "1.7.7",
     "angular-chart.js": "1.1.1",
     "angular-local-storage": "0.7.1",
-    "angular-resource": "1.6.8",
-    "angular-route": "1.6.8",
-    "angular-sanitize": "1.6.8",
-    "async": "2.6.0",
-    "body-parser": "1.18.2",
-    "chart.js": "2.7.1",
-    "clean-css": "4.1.9",
+    "angular-resource": "1.7.7",
+    "angular-route": "1.7.7",
+    "angular-sanitize": "1.7.7",
+    "async": "2.6.1",
+    "body-parser": "1.18.3",
+    "chart.js": "2.7.3",
+    "clean-css": "4.2.1",
     "color-diff": "1.1.0",
-    "compression": "1.7.1",
-    "cors": "2.8.4",
+    "compression": "1.7.3",
+    "cors": "2.8.5",
     "css-mq-parser": "0.0.3",
-    "debug": "3.1.0",
+    "debug": "4.1.1",
     "easyxml": "2.0.1",
-    "ejs": "2.5.7",
-    "express": "4.16.2",
-    "fontkit": "1.7.7",
+    "ejs": "2.6.1",
+    "express": "4.16.4",
+    "fontkit": "1.7.8",
     "image-size": "0.7.1",
-    "imagemin": "5.3.1",
-    "imagemin-jpegoptim": "5.2.0",
-    "imagemin-jpegtran": "5.0.2",
-    "imagemin-optipng": "5.2.1",
-    "imagemin-svgo": "6.0.0",
+    "imagemin": "6.1.0",
+    "imagemin-jpegoptim": "6.0.0",
+    "imagemin-jpegtran": "6.0.0",
+    "imagemin-optipng": "6.0.0",
+    "imagemin-svgo": "7.0.0",
     "is-eot": "1.0.0",
-    "is-gif": "1.0.0",
+    "is-gif": "3.0.0",
     "is-http2": "1.2.0",
-    "is-jpg": "1.0.0",
+    "is-jpg": "2.0.0",
     "is-otf": "0.1.2",
     "is-png": "1.1.0",
-    "is-svg": "2.1.0",
+    "is-svg": "3.0.0",
     "is-ttf": "0.2.2",
     "is-woff": "1.0.3",
     "is-woff2": "1.0.0",
-    "jimp": "0.2.28",
+    "jimp": "0.6.0",
     "md5": "2.2.1",
-    "meow": "3.7.0",
-    "minimize": "2.1.0",
+    "meow": "5.0.0",
+    "minimize": "2.2.0",
     "parse-color": "1.0.0",
     "phantomas": "1.19.0",
     "ps-node": "0.1.6",
     "q": "1.5.1",
-    "request": "2.83.0",
-    "rimraf": "2.6.2",
+    "request": "2.88.0",
+    "rimraf": "2.6.3",
     "temporary": "0.0.8",
-    "try-thread-sleep": "1.0.2",
-    "uglify-js": "2.8.29"
+    "uglify-js": "3.4.9"
   },
   "devDependencies": {
-    "chai": "~4.1.2",
-    "grunt": "~1.0.1",
-    "grunt-contrib-clean": "~1.1.0",
+    "chai": "~4.2.0",
+    "grunt": "~1.0.3",
+    "grunt-contrib-clean": "~2.0.0",
     "grunt-contrib-concat": "~1.0.1",
     "grunt-contrib-copy": "~1.0.0",
-    "grunt-contrib-cssmin": "~2.2.1",
-    "grunt-contrib-htmlmin": "~2.4.0",
-    "grunt-contrib-jshint": "~1.1.0",
-    "grunt-contrib-less": "~1.4.1",
-    "grunt-contrib-uglify": "~3.3.0",
-    "grunt-contrib-watch": "~1.0.0",
+    "grunt-contrib-cssmin": "~3.0.0",
+    "grunt-contrib-htmlmin": "~3.0.0",
+    "grunt-contrib-jshint": "~2.0.0",
+    "grunt-contrib-less": "~2.0.0",
+    "grunt-contrib-uglify": "~4.0.0",
+    "grunt-contrib-watch": "~1.1.0",
     "grunt-env": "~0.4.4",
     "grunt-express": "~1.4.1",
     "grunt-filerev": "~2.3.1",
@@ -90,11 +89,11 @@
     "grunt-parallel": "~0.5.1",
     "grunt-replace": "~1.0.1",
     "grunt-usemin": "~3.1.1",
-    "grunt-webfont": "~1.6.0",
+    "grunt-webfont": "~1.7.2",
     "matchdep": "~2.0.0",
-    "mocha": "~4.1.0",
-    "sinon": "~4.1.6",
-    "sinon-chai": "~2.14.0"
+    "mocha": "~5.2.0",
+    "sinon": "~7.2.3",
+    "sinon-chai": "~3.3.0"
   },
   "scripts": {
     "test": "grunt test"

+ 1 - 1
server_config/server_install.sh

@@ -6,7 +6,7 @@ sudo apt-get install lsb-release libfontconfig1 libfreetype6 libjpeg-dev -y --fo
 sudo apt-get install curl git software-properties-common build-essential make g++ -y --force-yes > /dev/null 2>&1
 
 # Installation of NodeJS
-curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
+curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
 sudo apt-get install -y nodejs > /dev/null 2>&1
 source ~/.profile
 

+ 0 - 32
test/core/phantomasWrapperTest.js

@@ -61,36 +61,4 @@ describe('phantomasWrapper', function() {
             }
         });
     });
-
-    it('should timeout but return some results', function(done) {
-        var url = 'http://localhost:8388/simple-page.html';
-
-        this.timeout(5000);
-        phantomasWrapper.execute({
-            params: {
-                url: url,
-                options: {
-                    timeout: 1
-                }
-            }
-        }).then(function(data) {
-            /*jshint -W030 */
-
-            try {            
-                data.should.be.an('object');
-                data.should.have.a.property('generator');
-                data.generator.should.contain('phantomas');
-                data.should.have.a.property('url').that.equals(url);
-                data.should.have.a.property('metrics').that.is.an('object').not.empty;
-                data.should.have.a.property('offenders').that.is.an('object').not.empty;
-                data.offenders.should.have.a.property('javascriptExecutionTree').that.is.a('array').not.empty;
-
-                done();
-            } catch(error) {
-                done(error);
-            }
-        }).fail(function(err) {
-            done(err);
-        });
-    });
 });