소스 검색

Lint files with Prettier

jmacura 5 년 전
부모
커밋
ee6ad39f8f
11개의 변경된 파일347개의 추가작업 그리고 269개의 파일을 삭제
  1. 10 4
      src/adjuster/adjuster.component.js
  2. 5 4
      src/adjuster/adjuster.module.js
  3. 72 45
      src/adjuster/adjuster.service.js
  4. 162 129
      src/app.js
  5. 6 4
      src/datasource-list.js
  6. 1 1
      src/index.html
  7. 5 5
      src/nuts.js
  8. 9 8
      src/proxy.js
  9. 21 15
      webpack.common.js
  10. 27 25
      webpack.dev.js
  11. 29 29
      webpack.prod.js

+ 10 - 4
src/adjuster/adjuster.component.js

@@ -1,16 +1,22 @@
 export default {
   template: require('./adjuster.directive.html'),
-  controller: ['$scope', 'HsMapService', 'HsCore', 'HsConfig', 'pra.adjuster.service', 'HsUtilsService',
+  controller: [
+    '$scope',
+    'HsMapService',
+    'HsCore',
+    'HsConfig',
+    'pra.adjuster.service',
+    'HsUtilsService',
     function ($scope, OlMap, Core, config, adjusterService, utils) {
       $scope.loading = false;
       $scope.utils = utils;
 
       angular.extend($scope, {
         Core,
-        adjusterService
+        adjusterService,
       });
 
       $scope.$emit('scope_loaded', 'adjuster');
-    }
-  ]
+    },
+  ],
 };

+ 5 - 4
src/adjuster/adjuster.module.js

@@ -1,10 +1,11 @@
-import adjusterComponent from './adjuster.component';
-import adjusterService from './adjuster.service';
+import adjusterComponent from './adjuster.component.js';
+import adjusterService from './adjuster.service.js';
 
-angular.module('pra.adjuster', ['hs.core', 'hs.map'])
+angular
+  .module('pra.adjuster', ['hs.core', 'hs.map'])
   .directive('pra.adjuster.sidebarBtn', function () {
     return {
-      template: require('./adjuster-sidebar-btn.directive.html')
+      template: require('./adjuster-sidebar-btn.directive.html'),
     };
   })
 

+ 72 - 45
src/adjuster/adjuster.service.js

@@ -1,101 +1,128 @@
 // import attractivity from '../Attractivity.json';
-import nuts from '../nuts';
+import nuts from '../nuts.js';
 
