diff --git a/src/FilterLists.Web/Program.cs b/src/FilterLists.Web/Program.cs index fa77aab57..d77e1b2a7 100644 --- a/src/FilterLists.Web/Program.cs +++ b/src/FilterLists.Web/Program.cs @@ -1,12 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; namespace FilterLists.Web { @@ -17,9 +10,11 @@ public static void Main(string[] args) BuildWebHost(args).Run(); } - public static IWebHost BuildWebHost(string[] args) => - WebHost.CreateDefaultBuilder(args) + public static IWebHost BuildWebHost(string[] args) + { + return WebHost.CreateDefaultBuilder(args) .UseStartup() .Build(); + } } -} +} \ No newline at end of file diff --git a/src/FilterLists.Web/Startup.cs b/src/FilterLists.Web/Startup.cs index 3f7449e10..91f8bb47a 100644 --- a/src/FilterLists.Web/Startup.cs +++ b/src/FilterLists.Web/Startup.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.SpaServices.Webpack; @@ -19,13 +15,11 @@ public Startup(IConfiguration configuration) public IConfiguration Configuration { get; } - // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) @@ -47,13 +41,13 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseMvc(routes => { routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + "default", + "{controller=Home}/{action=Index}/{id?}"); routes.MapSpaFallbackRoute( - name: "spa-fallback", - defaults: new { controller = "Home", action = "Index" }); + "spa-fallback", + new {controller = "Home", action = "Index"}); }); } } -} +} \ No newline at end of file diff --git a/src/FilterLists.Web/appsettings.Development.json b/src/FilterLists.Web/appsettings.Development.json deleted file mode 100644 index 457e00332..000000000 --- a/src/FilterLists.Web/appsettings.Development.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "Debug": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - }, - "Console": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } - } -} diff --git a/src/FilterLists.Web/npm-shrinkwrap.json b/src/FilterLists.Web/npm-shrinkwrap.json index e2bada825..ffe010de4 100644 --- a/src/FilterLists.Web/npm-shrinkwrap.json +++ b/src/FilterLists.Web/npm-shrinkwrap.json @@ -2129,7 +2129,8 @@ "postcss-modules-extract-imports": { "version": "1.1.0", "from": "postcss-modules-extract-imports@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.1.0.tgz", + "resolved": + "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.1.0.tgz", "dev": true, "dependencies": { "ansi-styles": { @@ -2167,7 +2168,8 @@ "postcss-modules-local-by-default": { "version": "1.2.0", "from": "postcss-modules-local-by-default@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz", + "resolved": + "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz", "dev": true, "dependencies": { "ansi-styles": { @@ -3374,4 +3376,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/FilterLists.Web/package.json b/src/FilterLists.Web/package.json index bb4a891c6..2e9a13fc4 100644 --- a/src/FilterLists.Web/package.json +++ b/src/FilterLists.Web/package.json @@ -31,4 +31,4 @@ "webpack": "2.5.1", "webpack-hot-middleware": "2.18.2" } -} +} \ No newline at end of file diff --git a/src/FilterLists.Web/tsconfig.json b/src/FilterLists.Web/tsconfig.json index ed5310109..591702887 100644 --- a/src/FilterLists.Web/tsconfig.json +++ b/src/FilterLists.Web/tsconfig.json @@ -11,7 +11,7 @@ "types": ["webpack-env"] }, "exclude": [ - "bin", - "node_modules" + "bin", + "node_modules" ] -} +} \ No newline at end of file diff --git a/src/FilterLists.Web/webpack.config.js b/src/FilterLists.Web/webpack.config.js index 01e45ea48..1b7e3f36e 100644 --- a/src/FilterLists.Web/webpack.config.js +++ b/src/FilterLists.Web/webpack.config.js @@ -1,43 +1,52 @@ -const path = require('path'); -const webpack = require('webpack'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin; -const bundleOutputDir = './wwwroot/dist'; +const path = require("path"); +const webpack = require("webpack"); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); +const CheckerPlugin = require("awesome-typescript-loader").CheckerPlugin; +const bundleOutputDir = "./wwwroot/dist"; module.exports = (env) => { const isDevBuild = !(env && env.prod); - return [{ - stats: { modules: false }, - entry: { 'main': './ClientApp/boot.tsx' }, - resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] }, - output: { - path: path.join(__dirname, bundleOutputDir), - filename: '[name].js', - publicPath: 'dist/' - }, - module: { - rules: [ - { test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' }, - { test: /\.css$/, use: isDevBuild ? ['style-loader', 'css-loader'] : ExtractTextPlugin.extract({ use: 'css-loader?minimize' }) }, - { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' } - ] - }, - plugins: [ - new CheckerPlugin(), - new webpack.DllReferencePlugin({ - context: __dirname, - manifest: require('./wwwroot/dist/vendor-manifest.json') - }) - ].concat(isDevBuild ? [ - // Plugins that apply in development builds only - new webpack.SourceMapDevToolPlugin({ - filename: '[file].map', // Remove this line if you prefer inline source maps - moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk - }) - ] : [ - // Plugins that apply in production builds only - new webpack.optimize.UglifyJsPlugin(), - new ExtractTextPlugin('site.css') - ]) - }]; + return [ + { + stats: { modules: false }, + entry: { 'main': "./ClientApp/boot.tsx" }, + resolve: { extensions: [".js", ".jsx", ".ts", ".tsx"] }, + output: { + path: path.join(__dirname, bundleOutputDir), + filename: "[name].js", + publicPath: "dist/" + }, + module: { + rules: [ + { test: /\.tsx?$/, include: /ClientApp/, use: "awesome-typescript-loader?silent=true" }, + { + test: /\.css$/, + use: isDevBuild + ? ["style-loader", "css-loader"] + : ExtractTextPlugin.extract({ use: "css-loader?minimize" }) + }, + { test: /\.(png|jpg|jpeg|gif|svg)$/, use: "url-loader?limit=25000" } + ] + }, + plugins: [ + new CheckerPlugin(), + new webpack.DllReferencePlugin({ + context: __dirname, + manifest: require("./wwwroot/dist/vendor-manifest.json") + }) + ].concat(isDevBuild + ? [ + new webpack.SourceMapDevToolPlugin({ + filename: "[file].map", + moduleFilenameTemplate: + path.relative(bundleOutputDir, + "[resourcePath]") + }) + ] + : [ + new webpack.optimize.UglifyJsPlugin(), + new ExtractTextPlugin("site.css") + ]) + } + ]; }; \ No newline at end of file diff --git a/src/FilterLists.Web/webpack.config.vendor.js b/src/FilterLists.Web/webpack.config.vendor.js index d23ac4ffb..1d27ef758 100644 --- a/src/FilterLists.Web/webpack.config.vendor.js +++ b/src/FilterLists.Web/webpack.config.vendor.js @@ -1,42 +1,55 @@ -const path = require('path'); -const webpack = require('webpack'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const path = require("path"); +const webpack = require("webpack"); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); module.exports = (env) => { - const extractCSS = new ExtractTextPlugin('vendor.css'); + const extractCSS = new ExtractTextPlugin("vendor.css"); const isDevBuild = !(env && env.prod); - return [{ - stats: { modules: false }, - resolve: { - extensions: [ '.js' ] - }, - module: { - rules: [ - { test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' }, - { test: /\.css(\?|$)/, use: extractCSS.extract([ isDevBuild ? 'css-loader' : 'css-loader?minimize' ]) } - ] - }, - entry: { - vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'event-source-polyfill', 'isomorphic-fetch', 'react', 'react-dom', 'react-router-dom', 'jquery'], - }, - output: { - path: path.join(__dirname, 'wwwroot', 'dist'), - publicPath: 'dist/', - filename: '[name].js', - library: '[name]_[hash]', - }, - plugins: [ - extractCSS, - new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable) - new webpack.DllPlugin({ - path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'), - name: '[name]_[hash]' - }), - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': isDevBuild ? '"development"' : '"production"' - }) - ].concat(isDevBuild ? [] : [ - new webpack.optimize.UglifyJsPlugin() - ]) - }]; -}; + return [ + { + stats: { modules: false }, + resolve: { + extensions: [".js"] + }, + module: { + rules: [ + { test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: "url-loader?limit=100000" }, + { + test: /\.css(\?|$)/, + use: extractCSS.extract([isDevBuild ? "css-loader" : "css-loader?minimize"]) + } + ] + }, + entry: { + vendor: [ + "bootstrap", "bootstrap/dist/css/bootstrap.css", "event-source-polyfill", "isomorphic-fetch", + "react", "react-dom", "react-router-dom", "jquery" + ], + }, + output: { + path: path.join(__dirname, "wwwroot", "dist"), + publicPath: "dist/", + filename: "[name].js", + library: "[name]_[hash]", + }, + plugins: [ + extractCSS, + new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery" + }), + new webpack.DllPlugin({ + path: path.join(__dirname, "wwwroot", "dist", "[name]-manifest.json"), + name: "[name]_[hash]" + }), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': isDevBuild ? '"development"' : '"production"' + }) + ].concat(isDevBuild + ? [] + : [ + new webpack.optimize.UglifyJsPlugin() + ]) + } + ]; +}; \ No newline at end of file