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