@_linked/cli 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42](https://github.com/linked-cm/cli/pull/42) [`81ac274`](https://github.com/linked-cm/cli/commit/81ac2740d9d98b1755a27c54174e6225a45da158) Thanks [@flyon](https://github.com/flyon)! - Stripped `@_linked/auth` from the default scaffold. It was wired in (`<ProvideAuth>` in `App.tsx`, `RequireAuth` import in `routes.tsx`) but no signin provider was configured, so it did nothing — while still dragging the entire legacy `lincd-*` chain (`foaf`, `lincd-input`, `lincd-mui-base`, `lincd-rdfs`, `lincd-sioc`) into the dep tree and crashing on startup with `Error: Multiple versions of LINCD are loaded` (both `lincd@1.0.3` and `@_linked/core` claim the same `globalThis.lincd` key).
|
|
8
|
+
|
|
9
|
+
To add sign-in back: `yarn add @_linked/auth`, wrap `<AppRoutes/>` in `<ProvideAuth>`, import `RequireAuth`, set `requireAuth: true` on the route you want protected. Inline comments in `App.tsx` and `routes.tsx` show where.
|
|
10
|
+
|
|
3
11
|
## 1.6.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -7,9 +7,11 @@ import { AppRoot } from '@_linked/server-utils/components/AppRoot';
|
|
|
7
7
|
import { Head } from '@_linked/server-utils/components/Head';
|
|
8
8
|
import { Body } from '@_linked/server-utils/components/Body';
|
|
9
9
|
import AppRoutes, { ROUTES } from './routes';
|
|
10
|
-
import { ProvideAuth } from '@_linked/auth/hooks/useAuth';
|
|
11
10
|
import style from './App.module.css'; //import any .module.css file like this and access the classnames from the style object
|
|
12
11
|
|
|
12
|
+
// To add sign-in to this app, install `@_linked/auth`, wrap <AppRoutes/>
|
|
13
|
+
// in <ProvideAuth>, and uncomment the `requireAuth` line in routes.tsx.
|
|
14
|
+
|
|
13
15
|
export default function App() {
|
|
14
16
|
return (
|
|
15
17
|
<AppRoot>
|
|
@@ -19,9 +21,7 @@ export default function App() {
|
|
|
19
21
|
<Body routes={ROUTES} pageStyles={style} className={style.App}>
|
|
20
22
|
<Suspense fallback={<Spinner />}>
|
|
21
23
|
<ErrorBoundary FallbackComponent={Error}>
|
|
22
|
-
<
|
|
23
|
-
<AppRoutes />
|
|
24
|
-
</ProvideAuth>
|
|
24
|
+
<AppRoutes />
|
|
25
25
|
</ErrorBoundary>
|
|
26
26
|
</Suspense>
|
|
27
27
|
</Body>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RequireAuth } from '@_linked/auth/components/RequireAuth';
|
|
2
1
|
import type { RoutesConfig } from '@_linked/server/types/RouteConfig';
|
|
3
2
|
import React, { lazy, Suspense } from 'react';
|
|
4
3
|
import { Route, Routes } from 'react-router-dom';
|
|
@@ -36,9 +35,9 @@ export const ROUTES: RoutesConfig = {
|
|
|
36
35
|
),
|
|
37
36
|
label: 'Components',
|
|
38
37
|
preloadChunks: ['page1'],
|
|
39
|
-
// To make this route sign-in-protected,
|
|
40
|
-
//
|
|
41
|
-
// requireAuth: true
|
|
38
|
+
// To make this route sign-in-protected, install `@_linked/auth`, wire up
|
|
39
|
+
// a `<ProvideAuth>` provider in App.tsx, import RequireAuth here, and
|
|
40
|
+
// set `requireAuth: true` on this route.
|
|
42
41
|
},
|
|
43
42
|
signin: {
|
|
44
43
|
path: '/signin',
|
|
@@ -56,12 +55,6 @@ export default function AppRoutes() {
|
|
|
56
55
|
const route = ROUTES[routeName];
|
|
57
56
|
const Component = route.component;
|
|
58
57
|
|
|
59
|
-
//if a route is marked as requireAuth, wrap it in the RequireAuth component and pass the signinRoute
|
|
60
|
-
const AuthGuard = route.requireAuth ? RequireAuth : React.Fragment;
|
|
61
|
-
const authProps = route.requireAuth
|
|
62
|
-
? { signinRoute: ROUTES.signin.path }
|
|
63
|
-
: {};
|
|
64
|
-
|
|
65
58
|
// define a render function that determines what to render based on the component and route.render
|
|
66
59
|
const renderRoute = () =>
|
|
67
60
|
// if a Component is defined, render it using JSX syntax (<Component />)
|
|
@@ -74,9 +67,7 @@ export default function AppRoutes() {
|
|
|
74
67
|
key={route.path}
|
|
75
68
|
path={route.path}
|
|
76
69
|
element={
|
|
77
|
-
<
|
|
78
|
-
<Suspense fallback={<Spinner />}>{renderRoute()}</Suspense>
|
|
79
|
-
</AuthGuard>
|
|
70
|
+
<Suspense fallback={<Spinner />}>{renderRoute()}</Suspense>
|
|
80
71
|
}
|
|
81
72
|
/>
|
|
82
73
|
);
|
package/lib/cjs/package.json
CHANGED
package/lib/esm/package.json
CHANGED