@gsc/web-kit v0.2.0. Three modules turn from stubs into the working
surface apps need to render a chrome-wrapped Next.js page with one
import per concern.
auth/server:
- createAuth({ keycloak: { clientId, clientSecret, issuer } }) factory
returns { handlers, signIn, signOut, auth, requireAuth, signInPath }.
Canonical SessionUser shape (id, keycloakId, tenantId, email,
displayName, givenName, familyName, roles, accessToken, idToken)
baked into the session callback. Apps drop their hand-rolled
src/auth.ts (~80 lines) for a 6-line factory call.
- requireAuth() — server-only. await it at the top of an RSC layout
or page; redirects to signInPath if no session.
auth/middleware:
- createAuthMiddleware({ publicRoutes? }) returns a Next.js middleware
that redirects unauth'd requests to /api/auth/signin/keycloak with
?callbackUrl=<original>. Bypasses /api/auth/*, /_next/*, /images/*,
favicon, robots.txt always.
auth (client):
- signInRedirect(callbackUrl?) — hard-nav from any client component.
shell/server:
- fetchShellConfig({ appKey, accessToken, apiUrl?, timeoutMs? }).
Server-only fetcher. 3s default timeout. Graceful fallback config
on any error — shell-api outages can't blank-screen a host app.
shell (client):
- <ShellProvider> + useShell() — read the resolved config from any
descendant of <AppLayout>.
layout:
- <AppLayout config currentPath translate onSignOut navbarExtras>.
Renders the chronos-style Bootstrap-Layout-3 chrome (navbar-static,
sidebar-light sidebar-main with collapse + persistence in
localStorage, navbar-footer). Wraps children with the kit's
ShellProvider so useShell() works.
devDep: @types/node for the server-side process.env read.
All 14 sub-exports still resolve under dist/. Phase 3 (data + forms)
and the gscCRM pilot cutover come next.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
2.3 KiB
JSON
53 lines
2.3 KiB
JSON
{
|
|
"name": "@gsc/web-kit",
|
|
"version": "0.2.0",
|
|
"description": "GSC web app skeleton — layout, auth, data, forms, feedback, navigation. Built on @limitless/ui. Drop into a Next.js app and just write pages.",
|
|
"license": "MIT",
|
|
"type": "module",
|
|
"main": "dist/index.js",
|
|
"module": "dist/index.js",
|
|
"types": "dist/index.d.ts",
|
|
"exports": {
|
|
".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" },
|
|
"./css": "./dist/styles/index.css",
|
|
"./layout": { "import": "./dist/layout/index.js", "types": "./dist/layout/index.d.ts" },
|
|
"./auth": { "import": "./dist/auth/index.js", "types": "./dist/auth/index.d.ts" },
|
|
"./auth/server":{ "import": "./dist/auth/server.js", "types": "./dist/auth/server.d.ts" },
|
|
"./auth/middleware": { "import": "./dist/auth/middleware.js", "types": "./dist/auth/middleware.d.ts" },
|
|
"./shell": { "import": "./dist/shell/index.js", "types": "./dist/shell/index.d.ts" },
|
|
"./shell/server":{ "import": "./dist/shell/server.js", "types": "./dist/shell/server.d.ts" },
|
|
"./data": { "import": "./dist/data/index.js", "types": "./dist/data/index.d.ts" },
|
|
"./forms": { "import": "./dist/forms/index.js", "types": "./dist/forms/index.d.ts" },
|
|
"./feedback": { "import": "./dist/feedback/index.js", "types": "./dist/feedback/index.d.ts" },
|
|
"./navigation": { "import": "./dist/navigation/index.js", "types": "./dist/navigation/index.d.ts" },
|
|
"./api": { "import": "./dist/api/index.js", "types": "./dist/api/index.d.ts" },
|
|
"./utils": { "import": "./dist/utils/index.js", "types": "./dist/utils/index.d.ts" }
|
|
},
|
|
"sideEffects": [
|
|
"**/*.css"
|
|
],
|
|
"scripts": {
|
|
"build": "tsc -p tsconfig.json --noEmit false",
|
|
"postbuild": "node ./scripts/postbuild.cjs",
|
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@limitless/ui": "file:../limitless-ui",
|
|
"next-auth": "^5.0.0-beta.25",
|
|
"next-intl": "^4.6.1",
|
|
"zod": "^3.23.0"
|
|
},
|
|
"peerDependencies": {
|
|
"bootstrap": "^5.3.3",
|
|
"next": ">=15.0.0",
|
|
"react": "^18.2.0 || ^19.0.0",
|
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^20.11.0",
|
|
"@types/react": "^19.0.0",
|
|
"@types/react-dom": "^19.0.0",
|
|
"typescript": "^5.4.0"
|
|
}
|
|
}
|