resharper cleanup

This commit is contained in:
Collin M. Barrett 2017-10-31 07:41:01 -05:00
parent c3d0020156
commit 3fd9e7f62e
8 changed files with 119 additions and 125 deletions

View file

@ -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<Startup>()
.Build();
}
}
}
}

View file

@ -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"});
});
}
}
}
}

View file

@ -1,19 +0,0 @@
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"Console": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
}

View file

@ -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 @@
}
}
}
}
}

View file

@ -31,4 +31,4 @@
"webpack": "2.5.1",
"webpack-hot-middleware": "2.18.2"
}
}
}

View file

@ -11,7 +11,7 @@
"types": ["webpack-env"]
},
"exclude": [
"bin",
"node_modules"
"bin",
"node_modules"
]
}
}

View file

@ -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")
])
}
];
};

View file

@ -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()
])
}
];
};