From dd39980c7495ffb5f60105b838218ef779833143 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Tue, 7 Aug 2018 21:21:26 +0300 Subject: [PATCH] Moved /app to /client --- {app => client}/components/App.tsx | 8 ++++---- {app => client}/components/DeviceView.tsx | 10 +++++----- {app => client}/components/DevicesView.tsx | 2 +- {app => client}/components/DurationView.tsx | 2 +- {app => client}/components/MessageTest.tsx | 2 +- {app => client}/components/MessagesView.tsx | 4 ++-- {app => client}/components/NavBar.tsx | 4 ++-- .../components/ProgramSequenceView.tsx | 4 ++-- {app => client}/components/ProgramTable.tsx | 4 ++-- {app => client}/components/RunSectionForm.tsx | 4 ++-- .../components/ScheduleView/ScheduleDate.tsx | 0 .../components/ScheduleView/ScheduleTimes.tsx | 0 .../components/ScheduleView/TimeInput.tsx | 0 .../components/ScheduleView/WeekdaysView.tsx | 0 .../components/ScheduleView/index.tsx | 2 +- {app => client}/components/SectionChooser.tsx | 2 +- .../components/SectionRunnerView.tsx | 2 +- {app => client}/components/SectionTable.tsx | 0 {app => client}/components/index.ts | 0 {app => client}/images/favicon-16x16.png | Bin {app => client}/images/favicon-32x32.png | Bin {app => client}/images/favicon-96x96.png | Bin {app => client}/images/favicon.ico | Bin {app => client}/images/raspberry_pi.png | Bin {app => client}/index.html | 0 {app => client}/index.tsx | 8 ++++---- {app => client}/pages/LoginPage.tsx | 4 ++-- {app => client}/pages/LogoutPage.tsx | 2 +- {app => client}/pages/ProgramPage.tsx | 6 +++--- {app => client}/pages/index.tsx | 2 +- {app => client}/polyfills.js | 0 {app => client}/routePaths.ts | 0 .../sprinklersRpc/WebSocketRpcClient.ts | 2 +- {app => client}/state/AppState.ts | 6 +++--- {app => client}/state/HttpApi.ts | 2 +- {app => client}/state/Token.ts | 0 {app => client}/state/TokenStore.ts | 4 ++-- {app => client}/state/UiStore.ts | 0 {app => client}/state/index.ts | 0 {app => client}/state/reactContext.tsx | 2 +- {app => client}/styles/DeviceView.scss | 0 {app => client}/styles/DurationView.scss | 0 {app => client}/styles/LoginPage.scss | 0 {app => client}/styles/MessagesView.scss | 0 {app => client}/styles/ProgramSequenceView.scss | 0 {app => client}/styles/ScheduleView.scss | 0 {app => client}/styles/SectionChooser.scss | 0 {app => client}/styles/SectionRunnerView.scss | 0 {app => client}/styles/app.scss | 0 {app => client}/tsconfig.json | 4 ++-- {app => client}/webpack.config.js | 16 ++++++++-------- common/paths.js | 12 ++++++------ common/tsconfig.json | 4 ++-- docker-compose.dev.yml | 2 +- package.json | 8 ++++---- server/express/serveApp.ts | 2 +- server/tsconfig.json | 4 ++-- 57 files changed, 70 insertions(+), 70 deletions(-) rename {app => client}/components/App.tsx (84%) rename {app => client}/components/DeviceView.tsx (93%) rename {app => client}/components/DevicesView.tsx (89%) rename {app => client}/components/DurationView.tsx (98%) rename {app => client}/components/MessageTest.tsx (95%) rename {app => client}/components/MessagesView.tsx (92%) rename {app => client}/components/NavBar.tsx (91%) rename {app => client}/components/ProgramSequenceView.tsx (98%) rename {app => client}/components/ProgramTable.tsx (97%) rename {app => client}/components/RunSectionForm.tsx (96%) rename {app => client}/components/ScheduleView/ScheduleDate.tsx (100%) rename {app => client}/components/ScheduleView/ScheduleTimes.tsx (100%) rename {app => client}/components/ScheduleView/TimeInput.tsx (100%) rename {app => client}/components/ScheduleView/WeekdaysView.tsx (100%) rename {app => client}/components/ScheduleView/index.tsx (98%) rename {app => client}/components/SectionChooser.tsx (97%) rename {app => client}/components/SectionRunnerView.tsx (99%) rename {app => client}/components/SectionTable.tsx (100%) rename {app => client}/components/index.ts (100%) rename {app => client}/images/favicon-16x16.png (100%) rename {app => client}/images/favicon-32x32.png (100%) rename {app => client}/images/favicon-96x96.png (100%) rename {app => client}/images/favicon.ico (100%) rename {app => client}/images/raspberry_pi.png (100%) rename {app => client}/index.html (100%) rename {app => client}/index.tsx (76%) rename {app => client}/pages/LoginPage.tsx (96%) rename {app => client}/pages/LogoutPage.tsx (85%) rename {app => client}/pages/ProgramPage.tsx (97%) rename {app => client}/pages/index.tsx (88%) rename {app => client}/polyfills.js (100%) rename {app => client}/routePaths.ts (100%) rename {app => client}/sprinklersRpc/WebSocketRpcClient.ts (99%) rename {app => client}/state/AppState.ts (90%) rename {app => client}/state/HttpApi.ts (96%) rename {app => client}/state/Token.ts (100%) rename {app => client}/state/TokenStore.ts (95%) rename {app => client}/state/UiStore.ts (100%) rename {app => client}/state/index.ts (100%) rename {app => client}/state/reactContext.tsx (97%) rename {app => client}/styles/DeviceView.scss (100%) rename {app => client}/styles/DurationView.scss (100%) rename {app => client}/styles/LoginPage.scss (100%) rename {app => client}/styles/MessagesView.scss (100%) rename {app => client}/styles/ProgramSequenceView.scss (100%) rename {app => client}/styles/ScheduleView.scss (100%) rename {app => client}/styles/SectionChooser.scss (100%) rename {app => client}/styles/SectionRunnerView.scss (100%) rename {app => client}/styles/app.scss (100%) rename {app => client}/tsconfig.json (90%) rename {app => client}/webpack.config.js (95%) diff --git a/app/components/App.tsx b/client/components/App.tsx similarity index 84% rename from app/components/App.tsx rename to client/components/App.tsx index 8217dea..7f9a4c3 100644 --- a/app/components/App.tsx +++ b/client/components/App.tsx @@ -3,14 +3,14 @@ import * as React from "react"; import { Redirect, Route, Switch } from "react-router"; import { Container } from "semantic-ui-react"; -import { MessagesView, NavBar } from "@app/components"; -import * as p from "@app/pages"; -import * as rp from "@app/routePaths"; +import { MessagesView, NavBar } from "@client/components"; +import * as p from "@client/pages"; +import * as rp from "@client/routePaths"; // tslint:disable:ordered-imports import "font-awesome/css/font-awesome.css"; import "semantic-ui-css/semantic.css"; -import "@app/styles/app"; +import "@client/styles/app"; function NavContainer() { return ( diff --git a/app/components/DeviceView.tsx b/client/components/DeviceView.tsx similarity index 93% rename from app/components/DeviceView.tsx rename to client/components/DeviceView.tsx index 2bcf19c..1550409 100644 --- a/app/components/DeviceView.tsx +++ b/client/components/DeviceView.tsx @@ -3,14 +3,14 @@ import { observer } from "mobx-react"; import * as React from "react"; import { Grid, Header, Icon, Item, SemanticICONS } from "semantic-ui-react"; -import * as p from "@app/pages"; -import * as rp from "@app/routePaths"; -import { AppState, injectState } from "@app/state"; +import * as p from "@client/pages"; +import * as rp from "@client/routePaths"; +import { AppState, injectState } from "@client/state"; import { ConnectionState as ConState } from "@common/sprinklersRpc"; import { Route, RouteComponentProps, withRouter } from "react-router"; import { ProgramTable, RunSectionForm, SectionRunnerView, SectionTable } from "."; -import "@app/styles/DeviceView"; +import "@client/styles/DeviceView"; const ConnectionState = observer(({ connectionState, className }: { connectionState: ConState, className?: string }) => { @@ -72,7 +72,7 @@ class DeviceView extends React.Component - +
Device {id}
diff --git a/app/components/DevicesView.tsx b/client/components/DevicesView.tsx similarity index 89% rename from app/components/DevicesView.tsx rename to client/components/DevicesView.tsx index 59baf51..01d277c 100644 --- a/app/components/DevicesView.tsx +++ b/client/components/DevicesView.tsx @@ -2,7 +2,7 @@ import { observer } from "mobx-react"; import * as React from "react"; import { Item } from "semantic-ui-react"; -import DeviceView from "@app/components/DeviceView"; +import DeviceView from "@client/components/DeviceView"; import { RouteComponentProps, withRouter } from "react-router"; class DevicesView extends React.Component<{deviceId: string} & RouteComponentProps> { diff --git a/app/components/DurationView.tsx b/client/components/DurationView.tsx similarity index 98% rename from app/components/DurationView.tsx rename to client/components/DurationView.tsx index 1f52bdc..16e1aaf 100644 --- a/app/components/DurationView.tsx +++ b/client/components/DurationView.tsx @@ -4,7 +4,7 @@ import { Form, Input, InputProps } from "semantic-ui-react"; import { Duration } from "@common/Duration"; -import "@app/styles/DurationView"; +import "@client/styles/DurationView"; export default class DurationView extends React.Component<{ label?: string, diff --git a/app/components/MessageTest.tsx b/client/components/MessageTest.tsx similarity index 95% rename from app/components/MessageTest.tsx rename to client/components/MessageTest.tsx index a800d4c..0884233 100644 --- a/app/components/MessageTest.tsx +++ b/client/components/MessageTest.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { Button, Segment } from "semantic-ui-react"; -import { AppState, injectState } from "@app/state"; +import { AppState, injectState } from "@client/state"; import { getRandomId } from "@common/utils"; class MessageTest extends React.Component<{ appState: AppState }> { diff --git a/app/components/MessagesView.tsx b/client/components/MessagesView.tsx similarity index 92% rename from app/components/MessagesView.tsx rename to client/components/MessagesView.tsx index 97f84f9..888d35e 100644 --- a/app/components/MessagesView.tsx +++ b/client/components/MessagesView.tsx @@ -3,9 +3,9 @@ import { observer } from "mobx-react"; import * as React from "react"; import { Message, MessageProps, TransitionGroup } from "semantic-ui-react"; -import { AppState, injectState, UiMessage, UiStore } from "@app/state/"; +import { AppState, injectState, UiMessage, UiStore } from "@client/state/"; -import "@app/styles/MessagesView"; +import "@client/styles/MessagesView"; @observer class MessageView extends React.Component<{ diff --git a/app/components/NavBar.tsx b/client/components/NavBar.tsx similarity index 91% rename from app/components/NavBar.tsx rename to client/components/NavBar.tsx index 3ea7a6c..e3ce604 100644 --- a/app/components/NavBar.tsx +++ b/client/components/NavBar.tsx @@ -3,8 +3,8 @@ import * as React from "react"; import { Link } from "react-router-dom"; import { Menu } from "semantic-ui-react"; -import * as rp from "@app/routePaths"; -import { AppState, ConsumeState, injectState } from "@app/state"; +import * as rp from "@client/routePaths"; +import { AppState, ConsumeState, injectState } from "@client/state"; interface NavItemProps { to: string; diff --git a/app/components/ProgramSequenceView.tsx b/client/components/ProgramSequenceView.tsx similarity index 98% rename from app/components/ProgramSequenceView.tsx rename to client/components/ProgramSequenceView.tsx index bd45dea..7b5ac7d 100644 --- a/app/components/ProgramSequenceView.tsx +++ b/client/components/ProgramSequenceView.tsx @@ -4,11 +4,11 @@ import * as React from "react"; import { SortableContainer, SortableElement, SortableHandle, SortEnd } from "react-sortable-hoc"; import { Button, Form, Icon, List } from "semantic-ui-react"; -import { DurationView, SectionChooser } from "@app/components/index"; +import { DurationView, SectionChooser } from "@client/components/index"; import { Duration } from "@common/Duration"; import { ProgramItem, Section } from "@common/sprinklersRpc"; -import "@app/styles/ProgramSequenceView"; +import "@client/styles/ProgramSequenceView"; type ItemChangeHandler = (index: number, newItem: ProgramItem) => void; type ItemRemoveHandler = (index: number) => void; diff --git a/app/components/ProgramTable.tsx b/client/components/ProgramTable.tsx similarity index 97% rename from app/components/ProgramTable.tsx rename to client/components/ProgramTable.tsx index cd1e312..a6aa60e 100644 --- a/app/components/ProgramTable.tsx +++ b/client/components/ProgramTable.tsx @@ -4,8 +4,8 @@ import * as React from "react"; import { Link } from "react-router-dom"; import { Button, ButtonProps, Form, Icon, Table } from "semantic-ui-react"; -import { ProgramSequenceView, ScheduleView } from "@app/components"; -import * as rp from "@app/routePaths"; +import { ProgramSequenceView, ScheduleView } from "@client/components"; +import * as rp from "@client/routePaths"; import { Program, SprinklersDevice } from "@common/sprinklersRpc"; @observer diff --git a/app/components/RunSectionForm.tsx b/client/components/RunSectionForm.tsx similarity index 96% rename from app/components/RunSectionForm.tsx rename to client/components/RunSectionForm.tsx index c97ac20..c14425c 100644 --- a/app/components/RunSectionForm.tsx +++ b/client/components/RunSectionForm.tsx @@ -2,8 +2,8 @@ import { observer } from "mobx-react"; import * as React from "react"; import { Form, Header, Icon, Segment } from "semantic-ui-react"; -import { DurationView, SectionChooser } from "@app/components"; -import { UiStore } from "@app/state"; +import { DurationView, SectionChooser } from "@client/components"; +import { UiStore } from "@client/state"; import { Duration } from "@common/Duration"; import log from "@common/logger"; import { Section, SprinklersDevice } from "@common/sprinklersRpc"; diff --git a/app/components/ScheduleView/ScheduleDate.tsx b/client/components/ScheduleView/ScheduleDate.tsx similarity index 100% rename from app/components/ScheduleView/ScheduleDate.tsx rename to client/components/ScheduleView/ScheduleDate.tsx diff --git a/app/components/ScheduleView/ScheduleTimes.tsx b/client/components/ScheduleView/ScheduleTimes.tsx similarity index 100% rename from app/components/ScheduleView/ScheduleTimes.tsx rename to client/components/ScheduleView/ScheduleTimes.tsx diff --git a/app/components/ScheduleView/TimeInput.tsx b/client/components/ScheduleView/TimeInput.tsx similarity index 100% rename from app/components/ScheduleView/TimeInput.tsx rename to client/components/ScheduleView/TimeInput.tsx diff --git a/app/components/ScheduleView/WeekdaysView.tsx b/client/components/ScheduleView/WeekdaysView.tsx similarity index 100% rename from app/components/ScheduleView/WeekdaysView.tsx rename to client/components/ScheduleView/WeekdaysView.tsx diff --git a/app/components/ScheduleView/index.tsx b/client/components/ScheduleView/index.tsx similarity index 98% rename from app/components/ScheduleView/index.tsx rename to client/components/ScheduleView/index.tsx index 89d5eef..ceda08a 100644 --- a/app/components/ScheduleView/index.tsx +++ b/client/components/ScheduleView/index.tsx @@ -7,7 +7,7 @@ import ScheduleDate from "./ScheduleDate"; import ScheduleTimes from "./ScheduleTimes"; import WeekdaysView from "./WeekdaysView"; -import "@app/styles/ScheduleView"; +import "@client/styles/ScheduleView"; export interface ScheduleViewProps { label?: string | React.ReactNode | undefined; diff --git a/app/components/SectionChooser.tsx b/client/components/SectionChooser.tsx similarity index 97% rename from app/components/SectionChooser.tsx rename to client/components/SectionChooser.tsx index 2237745..1ac7984 100644 --- a/app/components/SectionChooser.tsx +++ b/client/components/SectionChooser.tsx @@ -5,7 +5,7 @@ import { DropdownItemProps, DropdownProps, Form } from "semantic-ui-react"; import { Section } from "@common/sprinklersRpc"; -import "@app/styles/SectionChooser"; +import "@client/styles/SectionChooser"; @observer export default class SectionChooser extends React.Component<{ diff --git a/app/components/SectionRunnerView.tsx b/client/components/SectionRunnerView.tsx similarity index 99% rename from app/components/SectionRunnerView.tsx rename to client/components/SectionRunnerView.tsx index 6057a97..9ee592f 100644 --- a/app/components/SectionRunnerView.tsx +++ b/client/components/SectionRunnerView.tsx @@ -7,7 +7,7 @@ import { Duration } from "@common/Duration"; import log from "@common/logger"; import { Section, SectionRun, SectionRunner } from "@common/sprinklersRpc"; -import "@app/styles/SectionRunnerView"; +import "@client/styles/SectionRunnerView"; interface PausedStateProps { paused: boolean; diff --git a/app/components/SectionTable.tsx b/client/components/SectionTable.tsx similarity index 100% rename from app/components/SectionTable.tsx rename to client/components/SectionTable.tsx diff --git a/app/components/index.ts b/client/components/index.ts similarity index 100% rename from app/components/index.ts rename to client/components/index.ts diff --git a/app/images/favicon-16x16.png b/client/images/favicon-16x16.png similarity index 100% rename from app/images/favicon-16x16.png rename to client/images/favicon-16x16.png diff --git a/app/images/favicon-32x32.png b/client/images/favicon-32x32.png similarity index 100% rename from app/images/favicon-32x32.png rename to client/images/favicon-32x32.png diff --git a/app/images/favicon-96x96.png b/client/images/favicon-96x96.png similarity index 100% rename from app/images/favicon-96x96.png rename to client/images/favicon-96x96.png diff --git a/app/images/favicon.ico b/client/images/favicon.ico similarity index 100% rename from app/images/favicon.ico rename to client/images/favicon.ico diff --git a/app/images/raspberry_pi.png b/client/images/raspberry_pi.png similarity index 100% rename from app/images/raspberry_pi.png rename to client/images/raspberry_pi.png diff --git a/app/index.html b/client/index.html similarity index 100% rename from app/index.html rename to client/index.html diff --git a/app/index.tsx b/client/index.tsx similarity index 76% rename from app/index.tsx rename to client/index.tsx index 5d2c341..9fb14cd 100644 --- a/app/index.tsx +++ b/client/index.tsx @@ -3,8 +3,8 @@ import * as ReactDOM from "react-dom"; import { AppContainer } from "react-hot-loader"; import { Router } from "react-router-dom"; -import App from "@app/components/App"; -import { AppState, ProvideState } from "@app/state"; +import App from "@client/components/App"; +import { AppState, ProvideState } from "@client/state"; import logger from "@common/logger"; const state = new AppState(); @@ -30,8 +30,8 @@ const doRender = (Component: React.ComponentType) => { doRender(App); if (module.hot) { - module.hot.accept("@app/components/App", () => { - const NextApp = require("@app/components/App").default as typeof App; + module.hot.accept("@client/components/App", () => { + const NextApp = require("@client/components/App").default as typeof App; doRender(NextApp); }); } diff --git a/app/pages/LoginPage.tsx b/client/pages/LoginPage.tsx similarity index 96% rename from app/pages/LoginPage.tsx rename to client/pages/LoginPage.tsx index 26aee8b..23ab28f 100644 --- a/app/pages/LoginPage.tsx +++ b/client/pages/LoginPage.tsx @@ -3,10 +3,10 @@ import { observer } from "mobx-react"; import * as React from "react"; import { Container, Dimmer, Form, Header, InputOnChangeData, Loader, Message, Segment } from "semantic-ui-react"; -import { AppState, injectState } from "@app/state"; +import { AppState, injectState } from "@client/state"; import log from "@common/logger"; -import "@app/styles/LoginPage"; +import "@client/styles/LoginPage"; class LoginPageState { @observable username = ""; diff --git a/app/pages/LogoutPage.tsx b/client/pages/LogoutPage.tsx similarity index 85% rename from app/pages/LogoutPage.tsx rename to client/pages/LogoutPage.tsx index e8f0420..553ad74 100644 --- a/app/pages/LogoutPage.tsx +++ b/client/pages/LogoutPage.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { Redirect } from "react-router"; -import { AppState, ConsumeState } from "@app/state"; +import { AppState, ConsumeState } from "@client/state"; export function LogoutPage() { function consumeState(appState: AppState) { diff --git a/app/pages/ProgramPage.tsx b/client/pages/ProgramPage.tsx similarity index 97% rename from app/pages/ProgramPage.tsx rename to client/pages/ProgramPage.tsx index 4b4b493..f6029b3 100644 --- a/app/pages/ProgramPage.tsx +++ b/client/pages/ProgramPage.tsx @@ -5,9 +5,9 @@ import * as React from "react"; import { RouteComponentProps } from "react-router"; import { Button, CheckboxProps, Form, Icon, Input, InputOnChangeData, Menu, Modal } from "semantic-ui-react"; -import { ProgramSequenceView, ScheduleView } from "@app/components"; -import * as rp from "@app/routePaths"; -import { AppState, injectState } from "@app/state"; +import { ProgramSequenceView, ScheduleView } from "@client/components"; +import * as rp from "@client/routePaths"; +import { AppState, injectState } from "@client/state"; import log from "@common/logger"; import { Program, SprinklersDevice } from "@common/sprinklersRpc"; diff --git a/app/pages/index.tsx b/client/pages/index.tsx similarity index 88% rename from app/pages/index.tsx rename to client/pages/index.tsx index 48d1c2c..1455e7a 100644 --- a/app/pages/index.tsx +++ b/client/pages/index.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { RouteComponentProps } from "react-router"; -import { DevicesView, MessageTest} from "@app/components"; +import { DevicesView, MessageTest} from "@client/components"; export { LoginPage } from "./LoginPage"; export { LogoutPage } from "./LogoutPage"; diff --git a/app/polyfills.js b/client/polyfills.js similarity index 100% rename from app/polyfills.js rename to client/polyfills.js diff --git a/app/routePaths.ts b/client/routePaths.ts similarity index 100% rename from app/routePaths.ts rename to client/routePaths.ts diff --git a/app/sprinklersRpc/WebSocketRpcClient.ts b/client/sprinklersRpc/WebSocketRpcClient.ts similarity index 99% rename from app/sprinklersRpc/WebSocketRpcClient.ts rename to client/sprinklersRpc/WebSocketRpcClient.ts index cd7d209..7d2eb77 100644 --- a/app/sprinklersRpc/WebSocketRpcClient.ts +++ b/client/sprinklersRpc/WebSocketRpcClient.ts @@ -1,7 +1,7 @@ import { action, autorun, observable, when } from "mobx"; import { update } from "serializr"; -import { TokenStore } from "@app/state/TokenStore"; +import { TokenStore } from "@client/state/TokenStore"; import { ErrorCode } from "@common/ErrorCode"; import * as rpc from "@common/jsonRpc"; import logger from "@common/logger"; diff --git a/app/state/AppState.ts b/client/state/AppState.ts similarity index 90% rename from app/state/AppState.ts rename to client/state/AppState.ts index 8a3252a..c59b6e5 100644 --- a/app/state/AppState.ts +++ b/client/state/AppState.ts @@ -2,9 +2,9 @@ import { createBrowserHistory, History } from "history"; import { computed } from "mobx"; import { RouterStore, syncHistoryWithStore } from "mobx-react-router"; -import { WebSocketRpcClient } from "@app/sprinklersRpc/WebSocketRpcClient"; -import HttpApi from "@app/state/HttpApi"; -import { UiStore } from "@app/state/UiStore"; +import { WebSocketRpcClient } from "@client/sprinklersRpc/WebSocketRpcClient"; +import HttpApi from "@client/state/HttpApi"; +import { UiStore } from "@client/state/UiStore"; import ApiError from "@common/ApiError"; import { ErrorCode } from "@common/ErrorCode"; import log from "@common/logger"; diff --git a/app/state/HttpApi.ts b/client/state/HttpApi.ts similarity index 96% rename from app/state/HttpApi.ts rename to client/state/HttpApi.ts index 93dd4d7..5e4f014 100644 --- a/app/state/HttpApi.ts +++ b/client/state/HttpApi.ts @@ -1,4 +1,4 @@ -import { TokenStore } from "@app/state/TokenStore"; +import { TokenStore } from "@client/state/TokenStore"; import ApiError from "@common/ApiError"; import { ErrorCode } from "@common/ErrorCode"; diff --git a/app/state/Token.ts b/client/state/Token.ts similarity index 100% rename from app/state/Token.ts rename to client/state/Token.ts diff --git a/app/state/TokenStore.ts b/client/state/TokenStore.ts similarity index 95% rename from app/state/TokenStore.ts rename to client/state/TokenStore.ts index f336181..9930b3d 100644 --- a/app/state/TokenStore.ts +++ b/client/state/TokenStore.ts @@ -1,7 +1,7 @@ import { observable } from "mobx"; -import HttpApi, { ApiError } from "@app/state/HttpApi"; -import { Token } from "@app/state/Token"; +import HttpApi, { ApiError } from "@client/state/HttpApi"; +import { Token } from "@client/state/Token"; import { TokenGrantPasswordRequest, TokenGrantRefreshRequest, TokenGrantResponse } from "@common/httpApi"; import logger from "@common/logger"; diff --git a/app/state/UiStore.ts b/client/state/UiStore.ts similarity index 100% rename from app/state/UiStore.ts rename to client/state/UiStore.ts diff --git a/app/state/index.ts b/client/state/index.ts similarity index 100% rename from app/state/index.ts rename to client/state/index.ts diff --git a/app/state/reactContext.tsx b/client/state/reactContext.tsx similarity index 97% rename from app/state/reactContext.tsx rename to client/state/reactContext.tsx index be81a20..14c7ccb 100644 --- a/app/state/reactContext.tsx +++ b/client/state/reactContext.tsx @@ -1,6 +1,6 @@ import * as React from "react"; -import { AppState } from "@app/state"; +import { AppState } from "@client/state"; const StateContext = React.createContext(null); diff --git a/app/styles/DeviceView.scss b/client/styles/DeviceView.scss similarity index 100% rename from app/styles/DeviceView.scss rename to client/styles/DeviceView.scss diff --git a/app/styles/DurationView.scss b/client/styles/DurationView.scss similarity index 100% rename from app/styles/DurationView.scss rename to client/styles/DurationView.scss diff --git a/app/styles/LoginPage.scss b/client/styles/LoginPage.scss similarity index 100% rename from app/styles/LoginPage.scss rename to client/styles/LoginPage.scss diff --git a/app/styles/MessagesView.scss b/client/styles/MessagesView.scss similarity index 100% rename from app/styles/MessagesView.scss rename to client/styles/MessagesView.scss diff --git a/app/styles/ProgramSequenceView.scss b/client/styles/ProgramSequenceView.scss similarity index 100% rename from app/styles/ProgramSequenceView.scss rename to client/styles/ProgramSequenceView.scss diff --git a/app/styles/ScheduleView.scss b/client/styles/ScheduleView.scss similarity index 100% rename from app/styles/ScheduleView.scss rename to client/styles/ScheduleView.scss diff --git a/app/styles/SectionChooser.scss b/client/styles/SectionChooser.scss similarity index 100% rename from app/styles/SectionChooser.scss rename to client/styles/SectionChooser.scss diff --git a/app/styles/SectionRunnerView.scss b/client/styles/SectionRunnerView.scss similarity index 100% rename from app/styles/SectionRunnerView.scss rename to client/styles/SectionRunnerView.scss diff --git a/app/styles/app.scss b/client/styles/app.scss similarity index 100% rename from app/styles/app.scss rename to client/styles/app.scss diff --git a/app/tsconfig.json b/client/tsconfig.json similarity index 90% rename from app/tsconfig.json rename to client/tsconfig.json index 106d80e..f91c3fa 100644 --- a/app/tsconfig.json +++ b/client/tsconfig.json @@ -21,8 +21,8 @@ "@common/*": [ "./common/*" ], - "@app/*": [ - "./app/*" + "@client/*": [ + "./client/*" ] } } diff --git a/app/webpack.config.js b/client/webpack.config.js similarity index 95% rename from app/webpack.config.js rename to client/webpack.config.js index c404593..85719b4 100644 --- a/app/webpack.config.js +++ b/client/webpack.config.js @@ -111,7 +111,7 @@ const rules = (env) => { // Process TypeScript with TSC through HappyPack. { test: /\.tsx?$/, use: "happypack/loader?id=ts", - include: [ paths.appDir, paths.commonDir ], + include: [ paths.clientDir, paths.commonDir ], }, // "file" loader makes sure those assets get served by WebpackDevServer. // When you `import` an asset, you get its (virtual) filename. @@ -147,7 +147,7 @@ const getConfig = module.exports = (env) => { const plugins = [ new HtmlWebpackPlugin({ inject: true, - template: paths.appHtml, + template: paths.clientHtml, minify: isProd ? { removeComments: true, collapseWhitespace: true, @@ -161,7 +161,7 @@ const getConfig = module.exports = (env) => { minifyURLs: true, } : undefined, }), - new FaviconsWebpackPlugin(path.resolve(paths.appDir, "images", "favicon-96x96.png")), + new FaviconsWebpackPlugin(path.resolve(paths.clientDir, "images", "favicon-96x96.png")), // Makes some environment variables available to the JS code, for example: // if (process.env.NODE_ENV === "production") { ... }. See `./env.js`. // It is absolutely essential that NODE_ENV was set to production here. @@ -179,14 +179,14 @@ const getConfig = module.exports = (env) => { loaders: [{ loader: "ts-loader", options: { - configFile: paths.appTsConfig, + configFile: paths.clientTsConfig, happyPackMode: true, }, }], }), new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true, - tsconfig: paths.appTsConfig, + tsconfig: paths.clientTsConfig, tslint: paths.resolveRoot("tslint.json"), }), isDev && new DashboardPlugin(), @@ -212,10 +212,10 @@ const getConfig = module.exports = (env) => { isDev && require.resolve("react-hot-loader/patch"), isDev && require.resolve("react-dev-utils/webpackHotDevClient"), require.resolve("./polyfills"), - paths.appEntry, + paths.clientEntry, ].filter(Boolean), output: { - path: paths.appBuildDir, + path: paths.clientBuildDir, pathinfo: isDev, filename: isProd ? 'static/js/[name].[chunkhash:8].js' : @@ -231,7 +231,7 @@ const getConfig = module.exports = (env) => { resolve: { extensions: [".ts", ".tsx", ".js", ".json", ".scss"], alias: { - "@app": paths.appDir, + "@client": paths.clientDir, "@common": paths.commonDir, } }, diff --git a/common/paths.js b/common/paths.js index 4342d25..bc4461b 100644 --- a/common/paths.js +++ b/common/paths.js @@ -24,12 +24,12 @@ exports.publicPath = ensureSlash(url.parse(exports.publicUrl).pathname || "/", t exports.commonDir = resolveRoot("common"); -exports.appDir = resolveRoot("app"); -exports.appEntry = path.resolve(exports.appDir, "index.tsx"); -exports.appHtml = path.resolve(exports.appDir, "index.html"); -exports.appWebpackConfig = path.resolve(exports.appDir, "webpack.config.js"); -exports.appTsConfig = path.resolve(exports.appDir, "tsconfig.json"); -exports.appBuildDir = resolveRoot("public"); +exports.clientDir = resolveRoot("client"); +exports.clientEntry = path.resolve(exports.clientDir, "index.tsx"); +exports.clientHtml = path.resolve(exports.clientDir, "index.html"); +exports.clientWebpackConfig = path.resolve(exports.clientDir, "webpack.config.js"); +exports.clientTsConfig = path.resolve(exports.clientDir, "tsconfig.json"); +exports.clientBuildDir = resolveRoot("public"); exports.publicDir = exports.appBuildDir; exports.serverDir = resolveRoot("server"); diff --git a/common/tsconfig.json b/common/tsconfig.json index 4448bb0..1f03307 100644 --- a/common/tsconfig.json +++ b/common/tsconfig.json @@ -17,8 +17,8 @@ "@common/*": [ "./common/*" ], - "@app/*": [ - "./app/*" + "@client/*": [ + "./client/*" ] } }, diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 4fb4198..0e94ebb 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -11,7 +11,7 @@ services: - "8080:8080" - "8081:8081" volumes: - - ./app:/app/app + - ./client:/app/client - ./common:/app/common - ./server:/app/server env_file: diff --git a/package.json b/package.json index 03fa9ac..05de34e 100644 --- a/package.json +++ b/package.json @@ -6,18 +6,18 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "clean": "rm -rf ./dist ./build ./public", - "build:app": "NODE_ENV=production webpack --config ./app/webpack.config.js --env prod", + "build:client": "NODE_ENV=production webpack --config ./client/webpack.config.js --env prod", "build:server": "tsc --project server", "build": "run-p build:*", - "watch:app": "yarn build:app --watch", + "watch:client": "yarn build:client --watch", "watch:server": "yarn build:server --watch", - "start:dev-server": "NODE_ENV=development webpack-dev-server --config ./app/webpack.config.js --env dev", + "start:dev-server": "NODE_ENV=development webpack-dev-server --config ./client/webpack.config.js --env dev", "start": "NODE_ENV=development node dist/server/index.js", "start:pretty": "yarn start | node dist/server/logging/prettyPrint.js", "start:nodemon": "nodemon --delay 0.5 --exec \"env NODE_ENV=development node dist/server/index.js | node dist/server/logging/prettyPrint.js\"", "start:watch": "run-p watch:server start:nodemon", "start:dev": "run-p start:dev-server start:watch", - "lint:app": "tslint --project app --force --format verbose", + "lint:client": "tslint --project client --force --format verbose", "lint:server": "tslint --project server --force --format verbose", "lint": "run-p lint:*" }, diff --git a/server/express/serveApp.ts b/server/express/serveApp.ts index 5884418..6a4ee16 100644 --- a/server/express/serveApp.ts +++ b/server/express/serveApp.ts @@ -7,7 +7,7 @@ import * as paths from "@common/paths"; const index = path.join(paths.publicDir, "index.html"); export default function serveApp(app: Express) { - app.use(serveStatic(paths.appBuildDir)); + app.use(serveStatic(paths.clientBuildDir)); app.get("/*", (req, res) => { res.sendFile(index); }); diff --git a/server/tsconfig.json b/server/tsconfig.json index 5050664..b7afe72 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -21,8 +21,8 @@ "@common/*": [ "./common/*" ], - "@app/*": [ - "./app/*" + "@client/*": [ + "./client/*" ] } },