Various improvements

This commit is contained in:
uwap 2020-10-08 20:31:42 +02:00
parent e43842fbed
commit 2997ff8862
7 changed files with 35 additions and 62 deletions

View file

@ -2,7 +2,9 @@
"presets": [ "presets": [
["@babel/preset-env", { ["@babel/preset-env", {
modules: false, modules: false,
corejs: 3 corejs: "3.6",
useBuiltIns: "entry",
targets: "last 3 years"
}], }],
"@babel/preset-react", "@babel/preset-react",
"@babel/preset-flow" "@babel/preset-flow"

View file

@ -2,7 +2,6 @@
<html> <html>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css" integrity="sha512-M2wvCLH6DSRazYeZRIm1JnYyh22purTM+FDB5CsyxtQJYeKq83arPe5wgbNmcFXGqiSH2XR8dT/fJISVA1r/zQ==" crossorigin=""/>
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
</head> </head>
<body> <body>

View file

@ -4,7 +4,7 @@
"author": "uwap <me@uwap.name>", "author": "uwap <me@uwap.name>",
"description": "Control Devices via mqtt, visualized on a Map", "description": "Control Devices via mqtt, visualized on a Map",
"scripts": { "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", "dev": "webpack --bail --config webpack.config.js --mode development --env",
"watch": "webpack-dev-server --open --config webpack.config.js --mode development --env", "watch": "webpack-dev-server --open --config webpack.config.js --mode development --env",
"travis": "./travis.sh", "travis": "./travis.sh",
@ -13,15 +13,12 @@
}, },
"dependencies": { "dependencies": {
"@material-ui/core": "^4.11.0", "@material-ui/core": "^4.11.0",
"@material-ui/lab": "^4.0.0-alpha.56",
"@mdi/react": "^1.4.0", "@mdi/react": "^1.4.0",
"leaflet": "^1.5.1", "leaflet": "^1.5.1",
"lodash-es": "^4.17.15",
"mqtt": "^4.2.1", "mqtt": "^4.2.1",
"react": "^16.8.6", "react": "^16.8.6",
"react-dom": "^16.8.6", "react-dom": "^16.8.6",
"react-leaflet": "^2.4.0", "react-leaflet": "^2.4.0"
"redux": "^4.0.4"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.5.5", "@babel/cli": "^7.5.5",
@ -35,7 +32,7 @@
"babel-eslint": "^10.0.2", "babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6", "babel-loader": "^8.0.6",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"core-js": "3", "core-js": "^3.6.0",
"css-loader": "^4.3.0", "css-loader": "^4.3.0",
"eslint": "^7.10.0", "eslint": "^7.10.0",
"eslint-plugin-flowtype": "^5.2.0", "eslint-plugin-flowtype": "^5.2.0",
@ -47,11 +44,12 @@
"flow-typed": "^3.2.1", "flow-typed": "^3.2.1",
"html-webpack-plugin": "^4.5.0", "html-webpack-plugin": "^4.5.0",
"husky": "^4.3.0", "husky": "^4.3.0",
"lodash-es": "^4.17.15",
"style-loader": "^1.3.0", "style-loader": "^1.3.0",
"webpack": "^4.39.1", "webpack": "^4.44.0",
"webpack-cli": "^3.3.6", "webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.7.2", "webpack-dev-server": "^3.7.2",
"webpack-shell-plugin": "^0.5.0" "webpack-shell-plugin-next": "^1.2.0"
}, },
"license": "MIT" "license": "MIT"
} }

View file