-export default ['HsCore', 'HsUtilsService', '$rootScope', '$http',
+export default [
+  'HsCore',
+  'HsUtilsService',
+  '$rootScope',
+  '$http',
   function (Core, utils, $rootScope, $http) {
     const me = {
       factors: [
         {
           name: 'Natural',
           column: 'N_index',
-          weight: 1
+          weight: 1,
         },
         {
           name: 'Social & Human',
           column: 'S_index',
-          weight: 1
+          weight: 1,
         },
         {
           name: 'Anthropic',
           column: 'A_index',
-          weight: 1
+          weight: 1,
         },
         {
           name: 'Economical',
           column: 'E_index',
-          weight: 1
+          weight: 1,
         },
         {
           name: 'Cultural',
           column: 'C_index',
-          weight: 1
+          weight: 1,
         },
         {
           name: 'Institutional',
           column: 'I_index',
-          weight: 1
-        }
+          weight: 1,
+        },
       ],
-      apply () {
+      apply() {
         utils.debounce(function () {
           $http({
             method: 'post',
             url: 'https://publish.lesprojekt.cz/nodejs/scores',
             data: {
-              factors: me.factors.map(f => {
+              factors: me.factors.map((f) => {
                 return {
                   factor: f.factor,
                   weight: f.weight,
-                  datasets: f.datasets.filter(ds => ds.included).map(ds => ds.name)
+                  datasets: f.datasets
+                    .filter((ds) => ds.included)
+                    .map((ds) => ds.name),
                 };
-              })
-            }
-          })
-            .then(response => {
-              me.attractivity = response.data;
-              let max = 0;
-              me.attractivity.forEach(a => {
-                if (a.aggregate > max) max = a.aggregate;
-              });
-              const normalizer = 1 / max;
-              me.attractivity.forEach(a => {
-                a.aggregate *= normalizer;
-              });
-              me.attractivity.forEach(a => {
-                me.nutsCodeRecordRelations[a.code] = a;
-              });
-              nuts.nuts3Source.forEachFeature(feature => {
-                feature.set('total', me.nutsCodeRecordRelations[feature.get('NUTS_ID')].aggregate);
-                feature.set('totalForHumans', (me.nutsCodeRecordRelations[feature.get('NUTS_ID')].aggregate * 100).toFixed(2));
-                me.factors.forEach(factor => {
-                  feature.set(factor.factor, (me.nutsCodeRecordRelations[feature.get('NUTS_ID')][factor.factor] * 100).toFixed(2));
-                });
+              }),
+            },
+          }).then((response) => {
+            me.attractivity = response.data;
+            let max = 0;
+            me.attractivity.forEach((a) => {
+              if (a.aggregate > max) {
+                max = a.aggregate;
+              }
+            });
+            const normalizer = 1 / max;
+            me.attractivity.forEach((a) => {
+              a.aggregate *= normalizer;
+            });
+            me.attractivity.forEach((a) => {
+              me.nutsCodeRecordRelations[a.code] = a;
+            });
+            nuts.nuts3Source.forEachFeature((feature) => {
+              feature.set(
+                'total',
+                me.nutsCodeRecordRelations[feature.get('NUTS_ID')].aggregate
+              );
+              feature.set(
+                'totalForHumans',
+                (
+                  me.nutsCodeRecordRelations[feature.get('NUTS_ID')].aggregate *
+                  100
+                ).toFixed(2)
+              );
+              me.factors.forEach((factor) => {
+                feature.set(
+                  factor.factor,
+                  (
+                    me.nutsCodeRecordRelations[feature.get('NUTS_ID')][
+                      factor.factor
+                    ] * 100
+                  ).toFixed(2)
+                );
               });
             });
+          });
           /*
 
-            */ }, 300)();
-      }
+            */
+        }, 300)();
+      },
     };
     me.nutsCodeRecordRelations = {};
 
-    $http({ url: 'https://publish.lesprojekt.cz/nodejs/datasets' })
-      .then(response => {
-        me.factors = response.data.map(dataset => { return { factor: dataset.Factor, weight: 1, datasets: [] }; });
+    $http({url: 'https://publish.lesprojekt.cz/nodejs/datasets'}).then(
+      (response) => {
+        me.factors = response.data.map((dataset) => {
+          return {factor: dataset.Factor, weight: 1, datasets: []};
+        });
         me.factors = utils.removeDuplicates(me.factors, 'factor');
-        me.factors.forEach(factor => {
+        me.factors.forEach((factor) => {
           factor.datasets = response.data
-            .filter(ds => ds.Factor === factor.factor)
-            .map(ds => {
+            .filter((ds) => ds.Factor === factor.factor)
+            .map((ds) => {
               return {
                 name: ds.Name,
-                included: true
+                included: true,
               };
             });
         });
         me.apply();
-      });
+      }
+    );
 
     return me;
-  }
+  },
 ];

+ 162 - 129
src/app.js

@@ -1,69 +1,49 @@
 'use strict';
-import 'toolbar.module';
-import 'print.module';
-import 'query.module';
-import 'search.module';
-import 'add-layers.module';
-import 'measure.module';
-import 'permalink.module';
-import 'info.module';
-import 'datasource-selector.module';
-import 'sidebar.module';
-import 'draw.module';
-import View from 'ol/View';
-import { Tile } from 'ol/layer';
-import { OSM } from 'ol/source';
-import { Style, Stroke, Fill } from 'ol/style';
+//import angular from 'angular';
+import 'hslayers-ng/components/add-layers/add-layers.module';
+import 'hslayers-ng/components/datasource-selector/datasource-selector.module';
+import 'hslayers-ng/components/draw/draw.module';
+import 'hslayers-ng/components/info/info.module';
+import 'hslayers-ng/components/measure/measure.module';
+import 'hslayers-ng/components/permalink/permalink.module';
+import 'hslayers-ng/components/print/print.module';
+import 'hslayers-ng/components/query/query.module';
+import 'hslayers-ng/components/search/search.module';
+import 'hslayers-ng/components/sidebar/sidebar.module';
+import 'hslayers-ng/components/toolbar/toolbar.module';
+// hslayers-ng components must be loaded first, otherwise angular will be undefined
+// eslint-disable-next-line sort-imports-es6-autofix/sort-imports-es6
+import './adjuster/adjuster.module.js';
 import VectorLayer from 'ol/layer/Vector';
-import './adjuster/adjuster.module';
-import nuts from './nuts';
-
-const module = angular.module('hs', [
-  'hs.sidebar',
-  'hs.draw',
-  'hs.info',
-  'hs.toolbar',
-  'hs.layermanager',
-  'hs.query',
-  'hs.search', 'hs.print', 'hs.permalink',
-  'hs.geolocation',
-  'hs.datasource_selector',
-  'hs.save-map',
-  'hs.measure',
-  'hs.addLayers',
-  'pra.adjuster'
-]);
-
-module.directive('hs', ['HsConfig', 'HsCore', function (config, Core) {
-  return {
-    template: Core.hslayersNgTemplate,
-    /* link: function (scope, element) {
-      Core.fullScreenMap(element);
-     } */
-  };
-}]);
+import View from 'ol/View';
+import nuts from './nuts.js';
+import {Fill, Stroke, Style} from 'ol/style';
+import {OSM} from 'ol/source';
+import {Tile} from 'ol/layer';
 
-function getHostname () {
+function getHostname() {
   const url = window.location.href;
   const urlArr = url.split('/');
   const domain = urlArr[2];
   return urlArr[0] + '//' + domain;
-};
+}
 
 const stroke = new Stroke({
   color: '#3399CC',
-  width: 0.25
+  width: 0.25,
 });
 
-function perc2color (perc) {
+function perc2color(perc) {
   perc = perc * 100;
-  let r; let g; const b = 0;
+  let r;
+  let g;
+  const b = 0;
   if (perc < 50) {
     r = 255;
     g = Math.round(5.1 * perc);
   } else {
     g = 255;
-    r = Math.round(510 - 5.10 * perc);
+    r = Math.round(510 - 5.1 * perc);
   }
   // eslint-disable-next-line no-unused-vars
   // const h = r * 0x10000 + g * 0x100 + b * 0x1;
@@ -72,19 +52,23 @@ function perc2color (perc) {
 
 const styles = function (feature) {
   if (isNaN(feature.get('total'))) {
-    return [new Style({
-      fill: new Fill({
-        color: '#FFF'
+    return [
+      new Style({
+        fill: new Fill({
+          color: '#FFF',
+        }),
+        stroke: stroke,
       }),
-      stroke: stroke
-    })];
+    ];
   } else {
-    return [new Style({
-      fill: new Fill({
-        color: perc2color(feature.get('total'))
+    return [
+      new Style({
+        fill: new Fill({
+          color: perc2color(feature.get('total')),
+        }),
+        stroke: stroke,
       }),
-      stroke: stroke
-    })];
+    ];
   }
 };
 
@@ -92,84 +76,133 @@ const nuts2Layer = new VectorLayer({
   source: nuts.nuts2Source,
   visible: false,
   style: styles,
-  title: 'NUTS2 regions'
+  title: 'NUTS2 regions',
 });
 
 const nuts3Layer = new VectorLayer({
   source: nuts.nuts3Source,
   visible: true,
   style: styles,
-  title: 'NUTS3 regions'
+  title: 'NUTS3 regions',
 });
-nuts3Layer.set('hoveredKeys', ['NUTS_NAME', 'totalForHumans', 'Social & Human', 'Anthropic', 'Institutional', 'Economical', 'Natural', 'Cultural']);
-nuts3Layer.set('hoveredKeysTranslations', { NUTS_NAME: 'Name', totalForHumans: 'Calculated score' });
-
-module.value('HsConfig', {
-  proxyPrefix: '../8085/',
-  default_layers: [
-    new Tile({
-      source: new OSM(),
-      title: 'Open street map',
-      base: true,
-      editor: { editable: false },
-      removable: false
-    }),
-    nuts2Layer,
-    nuts3Layer
-  ],
-  project_name: 'erra/map',
-  default_view: new View({
-    center: [2433348.3022471312, 7744501.813885343],
-    zoom: 3.6,
-    units: 'm'
-  }),
-  advanced_form: true,
-  datasources: [],
-  hostname: {
-    default: {
-      title: 'Default',
-      type: 'default',
-      editable: false,
-      url: getHostname()
-    }
-  },
-  panelWidths: {
-  },
-  // allowAddExternalDatasets: false,
-  panelsEnabled: {
-    composition_browser: false,
-    legend: false,
-    draw: false,
-    info: false,
-    saveMap: false,
-    language: false
-  },
-  searchProvider: (q) => {
-    return `/app/jupyter-test/8085/search/?q=${q}`;
-  },
-  sizeMode: 'fullscreen'
+nuts3Layer.set('hoveredKeys', [
+  'NUTS_NAME',
+  'totalForHumans',
+  'Social & Human',
+  'Anthropic',
+  'Institutional',
+  'Economical',
+  'Natural',
+  'Cultural',
+]);
+nuts3Layer.set('hoveredKeysTranslations', {
+  NUTS_NAME: 'Name',
+  totalForHumans: 'Calculated score',
 });
 
-module.controller('Main', ['$scope', 'HsCore', '$compile', 'HsLayoutService', 'pra.adjuster.service',
-  function ($scope, Core, $compile, layoutService, adjusterService) {
-    $scope.Core = Core;
-    $scope.panelVisible = layoutService.panelVisible;
-    layoutService.sidebarRight = false;
-    // layoutService.sidebarToggleable = false;
-    // Core.singleDatasources = true;
-    layoutService.sidebarButtons = true;
-    layoutService.setDefaultPanel('adjuster');
-    $scope.$on('scope_loaded', function (event, args) {
-      // eslint-disable-next-line eqeqeq
-      if (args == 'Sidebar') {
-        const el = angular.element('<pra.adjuster hs.draggable ng-if="Core.exists(\'pra.adjuster\')" ng-show="panelVisible(\'adjuster\', this)"></pra.adjuster>')[0];
-        layoutService.panelListElement.appendChild(el);
-        $compile(el)($scope);
+angular
+  .module('hs', [
+    'hs.sidebar',
+    'hs.draw',
+    'hs.info',
+    'hs.toolbar',
+    'hs.layermanager',
+    'hs.query',
+    'hs.search',
+    'hs.print',
+    'hs.permalink',
+    'hs.geolocation',
+    'hs.datasource_selector',
+    'hs.save-map',
+    'hs.measure',
+    'hs.addLayers',
+    'pra.adjuster',
+  ])
+  .directive('hs', [
+    'HsConfig',
+    'HsCore',
+    function (config, Core) {
+      return {
+        template: Core.hslayersNgTemplate,
+        /* link: function (scope, element) {
+      Core.fullScreenMap(element);
+     } */
+      };
+    },
+  ])
+  .value('HsConfig', {
+    proxyPrefix: '../8085/',
+    default_layers: [
+      new Tile({
+        source: new OSM(),
+        title: 'Open street map',
+        base: true,
+        editor: {editable: false},
+        removable: false,
+      }),
+      nuts2Layer,
+      nuts3Layer,
+    ],
+    project_name: 'erra/map',
+    default_view: new View({
+      center: [2433348.3022471312, 7744501.813885343],
+      zoom: 3.6,
+      units: 'm',
+    }),
+    advanced_form: true,
+    datasources: [],
+    hostname: {
+      default: {
+        title: 'Default',
+        type: 'default',
+        editable: false,
+        url: getHostname(),
+      },
+    },
+    panelWidths: {},
+    // allowAddExternalDatasets: false,
+    panelsEnabled: {
+      composition_browser: false,
+      legend: false,
+      draw: false,
+      info: false,
+      saveMap: false,
+      language: false,
+    },
+    searchProvider: (q) => {
+      return `/app/jupyter-test/8085/search/?q=${q}`;
+    },
+    sizeMode: 'fullscreen',
+  })
+  .controller('MainController', [
+    '$scope',
+    'HsCore',
+    '$compile',
+    'HsLayoutService',
+    'pra.adjuster.service',
+    function ($scope, Core, $compile, layoutService, adjusterService) {
+      $scope.Core = Core;
+      $scope.panelVisible = layoutService.panelVisible;
+      layoutService.sidebarRight = false;
+      // layoutService.sidebarToggleable = false;
+      // Core.singleDatasources = true;
+      layoutService.sidebarButtons = true;
+      layoutService.setDefaultPanel('adjuster');
+      $scope.$on('scope_loaded', function (event, args) {
+        // eslint-disable-next-line eqeqeq
+        if (args == 'Sidebar') {
+          const el = angular.element(
+            '<pra.adjuster hs.draggable ng-if="Core.exists(\'pra.adjuster\')" ng-show="panelVisible(\'adjuster\', this)"></pra.adjuster>'
+          )[0];
+          layoutService.panelListElement.appendChild(el);
+          $compile(el)($scope);
 
-        const toolbarButton = angular.element('<div pra.adjuster.sidebar-btn></div>')[0];
-        layoutService.sidebarListElement.appendChild(toolbarButton);
-        $compile(toolbarButton)(event.targetScope);
-      }
-    });
-  }
-]);
+          const toolbarButton = angular.element(
+            '<div pra.adjuster.sidebar-btn></div>'
+          )[0];
+          layoutService.sidebarListElement.appendChild(toolbarButton);
+          $compile(toolbarButton)(event.targetScope);
+        }
+      });
+    },
+  ]);

+ 6 - 4
src/datasource-list.js

@@ -15,20 +15,22 @@ export default [
     title: 'Layman',
     url: `${window.location.protocol}//${window.location.hostname}/layman`,
     user: 'browser',
-    type: 'layman'
+    type: 'layman',
   },
   {
     title: 'OTN Hub',
     url: 'http://opentnet.eu/php/metadata/csw/',
     language: 'eng',
     type: 'micka',
-    code_list_url: 'http://opentnet.eu/php/metadata/util/codelists.php?_dc=1440156028103&language=eng&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D'
+    code_list_url:
+      'http://opentnet.eu/php/metadata/util/codelists.php?_dc=1440156028103&language=eng&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D',
   },
   {
     title: 'SuperCAT',
     url: 'http://cat.ccss.cz/csw/',
     language: 'eng',
     type: 'micka',
-    code_list_url: 'http://www.whatstheplan.eu/php/metadata/util/codelists.php?_dc=1440156028103&language=eng&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D'
-  }
+    code_list_url:
+      'http://www.whatstheplan.eu/php/metadata/util/codelists.php?_dc=1440156028103&language=eng&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D',
+  },
 ];

+ 1 - 1
src/index.html

@@ -15,7 +15,7 @@
 </head>
 
 <body>
-  <div hs ng-app="hs" ng-controller="Main" style="height: 100vh;"></div>
+  <div hs ng-app="hs" ng-controller="MainController" style="height: 100vh;"></div>
   <% for (var js in htmlWebpackPlugin.files.js) { %>
     <script type="application/javascript" src="<%= htmlWebpackPlugin.files.js[js] %>"></script>
   <% } %>

+ 5 - 5
src/nuts.js

@@ -1,14 +1,14 @@
-import { GeoJSON } from 'ol/format';
-import { Vector as VectorSource } from 'ol/source';
 import nuts2 from './NUTS_RG_20M_2016_3857_LEVL_2.json';
 import nuts3 from './NUTS_RG_20M_2016_3857_LEVL_3.json';
+import {GeoJSON} from 'ol/format';
+import {Vector as VectorSource} from 'ol/source';
 
 export default {
   nuts2Source: new VectorSource({
-    features: (new GeoJSON()).readFeatures(nuts2)
+    features: new GeoJSON().readFeatures(nuts2),
   }),
 
   nuts3Source: new VectorSource({
-    features: (new GeoJSON()).readFeatures(nuts3)
-  })
+    features: new GeoJSON().readFeatures(nuts3),
+  }),
 };

+ 9 - 8
src/proxy.js

@@ -1,14 +1,15 @@
-
 // Listen on a specific host via the HOST environment variable
 const host = process.env.HOST || '0.0.0.0';
 // Listen on a specific port via the PORT environment variable
 const port = process.env.PROXY_PORT || 8085;
 
 const corsProxy = require('cors-anywhere');
-corsProxy.createServer({
-  originWhitelist: [], // Allow all origins
-  // requireHeader: ['origin', 'x-requested-with'],
-  removeHeaders: ['cookie', 'cookie2']
-}).listen(port, host, function () {
-  console.log('Running CORS Anywhere on ' + host + ':' + port);
-});
+corsProxy
+  .createServer({
+    originWhitelist: [], // Allow all origins
+    // requireHeader: ['origin', 'x-requested-with'],
+    removeHeaders: ['cookie', 'cookie2'],
+  })
+  .listen(port, host, function () {
+    console.log('Running CORS Anywhere on ' + host + ':' + port);
+  });

+ 21 - 15
webpack.common.js

@@ -10,15 +10,18 @@
  *   `'ngInject';` or `@ngInject` in comments. See https://docs.angularjs.org/guide/di
  */
 const path = require('path');
-const { CleanWebpackPlugin } = require('clean-webpack-plugin');
+const {CleanWebpackPlugin} = require('clean-webpack-plugin');
 const HtmlWebpackPlugin = require('html-webpack-plugin');
-const hslPaths = require(path.join(__dirname, './node_modules/hslayers-ng/common_paths'));
+const hslPaths = require(path.join(
+  __dirname,
+  './node_modules/hslayers-ng/common_paths'
+));
 
 module.exports = {
-  entry: { main: './src/app.js' },
+  entry: {main: './src/app.js'},
   output: {
     // Path at which output assets will be served
-    publicPath: ''
+    publicPath: '',
   },
   // Just for build speed improvement
   resolve: {
@@ -26,8 +29,8 @@ module.exports = {
     modules: [
       path.join(__dirname),
       path.join(__dirname, './node_modules'),
-      path.resolve(path.join(__dirname, './node_modules', 'hslayers-ng'))
-    ].concat(hslPaths.paths)
+      path.resolve(path.join(__dirname, './node_modules', 'hslayers-ng')),
+    ].concat(hslPaths.paths),
   },
   plugins: [
     // Clean before build
@@ -37,9 +40,9 @@ module.exports = {
       filename: 'index.html',
       template: './src/index.html',
       // We manually inject css and js files in our template
-      inject: false
+      inject: false,
       // favicon: 'assets/img/favicon.ico'
-    })
+    }),
   ],
   module: {
     rules: [
@@ -55,11 +58,14 @@ module.exports = {
             options: {
               // Babel syntax dynamic import plugin allow babel to correctly parse js files
               // using webpack dynamic import expression (i.e import('angular').then(...))
-              plugins: ['angularjs-annotate', '@babel/plugin-syntax-dynamic-import']
-            }
-          }
-        ]
-      }
-    ]
-  }
+              plugins: [
+                'angularjs-annotate',
+                '@babel/plugin-syntax-dynamic-import',
+              ],
+            },
+          },
+        ],
+      },
+    ],
+  },
 };

