create-velox-app 0.6.69 → 0.6.71

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/cli.js +35 -13
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # create-velox-app
2
2
 
3
+ ## 0.6.71
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(create): add template shorthand flags (--auth, --rsc, etc.) (#20)
8
+
9
+ ## 0.6.70
10
+
11
+ ### Patch Changes
12
+
13
+ - ### feat(auth): Unified Adapter-Only Architecture
14
+
15
+ **New Features:**
16
+
17
+ - Add `JwtAdapter` implementing the `AuthAdapter` interface for unified JWT authentication
18
+ - Add `jwtAuth()` convenience function for direct adapter usage with optional built-in routes (`/api/auth/refresh`, `/api/auth/logout`)
19
+ - Add `AuthContext` discriminated union (`NativeAuthContext | AdapterAuthContext`) for type-safe auth mode handling
20
+ - Add double-registration protection to prevent conflicting auth system setups
21
+ - Add shared decoration utilities (`decorateAuth`, `setRequestAuth`, `checkDoubleRegistration`)
22
+
23
+ **Architecture Changes:**
24
+
25
+ - `authPlugin` now uses `JwtAdapter` internally - all authentication flows through the adapter pattern
26
+ - Single code path for authentication (no more dual native/adapter modes)
27
+ - `authContext.authMode` is now always `'adapter'` with `providerId='jwt'` when using `authPlugin`
28
+
29
+ **Breaking Changes:**
30
+
31
+ - Remove deprecated `LegacySessionConfig` interface (use `sessionMiddleware` instead)
32
+ - Remove deprecated `session` field from `AuthConfig`
33
+ - `User` interface no longer has index signature (extend via declaration merging)
34
+
35
+ **Type Safety Improvements:**
36
+
37
+ - `AuthContext` discriminated union enables exhaustive type narrowing based on `authMode`
38
+ - Export `NativeAuthContext` and `AdapterAuthContext` types for explicit typing
39
+
40
+ **Migration:**
41
+
42
+ - Existing `authPlugin` usage remains backward-compatible
43
+ - If checking `authContext.token`, use `authContext.session` instead (token stored in session for adapter mode)
44
+
3
45
  ## 0.6.69
4
46
 
5
47
  ### Patch Changes
package/dist/cli.js CHANGED
@@ -42,28 +42,36 @@ Options:
42
42
  -h, --help Show this help message
43
43
  -v, --version Show version number
44
44
 
45
- Templates:
46
- spa ${TEMPLATE_METADATA.spa.description}
47
- auth ${TEMPLATE_METADATA.auth.description}
48
- trpc ${TEMPLATE_METADATA.trpc.description}
49
- rsc ${TEMPLATE_METADATA.rsc.description}
50
- rsc-auth ${TEMPLATE_METADATA['rsc-auth'].description}
45
+ Template Shortcuts:
46
+ --spa ${TEMPLATE_METADATA.spa.description}
47
+ --auth ${TEMPLATE_METADATA.auth.description}
48
+ --trpc ${TEMPLATE_METADATA.trpc.description}
49
+ --rsc ${TEMPLATE_METADATA.rsc.description}
50
+ --rsc-auth ${TEMPLATE_METADATA['rsc-auth'].description}
51
+ --default Alias for --spa
52
+ --fullstack Alias for --rsc
51
53
 
52
54
  Databases:
53
55
  sqlite ${DATABASE_METADATA.sqlite.hint}
54
56
  postgresql ${DATABASE_METADATA.postgresql.hint}
55
57
 
56
- Aliases:
57
- default → spa (backward compatible)
58
- fullstack → rsc (backward compatible)
59
-
60
58
  Examples:
61
59
  npx create-velox-app my-app # Interactive mode
60
+ npx create-velox-app my-app --auth # Auth template (shortcut)
61
+ npx create-velox-app my-app --rsc -d postgresql # RSC with PostgreSQL
62
62
  npx create-velox-app my-app --template=spa # SPA + API template
63
- npx create-velox-app my-app --database=postgresql # Use PostgreSQL
64
- npx create-velox-app my-app -t rsc -d postgresql # RSC with PostgreSQL
65
- npx create-velox-app # Prompt for name
63
+ npx create-velox-app # Prompt for all options
66
64
  `;
65
+ /** Template shorthand flags (--auth, --spa, etc.) */
66
+ const TEMPLATE_FLAGS = new Set([
67
+ '--spa',
68
+ '--auth',
69
+ '--trpc',
70
+ '--rsc',
71
+ '--rsc-auth',
72
+ '--default', // alias for spa
73
+ '--fullstack', // alias for rsc
74
+ ]);
67
75
  /** @internal Exported for testing */
68
76
  export function parseArgs(args) {
69
77
  const result = {
@@ -80,6 +88,20 @@ export function parseArgs(args) {
80
88
  result.help = true;
81
89
  continue;
82
90
  }
91
+ // Handle template shorthand flags (--auth, --spa, --rsc, etc.)
92
+ if (TEMPLATE_FLAGS.has(arg)) {
93
+ if (templateFlagSeen) {
94
+ console.error('Error: Template specified multiple times');
95
+ process.exit(1);
96
+ }
97
+ templateFlagSeen = true;
98
+ const templateName = arg.slice(2); // Remove '--' prefix
99
+ const resolved = resolveTemplateAlias(templateName);
100
+ if (resolved) {
101
+ result.template = resolved;
102
+ }
103
+ continue;
104
+ }
83
105
  // Handle --version / -v
84
106
  if (arg === '-v' || arg === '--version') {
85
107
  result.version = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-velox-app",
3
- "version": "0.6.69",
3
+ "version": "0.6.71",
4
4
  "description": "Project scaffolder for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",