From 4822ea8fa29e016b176d38274623408631f0bf71 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Tue, 21 Jan 2020 21:38:51 +0100 Subject: [PATCH] Add webpack types and fix config --- package.json | 3 +++ webpack.config.ts | 15 ++++++------ yarn.lock | 62 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 62ed2837..7b082591 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "@types/async-retry": "1.4.1", "@types/color": "3.0.1", "@types/columnify": "^1.5.0", + "@types/copy-webpack-plugin": "5.0.0", "@types/electron-devtools-installer": "2.2.0", "@types/fs-extra": "8.0.1", "@types/mkdirp": "0.5.2", @@ -84,8 +85,10 @@ "@types/react-redux": "^7.1.6", "@types/seamless-immutable": "7.1.11", "@types/styled-jsx": "2.2.8", + "@types/terser-webpack-plugin": "2.2.0", "@types/uuid": "3.4.6", "@types/webdriverio": "^4.8.0", + "@types/webpack": "4.41.3", "@types/winreg": "1.2.30", "@typescript-eslint/eslint-plugin": "2.17.0", "@typescript-eslint/parser": "2.17.0", diff --git a/webpack.config.ts b/webpack.config.ts index 4476fc47..39a25607 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -1,8 +1,7 @@ -const path = require('path'); - -const webpack = require('webpack'); -const Copy = require('copy-webpack-plugin'); -const TerserPlugin = require('terser-webpack-plugin'); +import Copy from 'copy-webpack-plugin'; +import path from 'path'; +import TerserPlugin from 'terser-webpack-plugin'; +import webpack from 'webpack'; const nodeEnv = process.env.NODE_ENV || 'development'; const isProd = nodeEnv === 'production'; @@ -32,19 +31,19 @@ module.exports = [ new Copy([ { from: './app/*.html', - exclude: /node_modules/, + ignore: ['/node_modules/'], to: '.', flatten: true }, { from: './app/*.json', - exclude: /node_modules/, + ignore: ['/node_modules/'], to: '.', flatten: true }, { from: './app/keymaps/*.json', - exclude: /node_modules/, + ignore: ['/node_modules/'], to: './keymaps', flatten: true }, diff --git a/yarn.lock b/yarn.lock index 32f5e7bd..8d6893c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -535,6 +535,11 @@ dependencies: defer-to-connect "^1.1.1" +"@types/anymatch@*": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" + integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== + "@types/args@3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/args/-/args-3.0.0.tgz#2fd21cfbdaf5e1ed110bd239de42a82330d6ecf6" @@ -581,6 +586,15 @@ resolved "https://registry.yarnpkg.com/@types/columnify/-/columnify-1.5.0.tgz#94bb31f14c66bab6d968caa455ff13af1f0e7632" integrity sha512-f39gUbf4NuSTVG9XEUJzYQ8L9e3l91jwywbJdU0fJixCRHKzQnyWxa9KfRPEuC3PhH5TIAi79kX2sAkXXSTB9Q== +"@types/copy-webpack-plugin@5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@types/copy-webpack-plugin/-/copy-webpack-plugin-5.0.0.tgz#db7f9c9763b10b2af5c83f598fa9b5a13733b20b" + integrity sha512-yQHocgdgES7W5Q2UyxJ5cj/E6MrV1zq3MZ8jdApS9NJKqax+rux9IE3QAbBmNCGbgivEsejrkIq3Rm76JLubkg== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + "@types/webpack" "*" + "@types/debug@^4.1.4", "@types/debug@^4.1.5": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" @@ -739,6 +753,11 @@ resolved "https://registry.yarnpkg.com/@types/seamless-immutable/-/seamless-immutable-7.1.11.tgz#89250c3e2587a44c2a051f5798e6f29f0e91bbc9" integrity sha512-U8Mp+Q6P5ZxG6KDRwWduQl822MnsnBtOq/Lb4HQB9Tzi8t1nr7PLqq88I4kTwEDHO95hcH8y8KhGvxWPIS6QoQ== +"@types/source-list-map@*": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" + integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA== + "@types/styled-jsx@2.2.8": version "2.2.8" resolved "https://registry.yarnpkg.com/@types/styled-jsx/-/styled-jsx-2.2.8.tgz#b50d13d8a3c34036282d65194554cf186bab7234" @@ -746,6 +765,26 @@ dependencies: "@types/react" "*" +"@types/tapable@*": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.5.tgz#9adbc12950582aa65ead76bffdf39fe0c27a3c02" + integrity sha512-/gG2M/Imw7cQFp8PGvz/SwocNrmKFjFsm5Pb8HdbHkZ1K8pmuPzOX4VeVoiEecFCVf4CsN1r3/BRvx+6sNqwtQ== + +"@types/terser-webpack-plugin@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@types/terser-webpack-plugin/-/terser-webpack-plugin-2.2.0.tgz#b1561e3118b9319d80ff65798c345877669b3e12" + integrity sha512-ywqEfTm7KdKoX9aYx0zYtiFU1z6IHrIYW9FJqeay2Ea58rTPML1J0hvoztGal2Jow3bkgGKcAmEZNL+8LqUVrA== + dependencies: + "@types/webpack" "*" + terser "^4.3.9" + +"@types/uglify-js@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.4.tgz#96beae23df6f561862a830b4288a49e86baac082" + integrity sha512-SudIN9TRJ+v8g5pTG8RRCqfqTMNqgWCKKd3vtynhGzkIIjxaicNAMuY5TRadJ6tzDu3Dotf3ngaMILtmOdmWEQ== + dependencies: + source-map "^0.6.1" + "@types/uuid@3.4.6": version "3.4.6" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.6.tgz#d2c4c48eb85a757bf2927f75f939942d521e3016" @@ -760,6 +799,27 @@ dependencies: "@types/node" "*" +"@types/webpack-sources@*": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-0.1.6.tgz#3d21dfc2ec0ad0c77758e79362426a9ba7d7cbcb" + integrity sha512-FtAWR7wR5ocJ9+nP137DV81tveD/ZgB1sadnJ/axUGM3BUVfRPx8oQNMtv3JNfTeHx3VP7cXiyfR/jmtEsVHsQ== + dependencies: + "@types/node" "*" + "@types/source-list-map" "*" + source-map "^0.6.1" + +"@types/webpack@*", "@types/webpack@4.41.3": + version "4.41.3" + resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.3.tgz#30c2251db1d69a45bbffd79c0577dd9baf50e7ba" + integrity sha512-dH+BZ6pHBZFrXpnif0YU/PbmUq3lQrvRPnqkxsciSIzvG/DE+Vm/Wrjn56T7V3+B5ryQa5fw0oGnHL8tk4ll6w== + dependencies: + "@types/anymatch" "*" + "@types/node" "*" + "@types/tapable" "*" + "@types/uglify-js" "*" + "@types/webpack-sources" "*" + source-map "^0.6.0" + "@types/winreg@1.2.30": version "1.2.30" resolved "https://registry.yarnpkg.com/@types/winreg/-/winreg-1.2.30.tgz#91d6710e536d345b9c9b017c574cf6a8da64c518" @@ -8183,7 +8243,7 @@ terser-webpack-plugin@^1.4.3: webpack-sources "^1.4.0" worker-farm "^1.7.0" -terser@4.6.3, terser@^4.4.3: +terser@4.6.3, terser@^4.3.9, terser@^4.4.3: version "4.6.3" resolved "https://registry.yarnpkg.com/terser/-/terser-4.6.3.tgz#e33aa42461ced5238d352d2df2a67f21921f8d87" integrity sha512-Lw+ieAXmY69d09IIc/yqeBqXpEQIpDGZqT34ui1QWXIUpR2RjbqEkT8X7Lgex19hslSqcWM5iMN2kM11eMsESQ==