create-warlock 5.10.0 → 5.11.0

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
@@ -4,6 +4,12 @@ All notable changes to `create-warlock` are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
6
 
7
+ ## 5.11.0 - 2026-09-14
8
+
9
+ ### Removed
10
+
11
+ - The generated `guardedAdmin()` router helper. It only checked that the user was signed in — any user type — while its name and `/admin` prefix implied an admin-only area. New projects get `guarded()` (any authenticated user) and a documented example for restricting a group to a user type. Existing projects keep their own copy of the file; review it if you used `guardedAdmin`.
12
+
7
13
  ## 5.10.0 - 2026-09-14
8
14
 
9
15
  ### Fixed
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@clack/prompts": "^0.7.0",
14
14
  "@mongez/copper": "^2.1.2",
15
- "@warlock.js/fs": "5.10.0",
15
+ "@warlock.js/fs": "5.11.0",
16
16
  "@mongez/reinforcements": "^4.0.1",
17
17
  "cross-spawn": "^7.0.3",
18
18
  "rimraf": "^6.0.1",
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=22.13"
23
23
  },
24
- "version": "5.10.0",
24
+ "version": "5.11.0",
25
25
  "type": "module",
26
26
  "main": "./esm/index.mjs",
27
27
  "module": "./esm/index.mjs",
@@ -67,7 +67,7 @@ onceConnected(async () => {
67
67
 
68
68
  ### 2. routes.ts (Auto-imported)
69
69
 
70
- Main routing file that defines all module endpoints. This file is automatically imported by Warlock.js. Use router guards (`guarded`, `guardedAdmin`, `guardedGuest`, etc.) to protect routes.
70
+ Main routing file that defines all module endpoints. This file is automatically imported by Warlock.js. Use router guards (`guarded`, `guardedGuest`, etc.) to protect routes — `guarded` requires an authenticated user; restrict a group to a specific user type (e.g. an admin-only area) by registering that type in `src/config/auth.ts` and passing it to `authMiddleware` directly, e.g. `authMiddleware(["admin"])`.
71
71
 
72
72
  **Example:**
73
73
 
@@ -531,7 +531,7 @@ export function formatUserName(user: User): string {
531
531
 
532
532
  7. **Routes:**
533
533
 
534
- - Use appropriate guards (`guarded`, `guardedAdmin`, `guardedGuest`)
534
+ - Use appropriate guards (`guarded`, `guardedGuest`); restrict a group to a specific user type via `authMiddleware(["<type>"])`
535
535
  - Group related routes together
536
536
  - Use RESTful resources when appropriate
537
537
  - Routes file is auto-imported by Warlock.js
@@ -10,16 +10,18 @@ export function publicRoutes(callback: () => void) {
10
10
  );
11
11
  }
12
12
 
13
- export function guardedAdmin(callback: () => void) {
14
- router.group(
15
- {
16
- prefix: "/admin",
17
- middleware: [authMiddleware([])],
18
- },
19
- callback,
20
- );
21
- }
22
-
13
+ /**
14
+ * Require an authenticated user of the default `user` type. This scaffold
15
+ * registers only that one type (see `src/config/auth.ts`), so in a fresh
16
+ * project this effectively guards a block for any authenticated user.
17
+ *
18
+ * To restrict a group to a specific user type — for example an admin-only
19
+ * area — register that type in `src/config/auth.ts` and pass it explicitly
20
+ * to `authMiddleware`:
21
+ *
22
+ * @example
23
+ * router.group({ prefix: "/admin", middleware: [authMiddleware(["admin"])] }, callback);
24
+ */
23
25
  export function guarded(callback: () => void) {
24
26
  router.group(
25
27
  {