Jhernandez has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/393255 )
Change subject: Hygiene: Rename common/routers to common/router
......................................................................
Hygiene: Rename common/routers to common/router
The routers folder only contains one router and routes, so the naming
routers seems a bit confusing.
In addition, the routers/api.ts that contains the routes has been
renamed to routes.ts
* src/common/{routers => router}
* src/common/router/{api => routes}.ts
Change-Id: I7aff4b7785f71012e563d2c26502b8ed2f99692b
---
M docs/development.md
M src/client/index.tsx
M src/common/components/header/header.tsx
M src/common/pages/home.tsx
M src/common/pages/summary.tsx
M src/common/pages/wiki.tsx
R src/common/router/route.ts
R src/common/router/router.test.ts
R src/common/router/router.ts
R src/common/router/routes.test.ts
R src/common/router/routes.ts
M src/server/index.tsx
12 files changed, 13 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/55/393255/1
diff --git a/docs/development.md b/docs/development.md
index 0998adc..3a4863f 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -200,8 +200,8 @@
- All filenames should use shish-kebab-case.
- The filenames, not the enclosing folder, should describe the module. For
example:
- - Prefer: app/app.tsx, link/link.css, routers/router.test.ts.
- - Avoid: app/index.tsx, link/index.css, routers/index.test.ts.
+ - Prefer: app/app.tsx, link/link.css, router/router.test.ts.
+ - Avoid: app/index.tsx, link/index.css, router/index.test.ts.
The reason is that some editors use filenames for UI cues and naming
everything "index.x" makes it difficult to distinguish among files quickly.
Client and server files are excluded as frontend client and backend server
diff --git a/src/client/index.tsx b/src/client/index.tsx
index 79b273b..8ddff0e 100644
--- a/src/client/index.tsx
+++ b/src/client/index.tsx
@@ -2,9 +2,9 @@
import newHistory from "history/createBrowserHistory";
import "wikimedia-ui-base/wikimedia-ui-base.css";
import "./index.css";
-import { RouteResponse, newRouter } from "../common/routers/router";
+import { RouteResponse, newRouter } from "../common/router/router";
import { WithContext } from "../common/components/with-context";
-import { routes } from "../common/routers/api";
+import { routes } from "../common/router/routes";
// Include preact/debug only in development for React DevTools integration.
// This check needs to be as defined with DefinePlugin in the webpack config so
diff --git a/src/common/components/header/header.tsx
b/src/common/components/header/header.tsx
index 979eb96..00741ba 100644
--- a/src/common/components/header/header.tsx
+++ b/src/common/components/header/header.tsx
@@ -1,7 +1,7 @@
import { h } from "preact";
import Wordmark from "../wordmark/wordmark";
import Link from "../link/link";
-import { home } from "../../routers/api";
+import { home } from "../../router/routes";
import "./header.css";
diff --git a/src/common/pages/home.tsx b/src/common/pages/home.tsx
index 3a18729..9816587 100644
--- a/src/common/pages/home.tsx
+++ b/src/common/pages/home.tsx
@@ -8,7 +8,7 @@
randomWiki,
randomSummary,
styleGuide
-} from "../../common/routers/api";
+} from "../../common/router/routes";
import Page from "../components/page/page";
import { PageTitleID } from "../models/page/title";
import Link from "../components/link/link";
diff --git a/src/common/pages/summary.tsx b/src/common/pages/summary.tsx
index fd0435f..6b51cc5 100644
--- a/src/common/pages/summary.tsx
+++ b/src/common/pages/summary.tsx
@@ -4,7 +4,7 @@
import { PageSummary as PageSummaryModel } from "../models/page/summary";
import { PageTitleID, PageTitlePath } from "../models/page/title";
import Page from "../components/page/page";
-import { summary } from "../routers/api";
+import { summary } from "../router/routes";
import { request } from "../http/page-summary-http-client";
import ContentHeader from "../components/content-header/content-header";
import ContentFooter from "../components/content-footer/content-footer";
diff --git a/src/common/pages/wiki.tsx b/src/common/pages/wiki.tsx
index 2687fdc..8f68838 100644
--- a/src/common/pages/wiki.tsx
+++ b/src/common/pages/wiki.tsx
@@ -4,7 +4,7 @@
import { Page as PageModel } from "../models/page/page";
import { PageTitleID, PageTitlePath } from "../models/page/title";
import Page from "../components/page/page";
-import { wiki } from "../routers/api";
+import { wiki } from "../router/routes";
import { requestPage } from "../http/page-http-client";
import ContentFooter from "../components/content-footer/content-footer";
import ContentPage from "../components/content-page/content-page";
diff --git a/src/common/routers/route.ts b/src/common/router/route.ts
similarity index 98%
rename from src/common/routers/route.ts
rename to src/common/router/route.ts
index 33baaa4..bafb378 100644
--- a/src/common/routers/route.ts
+++ b/src/common/router/route.ts
@@ -6,7 +6,7 @@
* A file that exposes a Preact UI component and optionally a function to
* request properties needed to construct the component. Modules within the
* pages/ subdirectory should implicitly implement this interface or typing
will
- * fail in routers/api.
+ * fail in router/routes.
*/
export type PageComponent<Params, Props = undefined> =
| {
diff --git a/src/common/routers/router.test.ts
b/src/common/router/router.test.ts
similarity index 100%
rename from src/common/routers/router.test.ts
rename to src/common/router/router.test.ts
diff --git a/src/common/routers/router.ts b/src/common/router/router.ts
similarity index 98%
rename from src/common/routers/router.ts
rename to src/common/router/router.ts
index c902ff7..b9fc242 100644
--- a/src/common/routers/router.ts
+++ b/src/common/router/router.ts
@@ -4,7 +4,7 @@
PageComponent,
PageModule,
Route
-} from "../../common/routers/route";
+} from "../../common/router/route";
import HttpResponse from "../http/http-response";
import notFoundPage from "../pages/not-found";
diff --git a/src/common/routers/api.test.ts b/src/common/router/routes.test.ts
similarity index 99%
rename from src/common/routers/api.test.ts
rename to src/common/router/routes.test.ts
index d552b77..186e5a7 100644
--- a/src/common/routers/api.test.ts
+++ b/src/common/router/routes.test.ts
@@ -7,7 +7,7 @@
randomWiki,
randomSummary,
styleGuide
-} from "./api";
+} from "./routes";
import { Route } from "./route";
interface TestParams {
diff --git a/src/common/routers/api.ts b/src/common/router/routes.ts
similarity index 100%
rename from src/common/routers/api.ts
rename to src/common/router/routes.ts
diff --git a/src/server/index.tsx b/src/server/index.tsx
index f8d923c..c8168a4 100644
--- a/src/server/index.tsx
+++ b/src/server/index.tsx
@@ -2,9 +2,9 @@
import * as compression from "compression";
import { h } from "preact";
import { render as renderToString } from "preact-render-to-string";
-import { RouteResponse, newRouter } from "../common/routers/router";
+import { RouteResponse, newRouter } from "../common/router/router";
import { RedirectError } from "../common/http/fetch-with-redirect";
-import { routes } from "../common/routers/api";
+import { routes } from "../common/router/routes";
import { SERVER_PORT, SERVER_URL } from "../common/assets/config";
import HTMLPage from "./components/html-page";
--
To view, visit https://gerrit.wikimedia.org/r/393255
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7aff4b7785f71012e563d2c26502b8ed2f99692b
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits