Browse Source

Fixed and refactored a bunch of stuff

update-deps
Alex Mikhalev 7 years ago
parent
commit
919d7a5082
  1. 4
      app/components/App.tsx
  2. 7
      app/index.tsx
  3. 11
      app/webpack.config.js
  4. 4
      common/logger.ts
  5. 2
      common/sprinklers/mqtt/index.ts
  6. 66
      package.json
  7. 1267
      yarn.lock

4
app/components/App.tsx

@ -1,10 +1,10 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import DevTools from "mobx-react-devtools"; // import DevTools from "mobx-react-devtools";
import * as React from "react"; import * as React from "react";
import { Container } from "semantic-ui-react"; import { Container } from "semantic-ui-react";
import { DevicesView, MessagesView } from "@app/components"; import { DevicesView, MessagesView } from "@app/components";
import MessageTest from "@app/components/MessageTest"; // import MessageTest from "@app/components/MessageTest";
import "@app/styles/app.css"; import "@app/styles/app.css";
import "font-awesome/css/font-awesome.css"; import "font-awesome/css/font-awesome.css";

7
app/index.tsx

@ -3,12 +3,11 @@ import * as ReactDOM from "react-dom";
import { AppContainer } from "react-hot-loader"; import { AppContainer } from "react-hot-loader";
import App from "@app/components/App"; import App from "@app/components/App";
import { MqttApiState, ProvideState, WebApiState } from "@app/state"; import { ProvideState, WebApiState } from "@app/state";
import log from "@common/logger"; // import log from "@common/logger";
Object.assign(log, { name: "sprinklers3/app", level: "debug" }); // Object.assign(log, { name: "sprinklers3/app", level: "debug" });
// const state = new MqttApiState();
const state = new WebApiState(); const state = new WebApiState();
state.start(); state.start();

11
app/webpack.config.js