+ 27 - 25
webpack.dev.js

@@ -17,47 +17,49 @@ module.exports = merge(common, {
   devtool: 'cheap-eval-source-map',
   watchOptions: {
     aggregateTimeout: 300,
-    poll: 1000
+    poll: 1000,
   },
   resolve: {
-    symlinks: true
+    symlinks: true,
   },
   optimization: {
     // see https://webpack.js.org/guides/build-performance#avoid-extra-optimization-steps
     removeAvailableModules: false,
     removeEmptyChunks: false,
     // In dev mode we simply want to get a big bundle containing all our js
-    splitChunks: false
+    splitChunks: false,
   },
   output: {
     // see https://webpack.js.org/guides/build-performance#output-without-path-info
     // Path where bundled files will be output
     path: path.resolve(__dirname, './static'),
     pathinfo: false,
-    filename: '[name].bundle.js'
+    filename: '[name].bundle.js',
   },
   devServer: {
     contentBase: path.resolve(__dirname, './static'),
     hot: false,
     host: '0.0.0.0',
-    port: env.HTTP_PORT || 8080
+    port: env.HTTP_PORT || 8080,
   },
   module: {
     rules: [
       // Load css files which will be injected in html page at startup <style>...</style>)
       {
         test: /\.css$/,
-        use: ['style-loader', 'css-loader']
+        use: ['style-loader', 'css-loader'],
       },
       {
         test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
-        use: [{
-          loader: 'file-loader',
-          options: {
-            name: '[name].[ext]',
-            outputPath: 'fonts/'
-          }
-        }]
+        use: [
+          {
+            loader: 'file-loader',
+            options: {
+              name: '[name].[ext]',
+              outputPath: 'fonts/',
+            },
+          },
+        ],
       },
       // Load angularJS partials HTML file as URL
       {
@@ -66,8 +68,8 @@ module.exports = merge(common, {
         use: [
           'ng-cache-loader?prefix=[dir]/[dir]',
           'extract-loader',
-          'html-loader'
-        ]
+          'html-loader',
+        ],
       },
       // Load images as URLs
       {
@@ -76,9 +78,9 @@ module.exports = merge(common, {
           loader: 'file-loader',
           options: {
             name: '[name].[ext]',
-            outputPath: 'images'
-          }
-        }
+            outputPath: 'images',
+          },
+        },
       },
       // Load locales files
       {
@@ -90,11 +92,11 @@ module.exports = merge(common, {
             loader: 'file-loader',
             options: {
               name: '[name].[ext]',
-              outputPath: 'locales'
-            }
-          }
-        ]
-      }
-    ]
-  }
+              outputPath: 'locales',
+            },
+          },
+        ],
+      },
+    ],
+  },
 });

