Selaa lähdekoodia

🔥 remove dead code

jmacura 4 vuotta sitten
vanhempi
commit
c888f70e8f
5 muutettua tiedostoa jossa 0 lisäystä ja 353 poistoa
  1. 0 21
      src/app-js.ts
  2. BIN
      src/images/ajax-loader.gif
  3. 0 104
      webpack.common.js
  4. 0 98
      webpack.dev.js
  5. 0 130
      webpack.prod.js

+ 0 - 21
src/app-js.ts

@@ -1,21 +0,0 @@
-'use strict';
-import 'hslayers-ng/components/core';
-// hslayers-ng components must be loaded first, otherwise angular will be undefined
-// eslint-disable-next-line sort-imports-es6-autofix/sort-imports-es6
-import * as angular from 'angular';
-import {downgradeInjectable} from '@angular/upgrade/static';
-
-import './adjuster/';
-import {AppComponent} from './app.component';
-import {AppConfig} from './app.config';
-import {AppService} from './app.service';
-
-export default angular
-  .module('hs', [
-    'hs.core',
-    //'getteext',
-    'pra.adjuster',
-  ])
-  .value('HsConfig', AppConfig)
-  .component('hs', AppComponent)
-  .service('AppService', downgradeInjectable(AppService));

BIN
src/images/ajax-loader.gif


+ 0 - 104
webpack.common.js

@@ -1,104 +0,0 @@
-/**
- * Webpack common configuration.
- * it:
- * - Define the app entry point (./src) -> Where webpack will start compiling/bundling
- * - Define where assets will be served at by our webserver  (static/)
- * - Clean previous build on each build
- * - Generates the index.html file automatically by injecting bundled assets in it (css, js)
- * - Allow to load html files as strings in js code (i.e: import htmlString from './myHtmlFile.html)
- * - Allow to automatically generates the dependencies injection for angularJS components annotated with
- *   `'ngInject';` or `@ngInject` in comments. See https://docs.angularjs.org/guide/di
- */
-const fs = require('fs');
-const path = require('path');
-const {CleanWebpackPlugin} = require('clean-webpack-plugin');
-const HtmlWebpackPlugin = require('html-webpack-plugin');
-
-module.exports = {
-  entry: {main: './src/main.ts'},
-  output: {
-    // Path at which output assets will be served
-    publicPath: '',
-  },
-  // Just for build speed improvement
-  resolve: {
-    extensions: ['.ts', '.js'],
-    symlinks: true,
-    modules: [
-      __dirname,
-      path.resolve(path.join(__dirname, './node_modules')),
-      path.resolve(path.join(__dirname, './node_modules', 'hslayers-ng')),
-    ],
-  },
-  plugins: [
-    // Clean before build
-    new CleanWebpackPlugin(),
-    new HtmlWebpackPlugin({
-      // Path where the file will be generated (appended to output.path)
-      filename: 'index.html',
-      template: './src/index.html',
-      // We manually inject css and js files in our template
-      inject: false,
-      favicon: './src/images/cropped-favicon-32x32.png',
-    }),
-  ],
-  module: {
-    rules: [
-      {
-        test: /\.ts$/,
-        use: [
-          {loader: 'ng-annotate-loader'},
-          {loader: 'ts-loader', options: {allowTsInNodeModules: true}},
-        ],
-        exclude: /node_modules\/(?!(hslayers-ng)\/).*/,
-      },
-      // Automatically generates $inject array for angularJS components annotated with:
-      // 'ngInject';
-      // or commented with /**@ngInject */
-      {
-        test: /\.js$/,
-        exclude: /node_modules\/(?!(hslayers-ng)\/).*/,
-        use: [
-          {
-            loader: 'babel-loader',
-            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',
-              ],
-            },
-          },
-        ],
-      },
-      {
-        test: /\.scss$/,
-        use: [
-          'style-loader',
-          'css-loader',
-          {
-            loader: 'sass-loader',
-            options: {
-              additionalData: fs.existsSync('./src/custom.scss')
-                ? `@use "src/custom.scss" as *;`
-                : '',
-            },
-          },
-        ],
-      },
-      // Load data files
-      {
-        test: /\.(geo|topo)json$/,
-        include: path.resolve(__dirname, 'src/data'),
-        use: {
-          loader: 'file-loader',
-          options: {
-            name: '[name].[ext]',
-            outputPath: 'data',
-          },
-        },
-      },
-    ],
-  },
-};

+ 0 - 98
webpack.dev.js