@ -6,7 +6,8 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-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 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 { getClientEnvironment } = require("../env"); const { getClientEnvironment } = require("../env");
const paths = require("../paths"); const paths = require("../paths");
@ -99,7 +100,7 @@ const rules = (env) => {
test: /\.tsx?$/, test: /\.tsx?$/,
enforce: "pre", enforce: "pre",
loader: require.resolve("tslint-loader"), loader: require.resolve("tslint-loader"),
options: { typecheck: true, tsConfigFile: paths.appTsConfig }, options: { typeCheck: true, tsConfigFile: paths.appTsConfig },
}, },
{ {
// "oneOf" will traverse all following loaders until one will // "oneOf" will traverse all following loaders until one will
@ -183,7 +184,11 @@ const getConfig = module.exports = (env) => {
isProd && new ExtractTextPlugin({ isProd && new ExtractTextPlugin({
filename: cssFilename, filename: cssFilename,
}), }),
isProd && new UglifyJsPlugin({ // TODO: doesn't work with typescript target: es6
// isProd && new UglifyJsPlugin({
// sourceMap: shouldUseSourceMap,
// }),
isProd && new MinifyPlugin({}, {
sourceMap: shouldUseSourceMap, sourceMap: shouldUseSourceMap,
}), }),
isDev && new webpack.NamedModulesPlugin(), isDev && new webpack.NamedModulesPlugin(),

4
common/logger.ts

@ -81,10 +81,6 @@ function filter(value: any) {
return result; return result;
} }
function asISODate(time: string) {
return new Date(time).toISOString();
}
function formatSource(value: any): { str: string, args: any[] } { function formatSource(value: any): { str: string, args: any[] } {
if (value.source) { if (value.source) {
return { str: "%c(" + value.source + ") ", args: ["color: #FF00FF"] }; return { str: "%c(" + value.source + ") ", args: ["color: #FF00FF"] };

2
common/sprinklers/mqtt/index.ts

@ -209,6 +209,7 @@ class MqttSprinklersDevice extends s.SprinklersDevice {
}); });
} }
/* tslint:disable:no-unused-variable */
@handler(/^connected$/) @handler(/^connected$/)
private handleConnected(payload: string) { private handleConnected(payload: string) {
this.connected = (payload === "true"); this.connected = (payload === "true");
@ -261,6 +262,7 @@ class MqttSprinklersDevice extends s.SprinklersDevice {
cb(data); cb(data);
} }
} }
/* tslint:enable:no-unused-variable */
} }
interface IResponseData { interface IResponseData {

66
package.json

@ -31,6 +31,15 @@
}, },
"homepage": "https://github.com/amikhalev/sprinklers3#readme", "homepage": "https://github.com/amikhalev/sprinklers3#readme",
"dependencies": { "dependencies": {
"express": "^4.15.4",
"express-pino-logger": "^2.0.0",
"mobx": "^3.1.11",
"module-alias": "^2.0.1",
"mqtt": "^2.13.0",
"pino": "^4.7.2",
"serializr": "^1.1.13"
},
"devDependencies": {
"@types/async": "^2.0.43", "@types/async": "^2.0.43",
"@types/chalk": "^0.4.31", "@types/chalk": "^0.4.31",
"@types/classnames": "^2.2.0", "@types/classnames": "^2.2.0",
@ -42,60 +51,59 @@
"@types/object-assign": "^4.0.30", "@types/object-assign": "^4.0.30",
"@types/pino": "^4.7.0", "@types/pino": "^4.7.0",
"@types/prop-types": "^15.5.1", "@types/prop-types": "^15.5.1",
"@types/react": "^16", "@types/react": "^16.0.10",
"@types/react-dom": "^15.5.0", "@types/react-dom": "^16.0.1",
"@types/react-fontawesome": "^1.5.0", "@types/react-fontawesome": "^1.5.0",
"@types/react-hot-loader": "^3.0.4", "@types/react-hot-loader": "^3.0.4",
"@types/webpack-env": "^1.13.0",
"@types/ws": "^3.2.0", "@types/ws": "^3.2.0",
"async": "^2.5.0", "async": "^2.5.0",
"autoprefixer": "^7.1.4", "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", "case-sensitive-paths-webpack-plugin": "^2.1.1",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"css-loader": "^0.28.4",
"dotenv": "^4.0.0", "dotenv": "^4.0.0",
"express": "^4.15.4",
"express-pino-logger": "^2.0.0",
"extract-text-webpack-plugin": "^3.0.0", "extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.5",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"html-webpack-plugin": "^2.28.0",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"mobx": "^3.1.11",
"mobx-react": "^4.2.1", "mobx-react": "^4.2.1",
"module-alias": "^2.0.1", "mobx-react-devtools": "^4.2.13",
"mqtt": "^2.13.0", "nodemon": "^1.12.1",
"npm-run-all": "^4.1.1",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"pino": "^4.7.2",
"postcss-flexbugs-fixes": "^3.2.0", "postcss-flexbugs-fixes": "^3.2.0",
"postcss-loader": "^2.0.6", "postcss-loader": "^2.0.6",
"promise": "^8.0.1", "promise": "^8.0.1",
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
"react": ">=15.6.1 <16", "react": "^16.0.0",
"react-dev-utils": "^4.1.0", "react-dev-utils": "^4.1.0",
"react-dom": ">=15.6.1 <16", "react-dom": "^16.0.0",
"react-fontawesome": "^1.6.1", "react-fontawesome": "^1.6.1",
"semantic-ui-css": "^2.2.10",
"semantic-ui-react": "^0.73.0",
"serializr": "^1.1.13",
"tslint-loader": "^3.5.3",
"uglifyjs-webpack-plugin": "^0.4.6",
"url-loader": "^0.5.9",
"ws": "^3.2.0"
},
"devDependencies": {
"@types/webpack-env": "^1.13.0",
"awesome-typescript-loader": "^3.1.3",
"css-loader": "^0.28.4",
"file-loader": "^0.11.1",
"html-webpack-plugin": "^2.28.0",
"mobx-react-devtools": "^4.2.13",
"nodemon": "^1.12.1",
"npm-run-all": "^4.1.1",
"react-hot-loader": "^3.0.0-beta.6", "react-hot-loader": "^3.0.0-beta.6",
"semantic-ui-css": "^2.2.10",
"semantic-ui-react": "^0.74.2",
"source-map-loader": "^0.2.1", "source-map-loader": "^0.2.1",
"style-loader": "^0.18.1", "style-loader": "^0.19.0",
"ts-loader": "^2.1.0", "ts-loader": "^2.1.0",
"tslint": "^5.4.2", "tslint": "^5.4.2",
"tslint-loader": "^3.5.3",
"tslint-react": "^3.2.0", "tslint-react": "^3.2.0",
"typescript": "^2.3.4", "typescript": "^2.3.4",
"uglifyjs-webpack-plugin": "^0.4.6",
"url-loader": "^0.6.2",
"webpack": "^3.0.0", "webpack": "^3.0.0",
"webpack-dev-server": "^2.4.4" "webpack-dev-server": "^2.4.4",
"ws": "^3.2.0"
},
"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"
} }
} }

1267
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save