From 2997ff8862725304903e57735f5d37b3353a70d1 Mon Sep 17 00:00:00 2001 From: uwap Date: Thu, 8 Oct 2020 20:31:42 +0200 Subject: [PATCH] Various improvements --- .babelrc | 4 +++- index.ejs | 1 - package.json | 16 +++++++-------- src/components/TopBar.js | 15 ++++---------- src/index.jsx | 4 ++++ webpack.config.js | 13 ++++++------ yarn.lock | 44 +++++++++------------------------------- 7 files changed, 35 insertions(+), 62 deletions(-) diff --git a/.babelrc b/.babelrc index e0278e3..8b51aa3 100644 --- a/.babelrc +++ b/.babelrc @@ -2,7 +2,9 @@ "presets": [ ["@babel/preset-env", { modules: false, - corejs: 3 + corejs: "3.6", + useBuiltIns: "entry", + targets: "last 3 years" }], "@babel/preset-react", "@babel/preset-flow" diff --git a/index.ejs b/index.ejs index bede683..af4cf0c 100644 --- a/index.ejs +++ b/index.ejs @@ -2,7 +2,6 @@ - <%= htmlWebpackPlugin.options.title %> diff --git a/package.json b/package.json index 06aa0fb..6403a40 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "author": "uwap ", "description": "Control Devices via mqtt, visualized on a Map", "scripts": { - "build": "webpack --bail --config webpack.config.js -p --env", + "build": "webpack --bail --config webpack.config.js --mode production --env", "dev": "webpack --bail --config webpack.config.js --mode development --env", "watch": "webpack-dev-server --open --config webpack.config.js --mode development --env", "travis": "./travis.sh", @@ -13,15 +13,12 @@ }, "dependencies": { "@material-ui/core": "^4.11.0", - "@material-ui/lab": "^4.0.0-alpha.56", "@mdi/react": "^1.4.0", "leaflet": "^1.5.1", - "lodash-es": "^4.17.15", "mqtt": "^4.2.1", "react": "^16.8.6", "react-dom": "^16.8.6", - "react-leaflet": "^2.4.0", - "redux": "^4.0.4" + "react-leaflet": "^2.4.0" }, "devDependencies": { "@babel/cli": "^7.5.5", @@ -35,7 +32,7 @@ "babel-eslint": "^10.0.2", "babel-loader": "^8.0.6", "clean-webpack-plugin": "^3.0.0", - "core-js": "3", + "core-js": "^3.6.0", "css-loader": "^4.3.0", "eslint": "^7.10.0", "eslint-plugin-flowtype": "^5.2.0", @@ -47,11 +44,12 @@ "flow-typed": "^3.2.1", "html-webpack-plugin": "^4.5.0", "husky": "^4.3.0", + "lodash-es": "^4.17.15", "style-loader": "^1.3.0", - "webpack": "^4.39.1", - "webpack-cli": "^3.3.6", + "webpack": "^4.44.0", + "webpack-cli": "^3.3.0", "webpack-dev-server": "^3.7.2", - "webpack-shell-plugin": "^0.5.0" + "webpack-shell-plugin-next": "^1.2.0" }, "license": "MIT" } diff --git a/src/components/TopBar.js b/src/components/TopBar.js index 50abfa1..cd935c6 100644 --- a/src/components/TopBar.js +++ b/src/components/TopBar.js @@ -10,7 +10,7 @@ import { makeStyles } from "@material-ui/core/styles"; import Tooltip from "@material-ui/core/Tooltip"; import IconButton from "@material-ui/core/IconButton"; import ReactIcon from "@mdi/react"; -import { mdiMap } from "@mdi/js"; +import { mdiMap, mdiGithub } from "@mdi/js"; export type TopBarProps = { connected: boolean, @@ -91,22 +91,15 @@ const Search = (props: SearchBarProps) => { const openOnGithub = () => window.open( "https://github.com/uwap/mqtt-control-map", "_blank"); -const sendFeedback = () => window.open("mailto:mail+feedback@uwap.name"); - const TopBar = (props: TopBarProps) => ( {renderConnectionIndicator(props.connected)} - - - - - - - - + + + diff --git a/src/index.jsx b/src/index.jsx index 94341da..60400b8 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -1,4 +1,8 @@ // @flow +import "core-js/stable"; +import "regenerator-runtime/runtime"; +import "../node_modules/leaflet/dist/leaflet.css" + import React from "react"; import ReactDOM from "react-dom"; diff --git a/webpack.config.js b/webpack.config.js index 31501b3..89d6f9a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,6 @@ const path = require('path'); const webpack = require('webpack'); -const WebpackShellPlugin = require('webpack-shell-plugin'); +const WebpackShellPlugin = require('webpack-shell-plugin-next'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const preBuildScripts = process.env.NO_FLOW == undefined ? @@ -16,14 +16,15 @@ const configPath = env => { module.exports = env => ({ entry: { - main: ["core-js/stable", "regenerator-runtime/runtime", configPath(env), + main: [configPath(env), path.resolve(__dirname, 'src/index.jsx')] }, resolve: { modules: [path.resolve(__dirname, "src"), "node_modules"], extensions: ['.js', '.jsx'], alias: { - 'lodash': 'lodash-es' + 'lodash': 'lodash-es', + "leaflet": "leaflet/dist/leaflet-src.esm.js" } }, output: { @@ -34,8 +35,8 @@ module.exports = env => ({ rules: [ // TODO: CSS follow imports and minify + sourcemap on production { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] }, - { test: /\.(woff2?|eot|ttf|svg)$/, use: [ { loader: "file-loader", options: { esModule: false } } ] }, - { test: /\.js(x)?$/, loader: "babel-loader?cacheDirectory=true" } + { test: /\.(woff2?|eot|ttf|svg|png)$/, use: [ { loader: "file-loader", options: { esModule: false } } ] }, + { test: /\.js(x)?$/, use: ["babel-loader?cacheDirectory=true"] } ] }, plugins: [ @@ -44,6 +45,6 @@ module.exports = env => ({ new HtmlWebpackPlugin({ title: 'Space Map', template: 'index.ejs' - }), + }) ] }); diff --git a/yarn.lock b/yarn.lock index 73a8400..ba267e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -993,17 +993,6 @@ react-is "^16.8.0" react-transition-group "^4.4.0" -"@material-ui/lab@^4.0.0-alpha.56": - version "4.0.0-alpha.56" - resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.56.tgz#ff63080949b55b40625e056bbda05e130d216d34" - integrity sha512-xPlkK+z/6y/24ka4gVJgwPfoCF4RCh8dXb1BNE7MtF9bXEBLN/lBxNTK8VAa0qm3V2oinA6xtUIdcRh0aeRtVw== - dependencies: - "@babel/runtime" "^7.4.4" - "@material-ui/utils" "^4.10.2" - clsx "^1.0.4" - prop-types "^15.7.2" - react-is "^16.8.0" - "@material-ui/styles@^4.10.0": version "4.10.0" resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.10.0.tgz#2406dc23aa358217aa8cc772e6237bd7f0544071" @@ -1475,9 +1464,9 @@ acorn-jsx@^5.2.0: integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== acorn@^6.4.1: - version "6.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" - integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== + version "6.4.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" + integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== acorn@^7.4.0: version "7.4.0" @@ -2436,7 +2425,7 @@ core-js-compat@^3.6.2: browserslist "^4.8.5" semver "7.0.0" -core-js@3: +core-js@^3.6.0: version "3.6.5" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a" integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA== @@ -5978,14 +5967,6 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" -redux@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f" - integrity sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w== - dependencies: - loose-envify "^1.4.0" - symbol-observable "^1.2.0" - regenerate-unicode-properties@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec" @@ -6757,11 +6738,6 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -symbol-observable@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" - integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== - table@^5.2.3, table@^5.4.6: version "5.4.6" resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" @@ -7207,7 +7183,7 @@ wbuf@^1.1.0, wbuf@^1.7.3: dependencies: minimalistic-assert "^1.0.0" -webpack-cli@^3.3.6: +webpack-cli@^3.3.0: version "3.3.12" resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.12.tgz#94e9ada081453cd0aa609c99e500012fd3ad2d4a" integrity sha512-NVWBaz9k839ZH/sinurM+HcDvJOTXwSjYp1ku+5XKeOC03z8v5QitnK/x+lAxGXFyhdayoIf/GOpv85z3/xPag== @@ -7282,10 +7258,10 @@ webpack-log@^2.0.0: ansi-colors "^3.0.0" uuid "^3.3.2" -webpack-shell-plugin@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/webpack-shell-plugin/-/webpack-shell-plugin-0.5.0.tgz#29b8a1d80ddeae0ddb10e729667f728653c2c742" - integrity sha1-Kbih2A3erg3bEOcpZn9yhlPCx0I= +webpack-shell-plugin-next@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/webpack-shell-plugin-next/-/webpack-shell-plugin-next-1.2.0.tgz#6a62931110c08ab36d2f0c225648a63331b7bbc2" + integrity sha512-jBLDs436jbKWnLZCqeN4hr7abXx0Tnz6Iwx7ejxh1h4JSmsnc82kGOBC63U6RKl0F6bvaXFsUOiIKV+DFKNxNw== webpack-sources@^1.4.0, webpack-sources@^1.4.1: version "1.4.3" @@ -7295,7 +7271,7 @@ webpack-sources@^1.4.0, webpack-sources@^1.4.1: source-list-map "^2.0.0" source-map "~0.6.1" -webpack@^4.39.1: +webpack@^4.44.0: version "4.44.2" resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.44.2.tgz#6bfe2b0af055c8b2d1e90ed2cd9363f841266b72" integrity sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q==