jenkins-bot has submitted this change and it was merged. ( 
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, 17 insertions(+), 17 deletions(-)

Approvals:
  Niedzielski: Looks good to me, approved
  jenkins-bot: Verified



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 f7c0bce..654a41c 100644
--- a/src/common/pages/summary.tsx
+++ b/src/common/pages/summary.tsx
@@ -4,8 +4,8 @@
 import { PageSummary as PageSummaryModel } from "../models/page/summary";
 import { PageTitleID, PageTitlePath } from "../models/page/title";
 import Page from "../components/page/page";
-import { RouteParams } from "../routers/route";
-import { summary } from "../routers/api";
+import { RouteParams } from "../router/route";
+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 0696bc7..20949e4 100644
--- a/src/common/pages/wiki.tsx
+++ b/src/common/pages/wiki.tsx
@@ -4,8 +4,8 @@
 import { Page as PageModel } from "../models/page/page";
 import { PageTitleID, PageTitlePath } from "../models/page/title";
 import Page from "../components/page/page";
-import { RouteParams } from "../routers/route";
-import { wiki } from "../routers/api";
+import { RouteParams } from "../router/route";
+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 96%
rename from src/common/routers/route.ts
rename to src/common/router/route.ts
index 1834331..d36909b 100644
--- a/src/common/routers/route.ts
+++ b/src/common/router/route.ts
@@ -17,7 +17,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> =
   | {
@@ -83,7 +83,7 @@
  * PageModule.getInitialProps(). This method uses a path regular expression to
  * split URL path values into the named properties of a corresponding Params
  * object. There is no compile-time validation performed on the result, so
- * Route.path's encoding and Params must be in sync (tested in api.test.ts).
+ * Route.path's encoding and Params must be in sync (tested in routes.test.ts).
  * Note: paramNames is equivalent to manually writing an ordered array of names
  * matching Route.path's encoding. e.g., `/^\/wiki\/([^/]+)$/i` and 
`["title"]`.
  */
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 be09a31..c4b8f45 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 98%
rename from src/common/routers/api.test.ts
rename to src/common/router/routes.test.ts
index 3b0d617..44447bc 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, RouteParams } from "./route";
 
 interface TestParams<Params extends RouteParams | undefined> {
@@ -52,7 +52,7 @@
   });
 }
 
-describe("api", () => {
+describe("routes", () => {
   describe("each route's path and URL path parameters match:", () => {
     [
       // Note: these types are verified to be RouteParams but not verified
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 c0f5e94..118b9fa 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";
-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: merged
Gerrit-Change-Id: I7aff4b7785f71012e563d2c26502b8ed2f99692b
Gerrit-PatchSet: 2
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to