nx-factory-cli 2.1.21 → 2.1.23

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.
@@ -1,5 +1,6 @@
1
1
  import path from "path";
2
2
  import { writeFile, ensureDir } from "../../../files.js";
3
+ import { scopedPackageName } from "../../../config.js";
3
4
  export const betterAuthScaffolder = {
4
5
  label: "Better Auth",
5
6
  dependencies: {
@@ -12,41 +13,42 @@ export const betterAuthScaffolder = {
12
13
  react: "^18 || ^19",
13
14
  "react-dom": "^18 || ^19",
14
15
  },
15
- async scaffold(pkgDir, _opts) {
16
+ async scaffold(pkgDir, opts) {
17
+ const authPackageName = scopedPackageName(opts.scope, "auth");
18
+ const dbPackageName = scopedPackageName(opts.scope, "db");
16
19
  await ensureDir(path.join(pkgDir, "."));
17
20
  // ── index.ts ──────────────────────────────────────────────────────────
18
21
  await writeFile(path.join(pkgDir, "index.ts"), `/**
19
- * @workspace/auth — Better Auth v1.2+
22
+ * ${authPackageName} — Better Auth v1.2+
20
23
  *
21
24
  * Prefer sub-path imports for tree-shaking:
22
- * import { auth } from "@workspace/auth/server"
23
- * import { authClient } from "@workspace/auth/client"
24
- * import { authMiddleware } from "@workspace/auth/next"
25
+ * import { auth } from "${authPackageName}/server"
26
+ * import { authClient } from "${authPackageName}/client"
27
+ * import { authMiddleware } from "${authPackageName}/next"
25
28
  */
26
29
  export * from "./server.js";
27
30
  export * from "./client.js";
28
31
  `);
29
32
  // ── server.ts ─────────────────────────────────────────────────────────
30
- // better-auth v1.2: betterAuth() config, database adapters, plugins
31
33
  await writeFile(path.join(pkgDir, "server.ts"), `/**
32
34
  * Better Auth @latest — server instance.
33
35
  *
34
36
  * This file is the single source of truth for your auth configuration.
35
- * Import \`auth\` in API routes, server components, and middleware.
37
+ * Import \`auth\` in API routes, server components, and middleware.
36
38
  *
37
39
  * @example Next.js App Router (Server Component)
38
- * import { auth } from "@workspace/auth/server";
40
+ * import { auth } from "${authPackageName}/server";
39
41
  * import { headers } from "next/headers";
40
42
  *
41
43
  * const session = await auth.api.getSession({ headers: await headers() });
42
44
  *
43
45
  * @example Next.js Route Handler
44
- * import { auth } from "@workspace/auth/server";
46
+ * import { auth } from "${authPackageName}/server";
45
47
  * import { toNextJsHandler } from "better-auth/next-js";
46
48
  * export const { GET, POST } = toNextJsHandler(auth);
47
49
  *
48
50
  * @example Remix loader
49
- * import { auth } from "@workspace/auth/server";
51
+ * import { auth } from "${authPackageName}/server";
50
52
  * const session = await auth.api.getSession({ headers: request.headers });
51
53
  */
52
54
  import { betterAuth } from "better-auth";
@@ -73,15 +75,15 @@ export const auth = betterAuth({
73
75
  *
74
76
  * Prisma:
75
77
  * import { prismaAdapter } from "better-auth/adapters/prisma";
76
- * import { prisma } from "@workspace/db";
78
+ * import { prisma } from "${dbPackageName}";
77
79
  * database: prismaAdapter(prisma, { provider: "postgresql" }),
78
80
  *
79
81
  * Drizzle:
80
82
  * import { drizzleAdapter } from "better-auth/adapters/drizzle";
81
- * import { db } from "@workspace/db";
83
+ * import { db } from "${dbPackageName}";
82
84
  * database: drizzleAdapter(db, { provider: "pg" }),
83
85
  */
84
- database: undefined as never, // Replace with your adapter
86
+ database: undefined as never, // Replace with your adapter
85
87
 
86
88
  emailAndPassword: {
87
89
  enabled: true,
@@ -91,8 +93,8 @@ export const auth = betterAuth({
91
93
 
92
94
  session: {
93
95
  cookieCache: {
94
- enabled: true,
95
- maxAge: 60 * 5, // 5 minutes
96
+ enabled: true,
97
+ maxAge: 60 * 5, // 5 minutes
96
98
  },
97
99
  },
98
100
 
@@ -120,10 +122,9 @@ export const auth = betterAuth({
120
122
  /** Inferred Session type from your auth config */
121
123
  export type Session = typeof auth.$Infer.Session;
122
124
  /** Inferred User type from your auth config */
123
- export type User = typeof auth.$Infer.Session.user;
125
+ export type User = typeof auth.$Infer.Session.user;
124
126
  `);
125
127
  // ── client.ts ─────────────────────────────────────────────────────────
126
- // better-auth v1.2: createAuthClient from "better-auth/react"
127
128
  await writeFile(path.join(pkgDir, "client.ts"), `/**
128
129
  * Better Auth v1.2+ — browser client.
129
130
  *
@@ -131,7 +132,7 @@ export type User = typeof auth.$Infer.Session.user;
131
132
  * Call methods directly on authClient to avoid type inference issues.
132
133
  *
133
134
  * @example
134
- * import { authClient } from "@workspace/auth/client";
135
+ * import { authClient } from "${authPackageName}/client";
135
136
  *
136
137
  * // React hook
137
138
  * const { data: session, isPending } = authClient.useSession();
@@ -167,14 +168,13 @@ export const authClient: AuthClient = createAuthClient({
167
168
  });
168
169
  `);
169
170
  // ── middleware.ts ─────────────────────────────────────────────────────
170
- // better-auth v1.2: auth.api.getSession pattern (no separate middleware pkg)
171
171
  await writeFile(path.join(pkgDir, "middleware.ts"), `/**
172
172
  * Better Auth v1.2+ — Next.js middleware.
173
173
  *
174
174
  * Quick start — copy into apps/<your-app>/middleware.ts:
175
175
  *
176
176
  * import type { NextRequest } from "next/server";
177
- * import { authMiddleware, middlewareConfig } from "@workspace/auth/middleware";
177
+ * import { authMiddleware, middlewareConfig } from "${authPackageName}/middleware";
178
178
  *
179
179
  * export default function middleware(request: NextRequest) {
180
180
  * return authMiddleware(request);
@@ -184,9 +184,9 @@ export const authClient: AuthClient = createAuthClient({
184
184
  *
185
185
  * Custom public paths:
186
186
  *
187
- * import { buildMiddleware } from "@workspace/auth/middleware";
187
+ * import { buildMiddleware } from "${authPackageName}/middleware";
188
188
  * export default buildMiddleware({ publicPaths: ["/", "/about(.*)"] });
189
- * export { middlewareConfig as config } from "@workspace/auth/middleware";
189
+ * export { middlewareConfig as config } from "${authPackageName}/middleware";
190
190
  */
191
191
  import { auth } from "./server.js";
192
192
 
@@ -200,8 +200,8 @@ const DEFAULT_PUBLIC_PATHS = [
200
200
  "/",
201
201
  "/sign-in",
202
202
  "/sign-up",
203
- "/api/auth", // Better Auth's own handler
204
- "/api/webhooks", // Webhook endpoints
203
+ "/api/auth", // Better Auth's own handler
204
+ "/api/webhooks", // Webhook endpoints
205
205
  ];
206
206
 
207
207
  export const middlewareConfig = {
@@ -218,14 +218,14 @@ export const authMiddleware = buildMiddleware();
218
218
  * Build a middleware with configurable public paths.
219
219
  *
220
220
  * @param publicPaths - Paths that do NOT require authentication (prefix match)
221
- * @param redirectTo - Where to redirect unauthenticated users (default: /sign-in)
221
+ * @param redirectTo - Where to redirect unauthenticated users (default: /sign-in)
222
222
  */
223
223
  export function buildMiddleware({
224
224
  publicPaths = DEFAULT_PUBLIC_PATHS,
225
- redirectTo = "/sign-in",
225
+ redirectTo = "/sign-in",
226
226
  }: {
227
227
  publicPaths?: string[];
228
- redirectTo?: string;
228
+ redirectTo?: string;
229
229
  } = {}) {
230
230
  return async function middleware(request: MiddlewareRequest): Promise<any> {
231
231
  const { pathname } = request.nextUrl;
@@ -255,7 +255,7 @@ export function buildMiddleware({
255
255
  *
256
256
  * better-auth latest: pass auth instance to toNextJsHandler.
257
257
  */
258
- import { auth } from "@workspace/auth/server";
258
+ import { auth } from "${authPackageName}/server";
259
259
  import { toNextJsHandler } from "better-auth/next-js";
260
260
 
261
261
  // This creates GET and POST handlers that Next.js will pick up automatically.
@@ -263,11 +263,11 @@ export const { GET, POST } = toNextJsHandler(auth);
263
263
  `);
264
264
  // ── next.ts — Next.js-specific adapter exports ───────────────────────
265
265
  await writeFile(path.join(pkgDir, "next.ts"), `/**
266
- * Next.js adapter for @workspace/auth.
266
+ * Next.js adapter for ${authPackageName}.
267
267
  *
268
268
  * Import this sub-path only in Next apps:
269
269
  * import { authMiddleware, middlewareConfig, nextRouteHandlers }
270
- * from "@workspace/auth/next";
270
+ * from "${authPackageName}/next";
271
271
  */
272
272
  import { toNextJsHandler } from "better-auth/next-js";
273
273
  import { auth } from "./server.js";
@@ -301,7 +301,7 @@ NEXT_PUBLIC_APP_URL=http://localhost:3000
301
301
  # GOOGLE_CLIENT_SECRET=
302
302
  `);
303
303
  // ── README.md ─────────────────────────────────────────────────────────────
304
- await writeFile(path.join(pkgDir, "README.md"), `# @workspace/auth — Better Auth v1.2+
304
+ await writeFile(path.join(pkgDir, "README.md"), `# ${authPackageName} — Better Auth v1.2+
305
305
 
306
306
  Shared authentication powered by [Better Auth](https://www.better-auth.com) — open-source, self-hosted, database-agnostic.
307
307
 
@@ -318,13 +318,13 @@ cp packages/auth/.env.example apps/<your-app>/.env.local
318
318
 
319
319
  ### 3. Add the dependency
320
320
  \`\`\`json
321
- { "dependencies": { "@workspace/auth": "workspace:*" } }
321
+ { "dependencies": { "${authPackageName}": "workspace:*" } }
322
322
  \`\`\`
323
323
 
324
324
  ### 4. Add the API route (Next.js)
325
325
  \`\`\`ts
326
326
  // apps/<your-app>/app/api/auth/[...all]/route.ts
327
- import { nextRouteHandlers } from "@workspace/auth/next";
327
+ import { nextRouteHandlers } from "${authPackageName}/next";
328
328
  export const { GET, POST } = nextRouteHandlers;
329
329
  \`\`\`
330
330
 
@@ -332,7 +332,7 @@ export const { GET, POST } = nextRouteHandlers;
332
332
  \`\`\`ts
333
333
  // apps/<your-app>/middleware.ts
334
334
  import type { NextRequest } from "next/server";
335
- import { authMiddleware, middlewareConfig } from "@workspace/auth/next";
335
+ import { authMiddleware, middlewareConfig } from "${authPackageName}/next";
336
336
 
337
337
  export default function middleware(request: NextRequest) {
338
338
  return authMiddleware(request);
@@ -351,13 +351,13 @@ npx better-auth migrate
351
351
 
352
352
  \`\`\`tsx
353
353
  // Server component
354
- import { auth } from "@workspace/auth/server";
354
+ import { auth } from "${authPackageName}/server";
355
355
  import { headers } from "next/headers";
356
356
  const session = await auth.api.getSession({ headers: await headers() });
357
357
 
358
358
  // Client component
359
359
  "use client";
360
- import { authClient } from "@workspace/auth/client";
360
+ import { authClient } from "${authPackageName}/client";
361
361
  const { data: session, isPending } = authClient.useSession();
362
362
  await authClient.signIn.email({ email, password });
363
363
  await authClient.signIn.social({ provider: "github" });
@@ -369,10 +369,10 @@ await authClient.signOut();
369
369
 
370
370
  | Sub-path | Key exports |
371
371
  |---|---|
372
- | \`@workspace/auth/server\` | \`auth\`, \`Session\` type, \`User\` type |
373
- | \`@workspace/auth/client\` | \`authClient\`, \`AuthClient\` type |
374
- | \`@workspace/auth/middleware\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
375
- | \`@workspace/auth/next\` | \`nextRouteHandlers\`, \`authMiddleware\`, \`middlewareConfig\` |
372
+ | \`${authPackageName}/server\` | \`auth\`, \`Session\` type, \`User\` type |
373
+ | \`${authPackageName}/client\` | \`authClient\`, \`AuthClient\` type |
374
+ | \`${authPackageName}/middleware\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
375
+ | \`${authPackageName}/next\` | \`nextRouteHandlers\`, \`authMiddleware\`, \`middlewareConfig\` |
376
376
  `);
377
377
  },
378
378
  };
@@ -1 +1 @@
1
- {"version":3,"file":"better-auth.js","sourceRoot":"","sources":["../../../../src/setups/auth/systems/better-auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGzD,MAAM,CAAC,MAAM,oBAAoB,GAA0B;IACzD,KAAK,EAAE,aAAa;IAEpB,YAAY,EAAE;QACZ,aAAa,EAAE,QAAQ;KACxB;IAED,eAAe,EAAE;QACf,cAAc,EAAE,SAAS;KAC1B;IAED,gBAAgB,EAAE;QAChB,KAAK,EAAQ,YAAY;QACzB,WAAW,EAAE,YAAY;KAC1B;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,KAAyB;QACtD,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAExC,yEAAyE;QACzE,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,EAC7B;;;;;;;;;;CAUL,CACI,CAAC;QAEF,yEAAyE;QACzE,oEAAoE;QACpE,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WA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AC;AAE7E,eAAO,MAAM,eAAe,EAAE,qBAmT7B,CAAC"}
1
+ {"version":3,"file":"clerk.d.ts","sourceRoot":"","sources":["../../../../src/setups/auth/systems/clerk.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAsB,MAAM,aAAa,CAAC;AAE7E,eAAO,MAAM,eAAe,EAAE,qBAiT7B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import path from "path";
2
2
  import { writeFile, ensureDir } from "../../../files.js";
3
+ import { scopedPackageName } from "../../../config.js";
3
4
  export const clerkScaffolder = {
4
5
  label: "Clerk",
5
- // Clerk v6 — all packages unified under @clerk/nextjs / @clerk/react etc.
6
6
  dependencies: {
7
7
  "@clerk/nextjs": "latest",
8
8
  "@clerk/clerk-react": "latest",
@@ -16,21 +16,22 @@ export const clerkScaffolder = {
16
16
  react: "^18 || ^19",
17
17
  "react-dom": "^18 || ^19",
18
18
  },
19
- async scaffold(pkgDir, _opts) {
19
+ async scaffold(pkgDir, opts) {
20
+ const authPackageName = scopedPackageName(opts.scope, "auth");
20
21
  await ensureDir(path.join(pkgDir, "."));
21
22
  // ── /index.ts ──────────────────────────────────────────────────────────
22
23
  await writeFile(path.join(pkgDir, "index.ts"), `/**
23
- * @workspace/auth — Clerk latest setup.
24
+ * ${authPackageName} — Clerk latest setup.
24
25
  *
25
26
  * Prefer sub-path imports for tree-shaking:
26
- * import { auth, currentUser } from "@workspace/auth/server"
27
- * import { useAuth, UserButton } from "@workspace/auth/client"
28
- * import { authMiddleware } from "@workspace/auth/next"
27
+ * import { auth, currentUser } from "${authPackageName}/server"
28
+ * import { useAuth, UserButton } from "${authPackageName}/client"
29
+ * import { authMiddleware } from "${authPackageName}/next"
29
30
  */
30
31
  export * from "./server.js";
31
32
  export * from "./client.js";
32
33
  `);
33
- await writeFile(path.join(pkgDir, "next.ts"), `/** Next.js adapter for @workspace/auth (Clerk). */
34
+ await writeFile(path.join(pkgDir, "next.ts"), `/** Next.js adapter for ${authPackageName} (Clerk). */
34
35
  export {
35
36
  authMiddleware,
36
37
  buildMiddleware,
@@ -38,13 +39,12 @@ export {
38
39
  } from "./middleware.js";
39
40
  `);
40
41
  // ── /server.ts ─────────────────────────────────────────────────────────
41
- // Clerk v6: auth() is async, currentUser() is async, clerkClient is a factory
42
42
  await writeFile(path.join(pkgDir, "server.ts"), `/**
43
43
  * Clerk v6 — server-side helpers.
44
44
  * Import in Next.js Server Components, Route Handlers, or Middleware.
45
45
  *
46
46
  * @example Next.js App Router
47
- * import { auth, currentUser } from "@workspace/auth/server";
47
+ * import { auth, currentUser } from "${authPackageName}/server";
48
48
  *
49
49
  * export default async function Page() {
50
50
  * const { userId } = await auth();
@@ -52,7 +52,7 @@ export {
52
52
  * }
53
53
  *
54
54
  * @example Route Handler / Remix loader
55
- * import { getAuth } from "@workspace/auth/server";
55
+ * import { getAuth } from "${authPackageName}/server";
56
56
  * const { userId } = getAuth(req); // Express / Remix: sync helper
57
57
  */
58
58
 
@@ -81,7 +81,7 @@ export type {
81
81
  * Use in React Client Components, Vite SPAs, or Expo apps.
82
82
  *
83
83
  * @example
84
- * import { useAuth, useUser, UserButton } from "@workspace/auth/client";
84
+ * import { useAuth, useUser, UserButton } from "${authPackageName}/client";
85
85
  *
86
86
  * function Header() {
87
87
  * const { isSignedIn } = useAuth();
@@ -121,7 +121,6 @@ export {
121
121
  export { SignedIn, SignedOut, Protect } from "@clerk/nextjs";
122
122
  `);
123
123
  // ── /middleware.ts ─────────────────────────────────────────────────────
124
- // Clerk v6: clerkMiddleware replaces authMiddleware (deprecated in v5, removed in v6)
125
124
  await writeFile(path.join(pkgDir, "middleware.ts"), `/**
126
125
  * Clerk v6 middleware for Next.js.
127
126
  *
@@ -130,7 +129,7 @@ export { SignedIn, SignedOut, Protect } from "@clerk/nextjs";
130
129
  * Quick start — copy into apps/<your-app>/middleware.ts:
131
130
  *
132
131
  * import type { NextRequest } from "next/server";
133
- * import { authMiddleware, middlewareConfig } from "@workspace/auth/middleware";
132
+ * import { authMiddleware, middlewareConfig } from "${authPackageName}/middleware";
134
133
  *
135
134
  * export default function middleware(request: NextRequest) {
136
135
  * return authMiddleware(request);
@@ -140,9 +139,9 @@ export { SignedIn, SignedOut, Protect } from "@clerk/nextjs";
140
139
  *
141
140
  * Custom public routes:
142
141
  *
143
- * import { buildMiddleware } from "@workspace/auth/middleware";
142
+ * import { buildMiddleware } from "${authPackageName}/middleware";
144
143
  * export default buildMiddleware(["/", "/about(.*)", "/marketing(.*)"]);
145
- * export { middlewareConfig as config } from "@workspace/auth/middleware";
144
+ * export { middlewareConfig as config } from "${authPackageName}/middleware";
146
145
  */
147
146
  import {
148
147
  clerkMiddleware,
@@ -154,7 +153,6 @@ export const middlewareConfig = {
154
153
  matcher: [
155
154
  // Skip Next.js internals and all static files
156
155
  "/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)",
157
- // Always run for API routes
158
156
  "/(api|trpc)(.*)",
159
157
  ],
160
158
  };
@@ -206,7 +204,7 @@ NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/dashboard
206
204
  NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/dashboard
207
205
  `);
208
206
  // ── README.md ─────────────────────────────────────────────────────────────
209
- await writeFile(path.join(pkgDir, "README.md"), `# @workspace/auth — Clerk v6
207
+ await writeFile(path.join(pkgDir, "README.md"), `# ${authPackageName} — Clerk v6
210
208
 
211
209
  Shared authentication package powered by [Clerk](https://clerk.com) v6.
212
210
 
@@ -222,13 +220,13 @@ cp packages/auth/.env.example apps/<your-app>/.env.local
222
220
 
223
221
  ### 2. Add the dependency
224
222
  \`\`\`json
225
- { "dependencies": { "@workspace/auth": "workspace:*" } }
223
+ { "dependencies": { "${authPackageName}": "workspace:*" } }
226
224
  \`\`\`
227
225
 
228
226
  ### 3. Wrap your root layout
229
227
  \`\`\`tsx
230
228
  // apps/<your-app>/app/layout.tsx
231
- import { ClerkProvider } from "@workspace/auth/client";
229
+ import { ClerkProvider } from "${authPackageName}/client";
232
230
 
233
231
  export default function RootLayout({ children }: { children: React.ReactNode }) {
234
232
  return (
@@ -243,7 +241,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
243
241
  \`\`\`ts
244
242
  // apps/<your-app>/middleware.ts
245
243
  import type { NextRequest } from "next/server";
246
- import { authMiddleware, middlewareConfig } from "@workspace/auth/next";
244
+ import { authMiddleware, middlewareConfig } from "${authPackageName}/next";
247
245
 
248
246
  export default function middleware(request: NextRequest) {
249
247
  return authMiddleware(request);
@@ -255,13 +253,13 @@ export const config = middlewareConfig;
255
253
  ### 5. Use in your pages
256
254
  \`\`\`tsx
257
255
  // Server component
258
- import { auth, currentUser } from "@workspace/auth/server";
256
+ import { auth, currentUser } from "${authPackageName}/server";
259
257
  const { userId } = await auth();
260
258
  const user = await currentUser();
261
259
 
262
260
  // Client component
263
261
  "use client";
264
- import { useAuth, UserButton, SignedIn, SignedOut } from "@workspace/auth/client";
262
+ import { useAuth, UserButton, SignedIn, SignedOut } from "${authPackageName}/client";
265
263
  const { isSignedIn } = useAuth();
266
264
  \`\`\`
267
265
 
@@ -269,10 +267,10 @@ const { isSignedIn } = useAuth();
269
267
 
270
268
  | Sub-path | Key exports |
271
269
  |---|---|
272
- | \`@workspace/auth/server\` | \`auth()\`, \`currentUser()\`, \`clerkClient()\`, \`getAuth()\` |
273
- | \`@workspace/auth/client\` | \`useAuth\`, \`useUser\`, \`ClerkProvider\`, \`UserButton\`, \`SignedIn\`, \`SignedOut\` |
274
- | \`@workspace/auth/middleware\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
275
- | \`@workspace/auth/next\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
270
+ | \`${authPackageName}/server\` | \`auth()\`, \`currentUser()\`, \`clerkClient()\`, \`getAuth()\` |
271
+ | \`${authPackageName}/client\` | \`useAuth\`, \`useUser\`, \`ClerkProvider\`, \`UserButton\`, \`SignedIn\`, \`SignedOut\` |
272
+ | \`${authPackageName}/middleware\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
273
+ | \`${authPackageName}/next\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
276
274
  `);
277
275
  },
278
276
  };
@@ -1 +1 @@
1
- {"version":3,"file":"clerk.js","sourceRoot":"","sources":["../../../../src/setups/auth/systems/clerk.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGzD,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD,KAAK,EAAE,OAAO;IAEd,0EAA0E;IAC1E,YAAY,EAAE;QACZ,eAAe,EAAO,QAAQ;QAC9B,oBAAoB,EAAE,QAAQ;QAC9B,cAAc,EAAQ,QAAQ;QAC9B,mBAAmB,EAAG,QAAQ;KAC/B;IAED,eAAe,EAAE;QACf,cAAc,EAAE,SAAS;KAC1B;IAED,gBAAgB,EAAE;QAChB,KAAK,EAAQ,YAAY;QACzB,WAAW,EAAE,YAAY;KAC1B;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,KAAyB;QACtD,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAExC,0EAA0E;QAC1E,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,EAC7B;;;;;;;;;;CAUL,CACI,CAAC;QAEF,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAC5B;;;;;;CAML,CACI,CAAC;QAEF,0EAA0E;QAC1E,8EAA8E;QAC9E,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,EAC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AAC,MAAM,EAAE,cAAc,CAAC,EACjC;;;;;;;;;;CAUF,CACE,CAAC;QAEF,6EAA6E;QAC7E,MAAM,SAAS,CACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,EAC9B,KAAK,eAAe;;;;;;;;;;;;;;;;uBAgBA,eAAe;;;;;;iCAML,eAAe;;;;;;;;;;;;;;;oDAeI,eAAe;;;;;;;;;;;;qCAY9B,eAAe;;;;;;4DAMQ,eAAe;;;;;;;;MAQrE,eAAe;MACf,eAAe;MACf,eAAe;MACf,eAAe;CACpB,CACE,CAAC;IACH,CAAC;CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"workos.d.ts","sourceRoot":"","sources":["../../../../src/setups/auth/systems/workos.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAsB,MAAM,aAAa,CAAC;AAE7E,eAAO,MAAM,gBAAgB,EAAE,qBAiU9B,CAAC"}
1
+ {"version":3,"file":"workos.d.ts","sourceRoot":"","sources":["../../../../src/setups/auth/systems/workos.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAsB,MAAM,aAAa,CAAC;AAE7E,eAAO,MAAM,gBAAgB,EAAE,qBAmU9B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import path from "path";
2
2
  import { writeFile, ensureDir } from "../../../files.js";
3
+ import { scopedPackageName } from "../../../config.js";
3
4
  export const workosScaffolder = {
4
5
  label: "WorkOS AuthKit",
5
6
  dependencies: {
@@ -13,21 +14,22 @@ export const workosScaffolder = {
13
14
  react: "^18 || ^19",
14
15
  "react-dom": "^18 || ^19",
15
16
  },
16
- async scaffold(pkgDir, _opts) {
17
+ async scaffold(pkgDir, opts) {
18
+ const authPackageName = scopedPackageName(opts.scope, "auth");
17
19
  await ensureDir(path.join(pkgDir, "."));
18
20
  // ── index.ts ──────────────────────────────────────────────────────────
19
21
  await writeFile(path.join(pkgDir, "index.ts"), `/**
20
- * @workspace/auth — WorkOS AuthKit latest setup.
22
+ * ${authPackageName} — WorkOS AuthKit latest setup.
21
23
  *
22
24
  * Prefer sub-path imports:
23
- * import { getUser, withAuth } from "@workspace/auth/server"
24
- * import { useAuth } from "@workspace/auth/client"
25
- * import { authMiddleware } from "@workspace/auth/next"
25
+ * import { getUser, withAuth } from "${authPackageName}/server"
26
+ * import { useAuth } from "${authPackageName}/client"
27
+ * import { authMiddleware } from "${authPackageName}/next"
26
28
  */
27
29
  export * from "./server.js";
28
30
  export * from "./client.js";
29
31
  `);
30
- await writeFile(path.join(pkgDir, "next.ts"), `/** Next.js adapter for @workspace/auth (WorkOS). */
32
+ await writeFile(path.join(pkgDir, "next.ts"), `/** Next.js adapter for ${authPackageName} (WorkOS). */
31
33
  export {
32
34
  authMiddleware,
33
35
  buildMiddleware,
@@ -45,18 +47,18 @@ export {
45
47
  * - handleAuth() — still the catch-all callback handler
46
48
  *
47
49
  * @example Server Component (manual check)
48
- * import { getUser } from "@workspace/auth/server";
50
+ * import { getUser } from "${authPackageName}/server";
49
51
  * const { user } = await getUser();
50
52
  * if (!user) redirect("/sign-in");
51
53
  *
52
54
  * @example Server Component (HOC — auto-redirects)
53
- * import { withAuth } from "@workspace/auth/server";
55
+ * import { withAuth } from "${authPackageName}/server";
54
56
  * export default withAuth(async function Page({ user }) {
55
57
  * return <h1>Hello {user.firstName}</h1>;
56
58
  * });
57
59
  *
58
60
  * @example Sign-in redirect
59
- * import { getSignInUrl } from "@workspace/auth/server";
61
+ * import { getSignInUrl } from "${authPackageName}/server";
60
62
  * redirect(await getSignInUrl());
61
63
  */
62
64
 
@@ -82,7 +84,7 @@ export type {
82
84
  * Low-level WorkOS Node SDK.
83
85
  * Use for organization management, directory sync, audit logs, etc.
84
86
  *
85
- * import { workos } from "@workspace/auth/server";
87
+ * import { workos } from "${authPackageName}/server";
86
88
  * const orgs = await workos.organizations.listOrganizations();
87
89
  */
88
90
  import WorkOS from "@workos-inc/node";
@@ -102,14 +104,14 @@ export const workosClientId = process.env.WORKOS_CLIENT_ID!;
102
104
  * The AuthKitProvider is required at the root of apps that use useAuth().
103
105
  *
104
106
  * @example Root layout
105
- * import { AuthKitProvider } from "@workspace/auth/client";
107
+ * import { AuthKitProvider } from "${authPackageName}/client";
106
108
  * export default function Layout({ children }) {
107
109
  * return <AuthKitProvider>{children}</AuthKitProvider>;
108
110
  * }
109
111
  *
110
112
  * @example Any client component
111
113
  * "use client";
112
- * import { useAuth } from "@workspace/auth/client";
114
+ * import { useAuth } from "${authPackageName}/client";
113
115
  * const { user, loading, getAccessToken } = useAuth();
114
116
  */
115
117
  "use client";
@@ -127,7 +129,7 @@ export {
127
129
  * Quick start — copy into apps/<your-app>/middleware.ts:
128
130
  *
129
131
  * import type { NextRequest } from "next/server";
130
- * import { authMiddleware, middlewareConfig } from "@workspace/auth/middleware";
132
+ * import { authMiddleware, middlewareConfig } from "${authPackageName}/middleware";
131
133
  *
132
134
  * export default function middleware(request: NextRequest) {
133
135
  * return authMiddleware(request);
@@ -137,9 +139,9 @@ export {
137
139
  *
138
140
  * Custom public paths:
139
141
  *
140
- * import { buildMiddleware } from "@workspace/auth/middleware";
142
+ * import { buildMiddleware } from "${authPackageName}/middleware";
141
143
  * export default buildMiddleware({ unauthenticatedPaths: ["/", "/about"] });
142
- * export { middlewareConfig as config } from "@workspace/auth/middleware";
144
+ * export { middlewareConfig as config } from "${authPackageName}/middleware";
143
145
  */
144
146
  import { authkitMiddleware } from "@workos-inc/authkit-nextjs";
145
147
  import type { AuthkitMiddlewareOptions } from "@workos-inc/authkit-nextjs";
@@ -204,7 +206,7 @@ WORKOS_COOKIE_PASSWORD=REPLACE_WITH_RANDOM_32_CHAR_STRING
204
206
  NEXT_PUBLIC_APP_URL=http://localhost:3000
205
207
  `);
206
208
  // ── README.md ─────────────────────────────────────────────────────────────
207
- await writeFile(path.join(pkgDir, "README.md"), `# @workspace/auth — WorkOS AuthKit v1+
209
+ await writeFile(path.join(pkgDir, "README.md"), `# ${authPackageName} — WorkOS AuthKit v1+
208
210
 
209
211
  Shared authentication powered by [WorkOS AuthKit](https://workos.com/docs/user-management) — enterprise SSO, SCIM, MFA, magic auth, and a hosted sign-in UI.
210
212
 
@@ -225,20 +227,20 @@ Fill in from your [WorkOS Dashboard](https://dashboard.workos.com):
225
227
 
226
228
  ### 2. Add the dependency
227
229
  \`\`\`json
228
- { "dependencies": { "@workspace/auth": "workspace:*" } }
230
+ { "dependencies": { "${authPackageName}": "workspace:*" } }
229
231
  \`\`\`
230
232
 
231
233
  ### 3. Add the callback route
232
234
  \`\`\`ts
233
235
  // apps/<your-app>/app/callback/route.ts
234
- export { handleAuth as GET } from "@workspace/auth/server";
236
+ export { handleAuth as GET } from "${authPackageName}/server";
235
237
  \`\`\`
236
238
 
237
239
  ### 4. Add the middleware
238
240
  \`\`\`ts
239
241
  // apps/<your-app>/middleware.ts
240
242
  import type { NextRequest } from "next/server";
241
- import { authMiddleware, middlewareConfig } from "@workspace/auth/next";
243
+ import { authMiddleware, middlewareConfig } from "${authPackageName}/next";
242
244
 
243
245
  export default function middleware(request: NextRequest) {
244
246
  return authMiddleware(request);
@@ -250,7 +252,7 @@ export const config = middlewareConfig;
250
252
  ### 5. Wrap your layout with AuthKitProvider
251
253
  \`\`\`tsx
252
254
  // apps/<your-app>/app/layout.tsx
253
- import { AuthKitProvider } from "@workspace/auth/client";
255
+ import { AuthKitProvider } from "${authPackageName}/client";
254
256
  export default function Layout({ children }) {
255
257
  return <AuthKitProvider>{children}</AuthKitProvider>;
256
258
  }
@@ -259,22 +261,22 @@ export default function Layout({ children }) {
259
261
  ### 6. Use in your pages
260
262
  \`\`\`tsx
261
263
  // Server component — HOC (auto-redirects if not signed in)
262
- import { withAuth } from "@workspace/auth/server";
264
+ import { withAuth } from "${authPackageName}/server";
263
265
  export default withAuth(async function Page({ user }) {
264
266
  return <h1>Hello, {user.firstName}</h1>;
265
267
  });
266
268
 
267
269
  // Server component — manual
268
- import { getUser } from "@workspace/auth/server";
270
+ import { getUser } from "${authPackageName}/server";
269
271
  const { user } = await getUser();
270
272
 
271
273
  // Client component
272
274
  "use client";
273
- import { useAuth } from "@workspace/auth/client";
275
+ import { useAuth } from "${authPackageName}/client";
274
276
  const { user, loading } = useAuth();
275
277
 
276
278
  // Sign-in redirect page
277
- import { getSignInUrl } from "@workspace/auth/server";
279
+ import { getSignInUrl } from "${authPackageName}/server";
278
280
  import { redirect } from "next/navigation";
279
281
  export default async function SignIn() { redirect(await getSignInUrl()); }
280
282
  \`\`\`
@@ -283,10 +285,10 @@ export default async function SignIn() { redirect(await getSignInUrl()); }
283
285
 
284
286
  | Sub-path | Key exports |
285
287
  |---|---|
286
- | \`@workspace/auth/server\` | \`getUser()\`, \`withAuth()\`, \`getSignInUrl()\`, \`handleAuth\`, \`workos\`, \`signOut()\` |
287
- | \`@workspace/auth/client\` | \`useAuth\`, \`AuthKitProvider\` |
288
- | \`@workspace/auth/middleware\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
289
- | \`@workspace/auth/next\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
288
+ | \`${authPackageName}/server\` | \`getUser()\`, \`withAuth()\`, \`getSignInUrl()\`, \`handleAuth\`, \`workos\`, \`signOut()\` |
289
+ | \`${authPackageName}/client\` | \`useAuth\`, \`AuthKitProvider\` |
290
+ | \`${authPackageName}/middleware\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
291
+ | \`${authPackageName}/next\` | \`authMiddleware\`, \`buildMiddleware()\`, \`middlewareConfig\` |
290
292
  `);
291
293
  },
292
294
  };