diff --git a/packages/frontend/package.json b/packages/frontend/package.json
index 6fec32b..acbb49c 100644
--- a/packages/frontend/package.json
+++ b/packages/frontend/package.json
@@ -26,6 +26,7 @@
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"elite-feature-flags": "^1.0.0",
- "elite-configuration": "^1.0.0"
+ "elite-configuration": "^1.0.0",
+ "elite-routing": "^1.0.0"
}
}
diff --git a/packages/frontend/src/components/App.tsx b/packages/frontend/src/components/App.tsx
index 4d5dcdb..64e7c14 100644
--- a/packages/frontend/src/components/App.tsx
+++ b/packages/frontend/src/components/App.tsx
@@ -6,9 +6,11 @@ import history from '../util/history';
import { FeatureFlagsProvider } from 'elite-feature-flags';
import { Configuration } from 'elite-types';
import { getConfiguration } from 'elite-configuration';
-import { getAllRegisteredAppRoutes } from '../util/routing';
+import { getAllRegisteredAppRoutes } from 'elite-routing';
+import { AppPaths } from '../util/routes';
// Files must be required (early!) for decorator to work
+// TODO: move to routes.ts
require('../components/pages/HomePage');
require('../components/pages/LinkPage');
@@ -22,7 +24,7 @@ export const AppComponent = () => (
))}
{/* Error 404 Fallback */}
-
+
diff --git a/packages/frontend/src/components/pages/HomePage.tsx b/packages/frontend/src/components/pages/HomePage.tsx
index ec66118..0961e64 100644
--- a/packages/frontend/src/components/pages/HomePage.tsx
+++ b/packages/frontend/src/components/pages/HomePage.tsx
@@ -3,11 +3,12 @@ import { RouteComponentProps } from 'react-router';
import { LinkDirectory } from './support/LinkDirectory';
import { Divider } from '@material-ui/core';
import { FeatureFlag } from 'elite-feature-flags';
-import { Routed } from '../../util/routing';
+import { Routed } from 'elite-routing';
+import { AppPaths } from '../../util/routes';
export interface HomePageProps extends RouteComponentProps {}
-@Routed({ path: '/home', displayName: 'Home' })
+@Routed({ path: AppPaths.HOME, displayName: 'Home' })
export class HomePage extends React.PureComponent {
render() {
return (
diff --git a/packages/frontend/src/components/pages/LinkPage.tsx b/packages/frontend/src/components/pages/LinkPage.tsx
index 717ba59..989a7ca 100644
--- a/packages/frontend/src/components/pages/LinkPage.tsx
+++ b/packages/frontend/src/components/pages/LinkPage.tsx
@@ -1,13 +1,14 @@
import { Divider, List } from '@material-ui/core';
import * as React from 'react';
import { RouteComponentProps } from 'react-router';
-import { Routed } from '../../util/routing';
+import { Routed } from 'elite-routing';
+import { AppPaths } from '../../util/routes';
import { LinkListItem } from '../general/LinkListItem';
import { LinkDirectory } from './support/LinkDirectory';
export interface LinkPageProps extends RouteComponentProps {}
-@Routed({ path: '/link', displayName: 'Useful Links' })
+@Routed({ path: AppPaths.LINK, displayName: 'Useful Links' })
export class LinkPage extends React.PureComponent {
render() {
return (
diff --git a/packages/frontend/src/components/pages/support/LinkDirectory.tsx b/packages/frontend/src/components/pages/support/LinkDirectory.tsx
index fe5179c..ec54a4f 100644
--- a/packages/frontend/src/components/pages/support/LinkDirectory.tsx
+++ b/packages/frontend/src/components/pages/support/LinkDirectory.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Link } from 'react-router-dom';
-import { getLinkForRoute, getDisplayNameForRoute, getAllRegisteredAppRoutes } from '../../../util/routing';
+import { getLinkForRoute, getDisplayNameForRoute, getAllRegisteredAppRoutes } from 'elite-routing';
export const LinkDirectory = () => (
diff --git a/packages/frontend/src/util/routes.ts b/packages/frontend/src/util/routes.ts
new file mode 100644
index 0000000..09af683
--- /dev/null
+++ b/packages/frontend/src/util/routes.ts
@@ -0,0 +1,4 @@
+export enum AppPaths {
+ HOME = '/home',
+ LINK = '/link',
+}
diff --git a/packages/frontend/tsconfig.json b/packages/frontend/tsconfig.json
index 1d4b811..7b0a9ff 100644
--- a/packages/frontend/tsconfig.json
+++ b/packages/frontend/tsconfig.json
@@ -3,8 +3,7 @@
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
- "baseUrl": "src",
- "experimentalDecorators": true
+ "baseUrl": "src"
},
"include": ["src/**/*"],
"references": [
@@ -14,6 +13,9 @@
{
"path": "../feature-flags"
},
+ {
+ "path": "../routing"
+ },
{
"path": "../types"
}
diff --git a/packages/routing/package.json b/packages/routing/package.json
new file mode 100644
index 0000000..9f2e324
--- /dev/null
+++ b/packages/routing/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "elite-routing",
+ "version": "1.0.0",
+ "private": true,
+ "publishConfig": {
+ "access": "public"
+ },
+ "types": "dist/index.d.ts",
+ "main": "dist/index.js",
+ "scripts": {
+ "clean": "rm -rf dist/ node_modules/ tsconfig.tsbuildinfo"
+ },
+ "devDependencies": {
+ "@types/react": "^16.9.11",
+ "@types/react-router": "^5.1.3",
+ "elite-types": "^1.0.0"
+ },
+ "dependencies": {
+ "react": "^16.12.0"
+ }
+}
diff --git a/packages/routing/src/index.ts b/packages/routing/src/index.ts
new file mode 100644
index 0000000..161ba39
--- /dev/null
+++ b/packages/routing/src/index.ts
@@ -0,0 +1 @@
+export * from './routing';
diff --git a/packages/frontend/src/util/routing.tsx b/packages/routing/src/routing.tsx
similarity index 95%
rename from packages/frontend/src/util/routing.tsx
rename to packages/routing/src/routing.tsx
index c4846b9..494e99e 100644
--- a/packages/frontend/src/util/routing.tsx
+++ b/packages/routing/src/routing.tsx
@@ -63,7 +63,6 @@ export function registerAppRoute(props: AppRouteProps & Required