@@ -1,98 +0,0 @@
-/**
- * Webpack development configuration (merged with common one).
- * it overrides the webpack.common.js configuration and:
- * - Set mode to development -> This mode is used by some plugins and webpack to prevent minifying assets etc...
- * - Generates a sourcemap of bundled code -> Allow to easily debug js code (do not use in prod)
- * - Remove some bundling optimization to speed it up
- * - Allow Load css files (import './myCssFile.css') -> Css rules will be automatically added to index.html into a <style></style> tag.
- * - Allow to load fonts and images (import './myFont.eot'; import './someImage.jpg')
- */
-const {merge} = require('webpack-merge');
-const common = require('./webpack.common');
-const path = require('path');
-const env = process.env;
-
-module.exports = merge(common, {
-  mode: 'development',
-  devtool: 'cheap-eval-source-map',
-  watchOptions: {
-    aggregateTimeout: 300,
-    poll: 1000,
-  },
-  resolve: {
-    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,
-  },
-  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',
-  },
-  devServer: {
-    contentBase: path.resolve(__dirname, './static'),
-    hot: false,
-    host: '0.0.0.0',
-    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'],
-      },
-      {
-        test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
-        use: [
-          {
-            loader: 'file-loader',
-            options: {
-              name: '[name].[ext]',
-              outputPath: 'fonts/',
-            },
-          },
-        ],
-      },
-      // Load angularJS partials HTML file as URL
-      {
-        test: /\.html$/,
-        exclude: path.resolve(__dirname, './src/index.html'),
-        use: ['html-loader'],
-      },
-      // Load images as URLs
-      {
-        test: /\.(png|svg|jpg|gif)$/,
-        use: {
-          loader: 'file-loader',
-          options: {
-            name: '[name].[ext]',
-            outputPath: 'images',
-          },
-        },
-      },
-      // Load locales files
-      {
-        type: 'javascript/auto',
-        test: /\.json$/,
-        include: path.resolve(__dirname, './src/assets/locales'),
-        use: [
-          {
-            loader: 'file-loader',
-            options: {
-              name: '[name].[ext]',
-              outputPath: 'locales',
-            },
-          },
-        ],
-      },
-    ],
-  },
-});

+ 0 - 130
webpack.prod.js

@@ -1,130 +0,0 @@
-/**
- * Webpack production configuration (merged with common config).
- * it overrides webpack.common.js configuration and:
- * - Set mode to production (allow to minify css, js etc...)
- * - Add content hash to files name -> This way, each time bundled files content changed, file name will be different.
- *   This allow browsers to keep cached files which did not change
- * - Minify/Uglify JS and CSS files
- * - Split js into two bundles: vendors (js comming from node_modules) and bundle (our own js)
- *   This way, when we change our js, only our bundle is changed so browsers can keep vendors js in cache
- * - Allow Load css files (import './myCssFile.css') -> Css rules will be automatically added to index.html into a <style></style> tag.
- * - Allow to load fonts and images (import './myFont.eot'; import './someImage.jpg')
- * - Allow to load html angularjs partials (i.e all html files under src folder) as url ->
- *
- */
-const {merge} = require('webpack-merge');
-const common = require('./webpack.common');
-const path = require('path');
-const webpack = require('webpack');
-const MiniCssExtractPlugin = require('mini-css-extract-plugin');
-const TerserPlugin = require('terser-webpack-plugin');
-const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
-
-module.exports = merge(common, {
-  mode: 'production',
-  devtool: 'source-map',
-  output: {
-    // Add a chunkhash to file name so it will not be cached by browsers when content changed
-    filename: '[name].[hash].bundle.js',
-    // Path where bundled files will be output
-    path: path.resolve(__dirname, './build'),
-    // Path at which output assets will be served
-    publicPath: '',
-  },
-  resolve: {
-    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',
-    }),
-    // see https://webpack.js.org/guides/caching#module-identifiers
-    new webpack.HashedModuleIdsPlugin(),
-  ],
-  optimization: {
-    // See https://webpack.js.org/guides/caching
-    runtimeChunk: 'single',
-    splitChunks: {
-      cacheGroups: {
-        // Bundle all initial chunks from node_modules into a "vendors" js file
-        vendor: {
-          name: 'vendors',
-          test: /node_modules/,
-          chunks: 'initial',
-        },
-      },
-    },
-    minimizer: [
-      // JS minifier/uglifier
-      new TerserPlugin({
-        parallel: true,
-        sourceMap: true,
-        // Remove comments as well
-        terserOptions: {output: {comments: false}},
-      }),
-      // CSS minifier
-      new OptimizeCSSAssetsPlugin({
-        cssProcessorPluginOptions: {
-          preset: ['default', {discardComments: {removeAll: true}}],
-        },
-      }),
-    ],
-  },
-  module: {
-    rules: [
-      // CSS files are bundled togethers
-      {
-        test: /\.css$/,
-        use: [
-          'style-loader',
-          {
-            loader: MiniCssExtractPlugin.loader,
-            options: {publicPath: ''},
-          },
-          'css-loader',
-        ],
-      },
-      {
-        test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
-        use: {
-          loader: 'url-loader',
-        },
-      },
-      // Load images as URLs
-      {
-        test: /\.(png|svg|jpg|gif)$/,
-        use: {
-          loader: 'url-loader',
-        },
-      },
-      // Load locales files
-      {
-        test: /\.json$/,
-        type: 'javascript/auto',
-        include: path.resolve(__dirname, 'src/assets/locales'),
-        use: [
-          {
-            loader: 'file-loader',
-            options: {
-              name: '[name].[contenthash].[ext]',
-              outputPath: 'locales',
-            },
-          },
-        ],
-      },
-      // AngularJS templates are cached using cache template
-      {
-        test: /\.html$/i,
-        exclude: path.resolve(__dirname, './src/index.html'),
-        use: [
-          {
-            loader: 'html-loader',
-            options: {minimize: true},
-          },
-        ],
-      },
-    ],
-  },
-});