From 447184ca4ae3f691c0b7007cbb1f002862f12566 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 2 Jun 2020 01:01:15 +0800 Subject: Upgrade packages. --- Timeline/ClientApp/.eslintignore | 5 ++ Timeline/ClientApp/.eslintrc.js | 2 +- Timeline/ClientApp/.yarnrc.yml | 6 +- Timeline/ClientApp/package.json | 36 +++++------ .../ClientApp/tsconfig-for-webpack-config.json | 13 ---- Timeline/ClientApp/webpack.common.js | 60 ++++++++++++++++++ Timeline/ClientApp/webpack.common.ts | 57 ----------------- Timeline/ClientApp/webpack.config.dev.js | 73 ++++++++++++++++++++++ Timeline/ClientApp/webpack.config.dev.ts | 73 ---------------------- Timeline/ClientApp/webpack.config.prod.js | 65 +++++++++++++++++++ Timeline/ClientApp/webpack.config.prod.ts | 64 ------------------- 11 files changed, 223 insertions(+), 231 deletions(-) create mode 100644 Timeline/ClientApp/.eslintignore delete mode 100644 Timeline/ClientApp/tsconfig-for-webpack-config.json create mode 100644 Timeline/ClientApp/webpack.common.js delete mode 100644 Timeline/ClientApp/webpack.common.ts create mode 100644 Timeline/ClientApp/webpack.config.dev.js delete mode 100644 Timeline/ClientApp/webpack.config.dev.ts create mode 100644 Timeline/ClientApp/webpack.config.prod.js delete mode 100644 Timeline/ClientApp/webpack.config.prod.ts diff --git a/Timeline/ClientApp/.eslintignore b/Timeline/ClientApp/.eslintignore new file mode 100644 index 00000000..371b5fcb --- /dev/null +++ b/Timeline/ClientApp/.eslintignore @@ -0,0 +1,5 @@ +.yarn +node_modules +dist +webpack.*.js +.eslintrc.js diff --git a/Timeline/ClientApp/.eslintrc.js b/Timeline/ClientApp/.eslintrc.js index e1cd037e..1ffb15de 100644 --- a/Timeline/ClientApp/.eslintrc.js +++ b/Timeline/ClientApp/.eslintrc.js @@ -20,7 +20,7 @@ module.exports = { }, parser: '@typescript-eslint/parser', parserOptions: { - project: ['./tsconfig.json', './tsconfig-for-webpack-config.json'], + project: ['./tsconfig.json'], ecmaFeatures: { jsx: true, }, diff --git a/Timeline/ClientApp/.yarnrc.yml b/Timeline/ClientApp/.yarnrc.yml index 5614d154..0e4fbd7d 100644 --- a/Timeline/ClientApp/.yarnrc.yml +++ b/Timeline/ClientApp/.yarnrc.yml @@ -1 +1,5 @@ -yarnPath: ".yarn/releases/yarn-berry.js" +plugins: + - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.js + spec: "@yarnpkg/plugin-interactive-tools" + +yarnPath: .yarn/releases/yarn-berry.js diff --git a/Timeline/ClientApp/package.json b/Timeline/ClientApp/package.json index f47749b0..7742fb87 100644 --- a/Timeline/ClientApp/package.json +++ b/Timeline/ClientApp/package.json @@ -5,10 +5,10 @@ "homepage": "https://crupest.xyz", "dependencies": { "@fortawesome/fontawesome-free": "^5.13.0", - "axios": "^0.19.0", + "axios": "^0.19.2", "bootstrap": "^4.5.0", "classnames": "^2.2.6", - "clsx": "^1.0.4", + "clsx": "^1.1.1", "core-js": "^3.6.5", "i18next": "^19.4.5", "i18next-browser-languagedetector": "^4.2.0", @@ -27,8 +27,8 @@ "xregexp": "^4.3.0" }, "scripts": { - "start": "cross-env TS_NODE_PROJECT=\"tsconfig-for-webpack-config.json\" webpack-dev-server --config ./webpack.config.dev.ts", - "build": "cross-env TS_NODE_PROJECT=\"tsconfig-for-webpack-config.json\" webpack --config ./webpack.config.prod.ts", + "start": "webpack-dev-server --config ./webpack.config.dev.js", + "build": "webpack --config ./webpack.config.prod.js", "lint": "eslint src/ --ext .js --ext .jsx --ext .ts --ext .tsx" }, "browserslist": { @@ -44,20 +44,18 @@ ] }, "devDependencies": { - "@babel/core": "^7.10.1", + "@babel/core": "^7.10.2", "@babel/plugin-proposal-class-properties": "^7.10.1", "@babel/plugin-proposal-decorators": "^7.10.1", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", "@babel/plugin-proposal-optional-chaining": "^7.10.1", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/preset-env": "^7.10.1", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/preset-env": "^7.10.2", "@babel/preset-react": "^7.10.1", "@babel/preset-typescript": "^7.10.1", "@hot-loader/react-dom": "^16.13.0", "@types/classnames": "^2.2.10", - "@types/copy-webpack-plugin": "^5.0.1", - "@types/html-webpack-plugin": "^3.2.3", - "@types/lodash": "^4.14.153", + "@types/lodash": "^4.14.154", "@types/node": "^14.0.6", "@types/react": "^16.9.35", "@types/react-dom": "^16.9.8", @@ -65,19 +63,15 @@ "@types/react-router": "^5.1.7", "@types/react-router-dom": "^5.1.5", "@types/reactstrap": "^8.4.2", - "@types/webpack": "^4.41.14", - "@types/webpack-dev-server": "^3.11.0", - "@types/webpack-env": "^1.15.2", "@types/xregexp": "^4.3.0", - "@typescript-eslint/eslint-plugin": "^2.34.0", - "@typescript-eslint/parser": "^2.34.0", + "@typescript-eslint/eslint-plugin": "^3.0.2", + "@typescript-eslint/parser": "^3.0.2", "autoprefixer": "^9.8.0", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^5.0.4", - "cross-env": "^7.0.2", + "copy-webpack-plugin": "^6.0.1", "css-loader": "^3.5.3", - "eslint": "^6.7.1", + "eslint": "^7.1.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-react": "^7.20.0", @@ -93,12 +87,10 @@ "sass": "^1.26.7", "sass-loader": "^8.0.2", "style-loader": "^1.2.1", - "ts-node": "^8.10.2", - "tsconfig-paths": "^3.9.0", - "typescript": "^3.9.3", + "typescript": "^3.9.4", "url-loader": "^4.1.0", "webpack": "^4.43.0", - "webpack-cli": "^3.3.9", + "webpack-cli": "^3.3.11", "webpack-dev-server": "^3.11.0" } } diff --git a/Timeline/ClientApp/tsconfig-for-webpack-config.json b/Timeline/ClientApp/tsconfig-for-webpack-config.json deleted file mode 100644 index bb6f2a7a..00000000 --- a/Timeline/ClientApp/tsconfig-for-webpack-config.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "esModuleInterop": true - }, - "include": [ - "webpack.common.ts", - "webpack.config.dev.ts", - "webpack.config.prod.ts", - "webpack.config.prod.dev.ts" - ] -} \ No newline at end of file diff --git a/Timeline/ClientApp/webpack.common.js b/Timeline/ClientApp/webpack.common.js new file mode 100644 index 00000000..4a0527ea --- /dev/null +++ b/Timeline/ClientApp/webpack.common.js @@ -0,0 +1,60 @@ +const autoprefixer = require('autoprefixer'); +const htmlWebpackTemplate = require('html-webpack-template'); + +const commonRules = [ + { + test: /\.css$/, + use: ['style-loader', 'css-loader'], + }, + { + test: /\.(scss)$/, + use: [ + 'style-loader', + 'css-loader', + { + loader: 'postcss-loader', + options: { + plugins: function () { + return [autoprefixer]; + }, + }, + }, + 'sass-loader', + ], + }, + { + test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot)$/i, + use: [ + { + loader: 'url-loader', + options: { + limit: 8192, + }, + }, + ], + }, +]; + +const htmlCommonConfig = { + inject: false, + template: htmlWebpackTemplate, + + appMountId: 'app', + mobile: true, + + headHtmlSnippet: ` + + + + + + + + `, + title: 'Timeline', +}; + +module.exports = { + commonRules, + htmlCommonConfig, +}; diff --git a/Timeline/ClientApp/webpack.common.ts b/Timeline/ClientApp/webpack.common.ts deleted file mode 100644 index c4e95e54..00000000 --- a/Timeline/ClientApp/webpack.common.ts +++ /dev/null @@ -1,57 +0,0 @@ -import webpack from 'webpack'; -import HtmlWebpackPlugin from 'html-webpack-plugin'; -import autoprefixer from 'autoprefixer'; -import htmlWebpackTemplate from 'html-webpack-template'; - -export const commonRules: webpack.RuleSetRule[] = [ - { - test: /\.css$/, - use: ['style-loader', 'css-loader'], - }, - { - test: /\.(scss)$/, - use: [ - 'style-loader', - 'css-loader', - { - loader: 'postcss-loader', - options: { - plugins: function () { - return [autoprefixer]; - }, - }, - }, - 'sass-loader', - ], - }, - { - test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot)$/i, - use: [ - { - loader: 'url-loader', - options: { - limit: 8192, - }, - }, - ], - }, -]; - -export const htmlCommonConfig: HtmlWebpackPlugin.Options = { - inject: false, - template: htmlWebpackTemplate, - - appMountId: 'app', - mobile: true, - - headHtmlSnippet: ` - - - - - - - - `, - title: 'Timeline', -}; diff --git a/Timeline/ClientApp/webpack.config.dev.js b/Timeline/ClientApp/webpack.config.dev.js new file mode 100644 index 00000000..12b25253 --- /dev/null +++ b/Timeline/ClientApp/webpack.config.dev.js @@ -0,0 +1,73 @@ +const path = require('path'); +const webpack = require('webpack'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); +const PnpWebpackPlugin = require('pnp-webpack-plugin'); + +const { commonRules, htmlCommonConfig } = require('./webpack.common'); + +const config = { + entry: ['react-hot-loader/patch', './src/index.tsx'], + mode: 'development', + devtool: 'eval-source-map', + module: { + rules: [ + ...commonRules, + { + test: /\.(js|jsx|ts|tsx)$/, + exclude: /node_modules/, + loader: 'babel-loader', + options: { + plugins: ['react-hot-loader/babel'], + }, + }, + ], + }, + resolve: { + alias: { + 'react-dom': '@hot-loader/react-dom', + }, + extensions: ['*', '.js', '.jsx', '.ts', '.tsx'], + plugins: [PnpWebpackPlugin], + }, + resolveLoader: { + plugins: [PnpWebpackPlugin.moduleLoader(module)], + }, + optimization: { + runtimeChunk: 'single', + splitChunks: { + chunks: 'all', + cacheGroups: { + vendor: { + test: /[\\/]node_modules[\\/]/, + name: 'vendors', + chunks: 'all', + }, + }, + }, + }, + output: { + path: path.resolve(__dirname, 'dist/'), + filename: '[name].[hash].js', + chunkFilename: '[name].[hash].js', + publicPath: '/', + }, + devServer: { + contentBase: path.join(__dirname, 'public/'), + host: '0.0.0.0', + port: 3000, + publicPath: 'http://localhost:3000/', + historyApiFallback: true, + hotOnly: true, + }, + plugins: [ + new HtmlWebpackPlugin({ + ...htmlCommonConfig, + devServer: 'http://localhost:3000', + }), + new ForkTsCheckerWebpackPlugin(), + new webpack.HotModuleReplacementPlugin(), + ], +}; + +module.exports = config; diff --git a/Timeline/ClientApp/webpack.config.dev.ts b/Timeline/ClientApp/webpack.config.dev.ts deleted file mode 100644 index 17c227b3..00000000 --- a/Timeline/ClientApp/webpack.config.dev.ts +++ /dev/null @@ -1,73 +0,0 @@ -import path from 'path'; -import webpack from 'webpack'; -import HtmlWebpackPlugin from 'html-webpack-plugin'; -import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; -import PnpWebpackPlugin from 'pnp-webpack-plugin'; - -import { commonRules, htmlCommonConfig } from './webpack.common'; - -const config: webpack.Configuration = { - entry: ['react-hot-loader/patch', './src/index.tsx'], - mode: 'development', - devtool: 'eval-source-map', - module: { - rules: [ - ...commonRules, - { - test: /\.(js|jsx|ts|tsx)$/, - exclude: /node_modules/, - loader: 'babel-loader', - options: { - plugins: ['react-hot-loader/babel'], - }, - }, - ], - }, - resolve: { - alias: { - 'react-dom': '@hot-loader/react-dom', - }, - extensions: ['*', '.js', '.jsx', '.ts', '.tsx'], - plugins: [PnpWebpackPlugin], - }, - resolveLoader: { - plugins: [PnpWebpackPlugin.moduleLoader(module)], - }, - optimization: { - runtimeChunk: 'single', - splitChunks: { - chunks: 'all', - cacheGroups: { - vendor: { - test: /[\\/]node_modules[\\/]/, - name: 'vendors', - chunks: 'all', - }, - }, - }, - }, - output: { - path: path.resolve(__dirname, 'dist/'), - filename: '[name].[hash].js', - chunkFilename: '[name].[hash].js', - publicPath: '/', - }, - devServer: { - contentBase: path.join(__dirname, 'public/'), - host: '0.0.0.0', - port: 3000, - publicPath: 'http://localhost:3000/', - historyApiFallback: true, - hotOnly: true, - }, - plugins: [ - new HtmlWebpackPlugin({ - ...htmlCommonConfig, - devServer: 'http://localhost:3000', - }), - new ForkTsCheckerWebpackPlugin(), - new webpack.HotModuleReplacementPlugin(), - ], -}; - -export default config; diff --git a/Timeline/ClientApp/webpack.config.prod.js b/Timeline/ClientApp/webpack.config.prod.js new file mode 100644 index 00000000..2115824d --- /dev/null +++ b/Timeline/ClientApp/webpack.config.prod.js @@ -0,0 +1,65 @@ +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); +const CopyPlugin = require('copy-webpack-plugin'); +const PnpWebpackPlugin = require('pnp-webpack-plugin'); + +const { commonRules, htmlCommonConfig } = require('./webpack.common'); + +const config = { + entry: ['./src/index.tsx'], + mode: 'production', + devtool: 'source-map', + module: { + rules: [ + ...commonRules, + { + test: /\.(js|jsx|ts|tsx)$/, + exclude: /node_modules/, + loader: 'babel-loader', + }, + ], + }, + resolve: { + extensions: ['*', '.js', '.jsx', '.ts', '.tsx'], + plugins: [PnpWebpackPlugin], + }, + resolveLoader: { + plugins: [PnpWebpackPlugin.moduleLoader(module)], + }, + optimization: { + runtimeChunk: 'single', + splitChunks: { + chunks: 'all', + cacheGroups: { + vendor: { + test: /[\\/]node_modules[\\/]/, + name: 'vendors', + chunks: 'all', + }, + }, + }, + }, + output: { + path: path.resolve(__dirname, 'dist/'), + filename: '[name].[hash].js', + chunkFilename: '[name].[hash].js', + publicPath: '/', + }, + plugins: [ + new CleanWebpackPlugin(), + new HtmlWebpackPlugin(htmlCommonConfig), + new ForkTsCheckerWebpackPlugin(), + new CopyPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'public/'), + to: path.resolve(__dirname, 'dist/'), + }, + ], + }), + ], +}; + +module.exports = config; diff --git a/Timeline/ClientApp/webpack.config.prod.ts b/Timeline/ClientApp/webpack.config.prod.ts deleted file mode 100644 index f7cb0374..00000000 --- a/Timeline/ClientApp/webpack.config.prod.ts +++ /dev/null @@ -1,64 +0,0 @@ -import path from 'path'; -import webpack from 'webpack'; -import { CleanWebpackPlugin } from 'clean-webpack-plugin'; -import HtmlWebpackPlugin from 'html-webpack-plugin'; -import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; -import CopyPlugin from 'copy-webpack-plugin'; -import PnpWebpackPlugin from 'pnp-webpack-plugin'; - -import { commonRules, htmlCommonConfig } from './webpack.common'; - -const config: webpack.Configuration = { - entry: ['./src/index.tsx'], - mode: 'production', - devtool: 'source-map', - module: { - rules: [ - ...commonRules, - { - test: /\.(js|jsx|ts|tsx)$/, - exclude: /node_modules/, - loader: 'babel-loader', - }, - ], - }, - resolve: { - extensions: ['*', '.js', '.jsx', '.ts', '.tsx'], - plugins: [PnpWebpackPlugin], - }, - resolveLoader: { - plugins: [PnpWebpackPlugin.moduleLoader(module)], - }, - optimization: { - runtimeChunk: 'single', - splitChunks: { - chunks: 'all', - cacheGroups: { - vendor: { - test: /[\\/]node_modules[\\/]/, - name: 'vendors', - chunks: 'all', - }, - }, - }, - }, - output: { - path: path.resolve(__dirname, 'dist/'), - filename: '[name].[hash].js', - chunkFilename: '[name].[hash].js', - publicPath: '/', - }, - plugins: [ - new CleanWebpackPlugin(), - new HtmlWebpackPlugin(htmlCommonConfig), - new ForkTsCheckerWebpackPlugin(), - new CopyPlugin([ - { - from: path.resolve(__dirname, 'public/'), - to: path.resolve(__dirname, 'dist/'), - }, - ]), - ], -}; - -export default config; -- cgit v1.2.3