From a9bc923119e1625fada670a4790d639f4ceeb08f Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Wed, 9 Sep 2020 11:03:04 +0200
Subject: [PATCH] [fix] Ad: display a warning, when Ad's location not resolved
 (no geoPoint) [fix] Fix missing i18n (ES) [enh] Market search: use 50km by
 default

---
 gulpfile.js | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/gulpfile.js b/gulpfile.js
index 344d39f91..88dbd2554 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -32,7 +32,7 @@ const gulp = require('gulp'),
   merge = require('merge2'),
   log = require('fancy-log'),
   colors = require('ansi-colors'),
-  argv = require('yargs').argv,
+  {argv} = require('yargs'),
   sriHash = require('gulp-sri-hash'),
   sort = require('gulp-sort'),
   map = require('map-stream');
@@ -916,7 +916,11 @@ function cdvRemoveCode() {
     wwwPath = path.join(projectRoot, 'platforms', platform, 'www');
   }
 
-  const pluginPath = path.join(wwwPath, 'plugins', 'es');
+  const appJsPath = [path.join(wwwPath, 'js', '**', '*.js'),
+      // Exclude vendor libs
+      "!" + path.join(wwwPath, 'js', 'vendor', '**', '*.js')];
+  const pluginPath = path.join(wwwPath, 'plugins', '*');
+  const pluginJsPath = path.join(pluginPath, '**', '*.js');
 
   // Compute options {device-<platform>: true}
   let removeCodeOptions = {};
@@ -963,14 +967,14 @@ function cdvRemoveCode() {
         .pipe(gulp.dest(wwwPath)),
 
       // Remove unused JS code + add ng annotations
-      gulp.src(path.join(wwwPath, 'js', '**', '*.js'))
+      gulp.src(appJsPath)
         .pipe(debug(debugOptions))
         .pipe(removeCode({device: true}))
         .pipe(removeCode(removeCodeOptions))
         .pipe(ngAnnotate({single_quotes: true}))
         .pipe(gulp.dest(wwwPath + '/dist/dist_js/app')),
 
-      gulp.src([pluginPath + '/js/**/*.js'])
+      gulp.src(pluginJsPath)
         .pipe(debug(debugOptions))
         .pipe(removeCode({device: true}))
         .pipe(removeCode(removeCodeOptions))
@@ -980,21 +984,25 @@ function cdvRemoveCode() {
   } else {
     return merge(
       gulp.src(path.join(wwwPath, 'templates', '**', '*.html'))
+        .pipe(debug(debugOptions))
         .pipe(htmlmin(htmlminOptions))
         .pipe(gulp.dest(wwwPath + '/templates')),
 
       gulp.src(path.join(pluginPath, '**', '*.html'))
+        .pipe(debug(debugOptions))
         .pipe(htmlmin(htmlminOptions))
         .pipe(gulp.dest(pluginPath)),
 
       gulp.src(path.join(wwwPath, 'index.html'))
         .pipe(gulp.dest(wwwPath)),
 
-      gulp.src(path.join(wwwPath, 'js', '**', '*.js'))
+      gulp.src(appJsPath)
+        .pipe(debug(debugOptions))
         .pipe(ngAnnotate({single_quotes: true}))
         .pipe(gulp.dest(wwwPath + '/dist/dist_js/app')),
 
-      gulp.src([pluginPath + '/js/**/*.js'])
+      gulp.src(pluginJsPath)
+        .pipe(debug(debugOptions))
         .pipe(gulp.dest(wwwPath + '/dist/dist_js/plugins'))
     );
   }
@@ -1014,12 +1022,8 @@ function cdvNgTemplate() {
   }
   let distJsPath = path.join(wwwPath, 'dist', 'dist_js', 'app');
   let pluginDistJsPath = path.join(wwwPath, 'dist', 'dist_js', 'plugins');
-  const debugOptions = {
-    title: 'Processing',
-    minimal: true,
-    showFiles: argv.debug || false,
-    showCount: false,
-    logger: m => log(colors.grey(m))
+  const debugOptions = { ...debugBaseOptions,
+    showCount: false
   };
 
   // Concat templates into a JS
@@ -1105,12 +1109,9 @@ function cdvUglify() {
       ...uglifyBaseOptions,
       ecma: '5'
     };
-    const debugOptions = {
+    const debugOptions = { ...debugBaseOptions,
       title: 'Minifying',
-      minimal: true,
-      showFiles: argv.debug || false,
-      showCount: false,
-      logger: m => log(colors.grey(m))
+      showCount: false
     };
 
     return gulp.src(indexPath)
@@ -1382,6 +1383,7 @@ exports.watch = appAndPluginWatch;
 exports.build = build;
 
 // Web
+exports.webClean = webClean;
 exports.webCompile = webCompile;
 exports.webBuild = webBuild;
 exports['build:web'] = exports.webBuild; // Alias
-- 
GitLab