@ -10,7 +10,7 @@ import { makeStyles } from "@material-ui/core/styles";
import Tooltip from "@material-ui/core/Tooltip"; import Tooltip from "@material-ui/core/Tooltip";
import IconButton from "@material-ui/core/IconButton"; import IconButton from "@material-ui/core/IconButton";
import ReactIcon from "@mdi/react"; import ReactIcon from "@mdi/react";
import { mdiMap } from "@mdi/js"; import { mdiMap, mdiGithub } from "@mdi/js";
export type TopBarProps = { export type TopBarProps = {
connected: boolean, connected: boolean,
@ -91,22 +91,15 @@ const Search = (props: SearchBarProps) => {
const openOnGithub = () => window.open( const openOnGithub = () => window.open(
"https://github.com/uwap/mqtt-control-map", "_blank"); "https://github.com/uwap/mqtt-control-map", "_blank");
const sendFeedback = () => window.open("mailto:mail+feedback@uwap.name");
const TopBar = (props: TopBarProps) => ( const TopBar = (props: TopBarProps) => (
<AppBar position="static"> <AppBar position="static">
<Toolbar> <Toolbar>
{renderConnectionIndicator(props.connected)} {renderConnectionIndicator(props.connected)}
<Search onSearch={props.onSearch} /> <Search onSearch={props.onSearch} />
<span style={{flex: 1}}></span> <span style={{flex: 1}}></span>
<Tooltip title="Github"> <Tooltip title="View on Github">
<IconButton onClick={openOnGithub} style={{ fontSize: "28px" }}> <IconButton onClick={openOnGithub}>
<i className="mdi mdi-github-circle"></i> <ReactIcon path={mdiGithub} size={1.5} />
</IconButton>
</Tooltip>
<Tooltip title="Send me feedback">
<IconButton onClick={sendFeedback} style={{ fontSize: "28px" }}>
<i className="mdi mdi-email-plus"></i>
</IconButton> </IconButton>
</Tooltip> </Tooltip>
</Toolbar> </Toolbar>

View file

@ -1,4 +1,8 @@
// @flow // @flow
import "core-js/stable";
import "regenerator-runtime/runtime";
import "../node_modules/leaflet/dist/leaflet.css"
import React from "react"; import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";

View file

@ -1,6 +1,6 @@
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin'); const WebpackShellPlugin = require('webpack-shell-plugin-next');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const preBuildScripts = process.env.NO_FLOW == undefined ? const preBuildScripts = process.env.NO_FLOW == undefined ?
@ -16,14 +16,15 @@ const configPath = env => {
module.exports = env => ({ module.exports = env => ({
entry: { entry: {
main: ["core-js/stable", "regenerator-runtime/runtime", configPath(env), main: [configPath(env),
path.resolve(__dirname, 'src/index.jsx')] path.resolve(__dirname, 'src/index.jsx')]
}, },
resolve: { resolve: {
modules: [path.resolve(__dirname, "src"), "node_modules"], modules: [path.resolve(__dirname, "src"), "node_modules"],
extensions: ['.js', '.jsx'], extensions: ['.js', '.jsx'],
alias: { alias: {
'lodash': 'lodash-es' 'lodash': 'lodash-es',
"leaflet": "leaflet/dist/leaflet-src.esm.js"
} }
}, },
output: { output: {
@ -34,8 +35,8 @@ module.exports = env => ({
rules: [ rules: [
// TODO: CSS follow imports and minify + sourcemap on production // TODO: CSS follow imports and minify + sourcemap on production
{ test: /\.css$/, use: [ 'style-loader', 'css-loader' ] }, { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] },
{ test: /\.(woff2?|eot|ttf|svg)$/, use: [ { loader: "file-loader", options: { esModule: false } } ] }, { test: /\.(woff2?|eot|ttf|svg|png)$/, use: [ { loader: "file-loader", options: { esModule: false } } ] },
{ test: /\.js(x)?$/, loader: "babel-loader?cacheDirectory=true" } { test: /\.js(x)?$/, use: ["babel-loader?cacheDirectory=true"] }
] ]
}, },
plugins: [ plugins: [
@ -44,6 +45,6 @@ module.exports = env => ({
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
title: 'Space Map', title: 'Space Map',
template: 'index.ejs' template: 'index.ejs'
}), })
] ]
}); });

View file

@ -993,17 +993,6 @@
react-is "^16.8.0" react-is "^16.8.0"
react-transition-group "^4.4.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": "@material-ui/styles@^4.10.0":
version "4.10.0" version "4.10.0"
resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.10.0.tgz#2406dc23aa358217aa8cc772e6237bd7f0544071" 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== integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==
acorn@^6.4.1: acorn@^6.4.1:
version "6.4.1" version "6.4.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6"
integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==
acorn@^7.4.0: acorn@^7.4.0:
version "7.4.0" version "7.4.0"
@ -2436,7 +2425,7 @@ core-js-compat@^3.6.2:
browserslist "^4.8.5" browserslist "^4.8.5"
semver "7.0.0" semver "7.0.0"
core-js@3: core-js@^3.6.0:
version "3.6.5" version "3.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA== integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==
@ -5978,14 +5967,6 @@ rechoir@^0.6.2:
dependencies: dependencies:
resolve "^1.1.6" 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: regenerate-unicode-properties@^8.2.0:
version "8.2.0" version "8.2.0"
resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec" 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: dependencies:
has-flag "^4.0.0" 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: table@^5.2.3, table@^5.4.6:
version "5.4.6" version "5.4.6"
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" 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: dependencies:
minimalistic-assert "^1.0.0" minimalistic-assert "^1.0.0"
webpack-cli@^3.3.6: webpack-cli@^3.3.0:
version "3.3.12" version "3.3.12"
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.12.tgz#94e9ada081453cd0aa609c99e500012fd3ad2d4a" resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.12.tgz#94e9ada081453cd0aa609c99e500012fd3ad2d4a"
integrity sha512-NVWBaz9k839ZH/sinurM+HcDvJOTXwSjYp1ku+5XKeOC03z8v5QitnK/x+lAxGXFyhdayoIf/GOpv85z3/xPag== integrity sha512-NVWBaz9k839ZH/sinurM+HcDvJOTXwSjYp1ku+5XKeOC03z8v5QitnK/x+lAxGXFyhdayoIf/GOpv85z3/xPag==
@ -7282,10 +7258,10 @@ webpack-log@^2.0.0:
ansi-colors "^3.0.0" ansi-colors "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"
webpack-shell-plugin@^0.5.0: webpack-shell-plugin-next@^1.2.0:
version "0.5.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/webpack-shell-plugin/-/webpack-shell-plugin-0.5.0.tgz#29b8a1d80ddeae0ddb10e729667f728653c2c742" resolved "https://registry.yarnpkg.com/webpack-shell-plugin-next/-/webpack-shell-plugin-next-1.2.0.tgz#6a62931110c08ab36d2f0c225648a63331b7bbc2"
integrity sha1-Kbih2A3erg3bEOcpZn9yhlPCx0I= integrity sha512-jBLDs436jbKWnLZCqeN4hr7abXx0Tnz6Iwx7ejxh1h4JSmsnc82kGOBC63U6RKl0F6bvaXFsUOiIKV+DFKNxNw==
webpack-sources@^1.4.0, webpack-sources@^1.4.1: webpack-sources@^1.4.0, webpack-sources@^1.4.1:
version "1.4.3" 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-list-map "^2.0.0"
source-map "~0.6.1" source-map "~0.6.1"
webpack@^4.39.1: webpack@^4.44.0:
version "4.44.2" version "4.44.2"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.44.2.tgz#6bfe2b0af055c8b2d1e90ed2cd9363f841266b72" resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.44.2.tgz#6bfe2b0af055c8b2d1e90ed2cd9363f841266b72"
integrity sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q== integrity sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q==