Updated dependencies
This commit is contained in:
parent
d78a10f72e
commit
a5979b2774
@ -28,7 +28,7 @@ interface DeviceViewProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DeviceView extends React.Component<DeviceViewProps> {
|
class DeviceView extends React.Component<DeviceViewProps> {
|
||||||
device: SprinklersDevice;
|
device!: SprinklersDevice;
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
this.updateDevice();
|
this.updateDevice();
|
||||||
|
@ -5,7 +5,7 @@ import * as React from "react";
|
|||||||
import { Button, Table } from "semantic-ui-react";
|
import { Button, Table } from "semantic-ui-react";
|
||||||
|
|
||||||
import { Duration } from "@common/Duration";
|
import { Duration } from "@common/Duration";
|
||||||
import { Program, Schedule, TimeOfDay, Weekday, DateOfYear, Section } from "@common/sprinklers";
|
import { DateOfYear, Program, Schedule, Section, TimeOfDay, Weekday } from "@common/sprinklers";
|
||||||
|
|
||||||
function timeToString(time: TimeOfDay) {
|
function timeToString(time: TimeOfDay) {
|
||||||
return moment(time).format("LTS");
|
return moment(time).format("LTS");
|
||||||
|
@ -15,8 +15,8 @@ export default class RunSectionForm extends React.Component<{
|
|||||||
duration: Duration,
|
duration: Duration,
|
||||||
section: number | "",
|
section: number | "",
|
||||||
}> {
|
}> {
|
||||||
constructor() {
|
constructor(props: any, context?: any) {
|
||||||
super();
|
super(props, context);
|
||||||
this.state = {
|
this.state = {
|
||||||
duration: new Duration(0, 0),
|
duration: new Duration(0, 0),
|
||||||
section: "",
|
section: "",
|
||||||
|
@ -20,7 +20,7 @@ export default class SectionTable extends React.Component<{ sections: Section[]
|
|||||||
"section--state-false": !state,
|
"section--state-false": !state,
|
||||||
});
|
});
|
||||||
const sectionState = state ?
|
const sectionState = state ?
|
||||||
(<span><Icon name="shower" /> Irrigating</span>)
|
(<span><Icon name={"shower" as any} /> Irrigating</span>)
|
||||||
: "Not irrigating";
|
: "Not irrigating";
|
||||||
return (
|
return (
|
||||||
<Table.Row key={index}>
|
<Table.Row key={index}>
|
||||||
|
@ -33,7 +33,7 @@ type Omit<T, K extends keyof T> = {[P in Diff<keyof T, K>]: T[P]};
|
|||||||
export function injectState<P extends { "state": StateBase }>(Component: React.ComponentType<P>) {
|
export function injectState<P extends { "state": StateBase }>(Component: React.ComponentType<P>) {
|
||||||
return class extends React.Component<Omit<P, "state">> {
|
return class extends React.Component<Omit<P, "state">> {
|
||||||
static contextTypes = providedStateContextTypes;
|
static contextTypes = providedStateContextTypes;
|
||||||
context: IProvidedStateContext;
|
context!: IProvidedStateContext;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const state = this.context.providedState;
|
const state = this.context.providedState;
|
||||||
|
@ -28,7 +28,7 @@ export class WebSprinklersDevice extends s.SprinklersDevice {
|
|||||||
|
|
||||||
export class WebApiClient implements s.ISprinklersApi {
|
export class WebApiClient implements s.ISprinklersApi {
|
||||||
readonly webSocketUrl: string;
|
readonly webSocketUrl: string;
|
||||||
socket: WebSocket;
|
socket!: WebSocket;
|
||||||
device: WebSprinklersDevice;
|
device: WebSprinklersDevice;
|
||||||
|
|
||||||
nextDeviceRequestId = Math.round(Math.random() * 1000000);
|
nextDeviceRequestId = Math.round(Math.random() * 1000000);
|
||||||
|
@ -2,11 +2,8 @@ const path = require("path");
|
|||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
|
|
||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
||||||
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
|
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
|
||||||
const WatchMissingNodeModulesPlugin = require("react-dev-utils/WatchMissingNodeModulesPlugin");
|
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
|
||||||
// const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
|
|
||||||
const MinifyPlugin = require("babel-minify-webpack-plugin");
|
|
||||||
const cssnext = require("postcss-cssnext");
|
const cssnext = require("postcss-cssnext");
|
||||||
|
|
||||||
const { getClientEnvironment } = require("../env");
|
const { getClientEnvironment } = require("../env");
|
||||||
@ -62,82 +59,32 @@ const rules = (env) => {
|
|||||||
// "style" loader turns CSS into JS modules that inject <style> tags.
|
// "style" loader turns CSS into JS modules that inject <style> tags.
|
||||||
// In production, we use a plugin to extract that CSS to a file, but
|
// In production, we use a plugin to extract that CSS to a file, but
|
||||||
// in development "style" loader enables hot editing of CSS.
|
// in development "style" loader enables hot editing of CSS.
|
||||||
const cssRule = (env === "dev") ?
|
const cssRule = {
|
||||||
{
|
test: /\.css$/,
|
||||||
test: /\.css$/,
|
use: [
|
||||||
use: [
|
require.resolve("style-loader"),
|
||||||
require.resolve("style-loader"),
|
{
|
||||||
{
|
loader: require.resolve("css-loader"),
|
||||||
loader: require.resolve("css-loader"),
|
options: {
|
||||||
options: {
|
importLoaders: 1,
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
postCssConfig,
|
},
|
||||||
],
|
postCssConfig,
|
||||||
} :
|
]
|
||||||
{
|
};
|
||||||
test: /\.css$/,
|
const sassRule = {
|
||||||
loader: ExtractTextPlugin.extract({
|
test: /\.scss$/,
|
||||||
fallback: require.resolve('style-loader'),
|
use: [
|
||||||
use: [
|
require.resolve("style-loader"),
|
||||||
{
|
{
|
||||||
loader: require.resolve('css-loader'),
|
loader: require.resolve("css-loader"),
|
||||||
options: {
|
options: {
|
||||||
importLoaders: 1,
|
importLoaders: 1,
|
||||||
minimize: true,
|
|
||||||
sourceMap: shouldUseSourceMap,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
postCssConfig
|
|
||||||
],
|
|
||||||
// ExtractTextPlugin expects the build output to be flat.
|
|
||||||
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
|
|
||||||
// However, our output is structured with css, js and media folders.
|
|
||||||
// To have this structure working with relative paths, we have to use custom options.
|
|
||||||
publicPath: shouldUseRelativeAssetPaths ?
|
|
||||||
Array(cssFilename.split("/").length).join("../") :
|
|
||||||
publicPath,
|
|
||||||
})
|
|
||||||
};
|
|
||||||
const sassRule = (env === "dev") ?
|
|
||||||
{
|
|
||||||
test: /\.scss$/,
|
|
||||||
use: [
|
|
||||||
require.resolve("style-loader"),
|
|
||||||
{
|
|
||||||
loader: require.resolve("css-loader"),
|
|
||||||
options: {
|
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
sassConfig,
|
},
|
||||||
],
|
sassConfig,
|
||||||
} :
|
],
|
||||||
{
|
};
|
||||||
test: /\.css$/,
|
|
||||||
loader: ExtractTextPlugin.extract({
|
|
||||||
fallback: require.resolve('style-loader'),
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: require.resolve('css-loader'),
|
|
||||||
options: {
|
|
||||||
importLoaders: 1,
|
|
||||||
minimize: true,
|
|
||||||
sourceMap: shouldUseSourceMap,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sassConfig
|
|
||||||
],
|
|
||||||
// ExtractTextPlugin expects the build output to be flat.
|
|
||||||
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
|
|
||||||
// However, our output is structured with css, js and media folders.
|
|
||||||
// To have this structure working with relative paths, we have to use custom options.
|
|
||||||
publicPath: shouldUseRelativeAssetPaths ?
|
|
||||||
Array(cssFilename.split("/").length).join("../") :
|
|
||||||
publicPath,
|
|
||||||
})
|
|
||||||
};
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
test: /\.tsx?$/,
|
test: /\.tsx?$/,
|
||||||
@ -224,23 +171,15 @@ const getConfig = module.exports = (env) => {
|
|||||||
// Otherwise React will be compiled in the very slow development mode.
|
// Otherwise React will be compiled in the very slow development mode.
|
||||||
new webpack.DefinePlugin(environ.stringified),
|
new webpack.DefinePlugin(environ.stringified),
|
||||||
new CaseSensitivePathsPlugin(),
|
new CaseSensitivePathsPlugin(),
|
||||||
// Note: this won"t work without ExtractTextPlugin.extract(..) in `loaders`.
|
|
||||||
isProd && new ExtractTextPlugin({
|
|
||||||
filename: cssFilename,
|
|
||||||
}),
|
|
||||||
// TODO: doesn't work with typescript target: es6
|
// TODO: doesn't work with typescript target: es6
|
||||||
// isProd && new UglifyJsPlugin({
|
isProd && new UglifyJsPlugin({
|
||||||
// sourceMap: shouldUseSourceMap,
|
|
||||||
// }),
|
|
||||||
isProd && new MinifyPlugin({}, {
|
|
||||||
sourceMap: shouldUseSourceMap,
|
sourceMap: shouldUseSourceMap,
|
||||||
}),
|
}),
|
||||||
isDev && new webpack.NamedModulesPlugin(),
|
|
||||||
isDev && new webpack.HotModuleReplacementPlugin(),
|
isDev && new webpack.HotModuleReplacementPlugin(),
|
||||||
isDev && new WatchMissingNodeModulesPlugin(paths.nodeModulesDir),
|
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
mode: isProd ? "production" : "development",
|
||||||
bail: isProd,
|
bail: isProd,
|
||||||
devtool: shouldUseSourceMap ?
|
devtool: shouldUseSourceMap ?
|
||||||
isProd ? "source-map" : "eval-source-map" :
|
isProd ? "source-map" : "eval-source-map" :
|
||||||
@ -276,6 +215,9 @@ const getConfig = module.exports = (env) => {
|
|||||||
rules: rules(env),
|
rules: rules(env),
|
||||||
},
|
},
|
||||||
plugins: plugins,
|
plugins: plugins,
|
||||||
|
optimization: {
|
||||||
|
namedModules: isProd,
|
||||||
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
hot: true,
|
hot: true,
|
||||||
port: 8081,
|
port: 8081,
|
||||||
|
@ -15,8 +15,8 @@ interface WithRid {
|
|||||||
|
|
||||||
export class MqttApiClient implements s.ISprinklersApi {
|
export class MqttApiClient implements s.ISprinklersApi {
|
||||||
readonly mqttUri: string;
|
readonly mqttUri: string;
|
||||||
client: mqtt.Client;
|
client!: mqtt.Client;
|
||||||
connected: boolean;
|
connected: boolean = false;
|
||||||
devices: Map<string, MqttSprinklersDevice> = new Map();
|
devices: Map<string, MqttSprinklersDevice> = new Map();
|
||||||
|
|
||||||
constructor(mqttUri: string) {
|
constructor(mqttUri: string) {
|
||||||
@ -126,7 +126,7 @@ class MqttSprinklersDevice extends s.SprinklersDevice {
|
|||||||
readonly apiClient: MqttApiClient;
|
readonly apiClient: MqttApiClient;
|
||||||
readonly prefix: string;
|
readonly prefix: string;
|
||||||
|
|
||||||
handlers: IHandlerEntry[];
|
handlers: IHandlerEntry[] = [];
|
||||||
private nextRequestId: number = Math.floor(Math.random() * 1000000000);
|
private nextRequestId: number = Math.floor(Math.random() * 1000000000);
|
||||||
private responseCallbacks: Map<number, ResponseCallback> = new Map();
|
private responseCallbacks: Map<number, ResponseCallback> = new Map();
|
||||||
|
|
||||||
|
126
package.json
126
package.json
@ -35,81 +35,79 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/amikhalev/sprinklers3#readme",
|
"homepage": "https://github.com/amikhalev/sprinklers3#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.15.4",
|
"chalk": "^2.3.2",
|
||||||
"express-pino-logger": "^2.0.0",
|
"express": "^4.16.3",
|
||||||
"mobx": "^3.1.11",
|
"express-pino-logger": "^3.0.1",
|
||||||
"module-alias": "^2.0.1",
|
"mobx": "^4.1.1",
|
||||||
"moment": "^2.19.1",
|
"module-alias": "^2.0.6",
|
||||||
"mqtt": "^2.13.0",
|
"moment": "^2.22.0",
|
||||||
"pino": "^4.7.2",
|
"mqtt": "^2.17.0",
|
||||||
"postcss-cssnext": "^3.0.2",
|
"pino": "^4.16.1",
|
||||||
"serializr": "^1.1.13"
|
"postcss-cssnext": "^3.1.0",
|
||||||
|
"serializr": "^1.1.14",
|
||||||
|
"uglify-es": "3.3.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/async": "^2.0.43",
|
"@types/async": "^2.0.49",
|
||||||
"@types/chalk": "^0.4.31",
|
|
||||||
"@types/classnames": "^2.2.0",
|
"@types/classnames": "^2.2.0",
|
||||||
"@types/core-js": "^0.9.43",
|
"@types/core-js": "^0.9.46",
|
||||||
"@types/express": "^4.0.37",
|
"@types/express": "^4.11.1",
|
||||||
"@types/lodash": "^4.14.77",
|
"@types/lodash": "^4.14.106",
|
||||||
"@types/mqtt": "^0.0.34",
|
"@types/node": "^9.6.4",
|
||||||
"@types/node": "^8.0.6",
|
|
||||||
"@types/object-assign": "^4.0.30",
|
"@types/object-assign": "^4.0.30",
|
||||||
"@types/pino": "^4.7.0",
|
"@types/pino": "^4.7.1",
|
||||||
"@types/prop-types": "^15.5.1",
|
"@types/prop-types": "^15.5.1",
|
||||||
"@types/react": "^16.0.10",
|
"@types/react": "16.3.9",
|
||||||
"@types/react-dom": "^16.0.1",
|
"@types/react-dom": "16.0.5",
|
||||||
"@types/react-hot-loader": "^3.0.4",
|
"@types/react-hot-loader": "^3.0.6",
|
||||||
"@types/webpack-env": "^1.13.0",
|
"@types/webpack-env": "^1.13.6",
|
||||||
"@types/ws": "^3.2.0",
|
"@types/ws": "^4.0.2",
|
||||||
"async": "^2.5.0",
|
"async": "^2.6.0",
|
||||||
"autoprefixer": "^7.1.4",
|
"autoprefixer": "^8.2.0",
|
||||||
"awesome-typescript-loader": "^3.1.3",
|
"awesome-typescript-loader": "^5.0.0",
|
||||||
"babel-minify-webpack-plugin": "^0.2.0",
|
"case-sensitive-paths-webpack-plugin": "^2.1.2",
|
||||||
"case-sensitive-paths-webpack-plugin": "^2.1.1",
|
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
"css-loader": "^0.28.4",
|
"css-loader": "^0.28.11",
|
||||||
"dotenv": "^4.0.0",
|
"dotenv": "^5.0.1",
|
||||||
"extract-text-webpack-plugin": "^3.0.0",
|
"file-loader": "^1.1.11",
|
||||||
"file-loader": "^1.1.5",
|
|
||||||
"font-awesome": "^4.7.0",
|
"font-awesome": "^4.7.0",
|
||||||
"html-webpack-plugin": "^2.28.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.5",
|
||||||
"mobx-react": "^4.2.1",
|
"mobx-react": "^5.0.0",
|
||||||
"mobx-react-devtools": "^4.2.13",
|
"mobx-react-devtools": "^5.0.1",
|
||||||
"node-sass": "^4.5.3",
|
"node-sass": "^4.8.3",
|
||||||
"nodemon": "^1.12.1",
|
"nodemon": "^1.17.3",
|
||||||
"npm-run-all": "^4.1.1",
|
"npm-run-all": "^4.1.2",
|
||||||
"object-assign": "^4.1.1",
|
"object-assign": "^4.1.1",
|
||||||
"postcss-flexbugs-fixes": "^3.2.0",
|
"postcss-flexbugs-fixes": "^3.3.0",
|
||||||
"postcss-loader": "^2.0.6",
|
"postcss-loader": "^2.1.3",
|
||||||
"promise": "^8.0.1",
|
"promise": "^8.0.1",
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.6.1",
|
||||||
"react": "^16.0.0",
|
"react": "16.3.1",
|
||||||
"react-dev-utils": "^4.1.0",
|
"react-dev-utils": "^5.0.1",
|
||||||
"react-dom": "^16.0.0",
|
"react-dom": "16.3.1",
|
||||||
"react-hot-loader": "^3.0.0-beta.6",
|
"react-hot-loader": "^4.0.1",
|
||||||
"sass-loader": "^6.0.6",
|
"sass-loader": "^6.0.7",
|
||||||
"semantic-ui-css": "^2.2.10",
|
"semantic-ui-css": "^2.3.1",
|
||||||
"semantic-ui-react": "^0.74.2",
|
"semantic-ui-react": "^0.79.1",
|
||||||
"source-map-loader": "^0.2.1",
|
"source-map-loader": "^0.2.3",
|
||||||
"style-loader": "^0.19.0",
|
"style-loader": "^0.20.3",
|
||||||
"ts-loader": "^2.1.0",
|
"ts-loader": "^4.2.0",
|
||||||
"tslint": "^5.4.2",
|
"tslint": "^5.9.1",
|
||||||
"tslint-loader": "^3.5.3",
|
"tslint-loader": "^3.6.0",
|
||||||
"tslint-react": "^3.2.0",
|
"tslint-react": "^3.5.1",
|
||||||
"typescript": "^2.3.4",
|
"typescript": "^2.3.4",
|
||||||
"uglifyjs-webpack-plugin": "^0.4.6",
|
"uglifyjs-webpack-plugin": "^1.2.4",
|
||||||
"url-loader": "^0.6.2",
|
"url-loader": "^1.0.1",
|
||||||
"webpack": "^3.0.0",
|
"webpack": "^4.5.0",
|
||||||
"webpack-dev-server": "^2.4.4",
|
"webpack-cli": "^2.0.14",
|
||||||
"ws": "^3.2.0"
|
"webpack-dev-server": "^3.1.3",
|
||||||
|
"ws": "^5.1.1"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"**/@types/react": "16.0.10",
|
"**/@types/react": "16.3.9",
|
||||||
"**/@types/react-dom": "16.0.1",
|
"**/@types/react-dom": "16.0.5",
|
||||||
"**/react": "16.0.0",
|
"**/react": "16.3.1",
|
||||||
"**/react-dom": "16.0.0",
|
"**/react-dom": "16.3.1"
|
||||||
"**/uglify-es": "3.1.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ mqttClient.start();
|
|||||||
import * as schema from "@common/sprinklers/schema";
|
import * as schema from "@common/sprinklers/schema";
|
||||||
import * as requests from "@common/sprinklers/requests";
|
import * as requests from "@common/sprinklers/requests";
|
||||||
import * as ws from "@common/sprinklers/websocketData";
|
import * as ws from "@common/sprinklers/websocketData";
|
||||||
import { autorunAsync } from "mobx";
|
import { autorun } from "mobx";
|
||||||
import { serialize } from "serializr";
|
import { serialize } from "serializr";
|
||||||
const device = mqttClient.getDevice("grinklers");
|
const device = mqttClient.getDevice("grinklers");
|
||||||
|
|
||||||
@ -52,12 +52,12 @@ async function deviceCallRequest(socket: WebSocket, data: ws.IDeviceCallRequest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function webSocketHandler(socket: WebSocket) {
|
function webSocketHandler(socket: WebSocket) {
|
||||||
const stop = autorunAsync(() => {
|
const stop = autorun(() => {
|
||||||
const json = serialize(schema.sprinklersDevice, device);
|
const json = serialize(schema.sprinklersDevice, device);
|
||||||
log.trace({ device: json });
|
log.trace({ device: json });
|
||||||
const data = { type: "deviceUpdate", name: "grinklers", data: json };
|
const data = { type: "deviceUpdate", name: "grinklers", data: json };
|
||||||
socket.send(JSON.stringify(data));
|
socket.send(JSON.stringify(data));
|
||||||
}, 100);
|
}, { delay: 100 });
|
||||||
socket.on("message", (socketData: WebSocket.Data) => {
|
socket.on("message", (socketData: WebSocket.Data) => {
|
||||||
if (typeof socketData !== "string") {
|
if (typeof socketData !== "string") {
|
||||||
return log.error({ type: typeof socketData }, "received invalid socket data type from client");
|
return log.error({ type: typeof socketData }, "received invalid socket data type from client");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import pretty = require("pino/pretty");
|
import pretty = require("pino/pretty");
|
||||||
|
|
||||||
type Level = "default" | 60 | 50 | 40 | 30 | 20 | 10;
|
type Level = "default" | 60 | 50 | 40 | 30 | 20 | 10;
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
"no-unused-variable": [
|
"no-unused-variable": [
|
||||||
true
|
true
|
||||||
],
|
],
|
||||||
"jsx-boolean-value": [ true, "never" ]
|
"jsx-boolean-value": [ true, "never" ],
|
||||||
|
"no-implicit-dependencies": false
|
||||||
},
|
},
|
||||||
"rulesDirectory": []
|
"rulesDirectory": []
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user