+ 29 - 29
webpack.prod.js

@@ -29,19 +29,19 @@ module.exports = merge(common, {
     // Path where bundled files will be output
     path: path.resolve(__dirname, './build'),
     // Path at which output assets will be served
-    publicPath: ''
+    publicPath: '',
   },
   resolve: {
-    symlinks: true
+    symlinks: true,
   },
   plugins: [
     // Extract CSS into separated css files
     new MiniCssExtractPlugin({
       // Add a chunkhash to file name so it will not be cached by browsers when content changed
-      filename: '[name].[hash].bundle.css'
+      filename: '[name].[hash].bundle.css',
     }),
     // see https://webpack.js.org/guides/caching#module-identifiers
-    new webpack.HashedModuleIdsPlugin()
+    new webpack.HashedModuleIdsPlugin(),
   ],
   optimization: {
     // See https://webpack.js.org/guides/caching
@@ -52,9 +52,9 @@ module.exports = merge(common, {
         vendor: {
           name: 'vendors',
           test: /node_modules/,
-          chunks: 'initial'
-        }
-      }
+          chunks: 'initial',
+        },
+      },
     },
     minimizer: [
       // JS minifier/uglifier
@@ -62,15 +62,15 @@ module.exports = merge(common, {
         parallel: true,
         sourceMap: true,
         // Remove comments as well
-        terserOptions: { output: { comments: false } }
+        terserOptions: {output: {comments: false}},
       }),
       // CSS minifier
       new OptimizeCSSAssetsPlugin({
         cssProcessorPluginOptions: {
-          preset: ['default', { discardComments: { removeAll: true } }]
-        }
-      })
-    ]
+          preset: ['default', {discardComments: {removeAll: true}}],
+        },
+      }),
+    ],
   },
   module: {
     rules: [
@@ -81,23 +81,23 @@ module.exports = merge(common, {
           'style-loader',
           {
             loader: MiniCssExtractPlugin.loader,
-            options: { publicPath: '' }
+            options: {publicPath: ''},
           },
-          'css-loader'
-        ]
+          'css-loader',
+        ],
       },
       {
         test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
         use: {
-          loader: 'url-loader'
-        }
+          loader: 'url-loader',
+        },
       },
       // Load images as URLs
       {
         test: /\.(png|svg|jpg|gif)$/,
         use: {
-          loader: 'url-loader'
-        }
+          loader: 'url-loader',
+        },
       },
       // Load locales files
       {
@@ -109,10 +109,10 @@ module.exports = merge(common, {
             loader: 'file-loader',
             options: {
               name: '[name].[contenthash].[ext]',
-              outputPath: 'locales'
-            }
-          }
-        ]
+              outputPath: 'locales',
+            },
+          },
+        ],
       },
       // AngularJS templates are cached using cache template
       {
@@ -123,10 +123,10 @@ module.exports = merge(common, {
           'extract-loader',
           {
             loader: 'html-loader',
-            options: { minimize: true }
-          }
-        ]
-      }
-    ]
-  }
+            options: {minimize: true},
+          },
+        ],
+      },
+    ],
+  },
 });