create-velox-app 0.6.77 → 0.6.78
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 +6 -0
- package/dist/templates/auth.js +3 -3
- package/dist/templates/spa.js +3 -3
- package/dist/templates/trpc.js +3 -3
- package/package.json +1 -1
- package/src/templates/source/api/index.auth.ts +3 -0
- package/src/templates/source/api/index.default.ts +3 -0
- package/src/templates/source/api/index.trpc.ts +3 -0
- package/src/templates/source/api/router.auth.ts +5 -0
- package/src/templates/source/api/router.default.ts +5 -0
- package/src/templates/source/api/router.trpc.ts +5 -0
- package/src/templates/source/api/types.ts +37 -0
- package/src/templates/source/api/types.d.ts +0 -21
package/CHANGELOG.md
CHANGED
package/dist/templates/auth.js
CHANGED
|
@@ -68,8 +68,8 @@ function generateAuthSchema() {
|
|
|
68
68
|
function generateHealthSchema() {
|
|
69
69
|
return compileTemplate('api/schemas/health.ts', AUTH_CONFIG);
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
return compileTemplate('api/types.
|
|
71
|
+
function generateApiTypesTs() {
|
|
72
|
+
return compileTemplate('api/types.ts', AUTH_CONFIG);
|
|
73
73
|
}
|
|
74
74
|
function generateAuthUtils() {
|
|
75
75
|
return compileTemplate('api/utils/auth.ts', AUTH_CONFIG);
|
|
@@ -104,7 +104,7 @@ export function generateAuthTemplate(config) {
|
|
|
104
104
|
{ path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
|
|
105
105
|
{ path: 'apps/api/src/schemas/auth.ts', content: generateAuthSchema() },
|
|
106
106
|
{ path: 'apps/api/src/schemas/health.ts', content: generateHealthSchema() },
|
|
107
|
-
{ path: 'apps/api/src/types.
|
|
107
|
+
{ path: 'apps/api/src/types.ts', content: generateApiTypesTs() },
|
|
108
108
|
{ path: 'apps/api/src/utils/auth.ts', content: generateAuthUtils() },
|
|
109
109
|
];
|
|
110
110
|
// Add docker-compose for PostgreSQL
|
package/dist/templates/spa.js
CHANGED
|
@@ -56,8 +56,8 @@ function generateUserSchema() {
|
|
|
56
56
|
function generateHealthSchema() {
|
|
57
57
|
return compileTemplate('api/schemas/health.ts', DEFAULT_CONFIG);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
return compileTemplate('api/types.
|
|
59
|
+
function generateApiTypesTs() {
|
|
60
|
+
return compileTemplate('api/types.ts', DEFAULT_CONFIG);
|
|
61
61
|
}
|
|
62
62
|
function generateDockerCompose(config) {
|
|
63
63
|
return compileTemplate('api/docker-compose.yml', config);
|
|
@@ -85,7 +85,7 @@ export function generateSpaTemplate(config) {
|
|
|
85
85
|
{ path: 'apps/api/src/procedures/users.ts', content: generateUserProcedures() },
|
|
86
86
|
{ path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
|
|
87
87
|
{ path: 'apps/api/src/schemas/health.ts', content: generateHealthSchema() },
|
|
88
|
-
{ path: 'apps/api/src/types.
|
|
88
|
+
{ path: 'apps/api/src/types.ts', content: generateApiTypesTs() },
|
|
89
89
|
];
|
|
90
90
|
// Add docker-compose for PostgreSQL
|
|
91
91
|
if (config.database === 'postgresql') {
|
package/dist/templates/trpc.js
CHANGED
|
@@ -64,8 +64,8 @@ function generateUserSchema() {
|
|
|
64
64
|
function generateHealthSchema() {
|
|
65
65
|
return compileTemplate('api/schemas/health.ts', DEFAULT_CONFIG);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return compileTemplate('api/types.
|
|
67
|
+
function generateApiTypesTs() {
|
|
68
|
+
return compileTemplate('api/types.ts', DEFAULT_CONFIG);
|
|
69
69
|
}
|
|
70
70
|
function generateDockerCompose(config) {
|
|
71
71
|
return compileTemplate('api/docker-compose.yml', config);
|
|
@@ -93,7 +93,7 @@ export function generateTrpcTemplate(config) {
|
|
|
93
93
|
{ path: 'apps/api/src/procedures/users.ts', content: generateUserProcedures() },
|
|
94
94
|
{ path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
|
|
95
95
|
{ path: 'apps/api/src/schemas/health.ts', content: generateHealthSchema() },
|
|
96
|
-
{ path: 'apps/api/src/types.
|
|
96
|
+
{ path: 'apps/api/src/types.ts', content: generateApiTypesTs() },
|
|
97
97
|
];
|
|
98
98
|
// Add docker-compose for PostgreSQL
|
|
99
99
|
if (config.database === 'postgresql') {
|
package/package.json
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* The server entry point (index.ts) handles environment setup.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
// Triple-slash reference ensures TypeScript processes our type augmentations
|
|
13
|
+
// for BaseContext and User before type-checking procedures.
|
|
14
|
+
// This is NOT a runtime import - it only affects type checking.
|
|
15
|
+
/// <reference path="./types.ts" />
|
|
16
|
+
|
|
12
17
|
import { createRouter, extractRoutes } from '@veloxts/velox';
|
|
13
18
|
|
|
14
19
|
import { authProcedures } from './procedures/auth.js';
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* The server entry point (index.ts) handles environment setup.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
// Triple-slash reference ensures TypeScript processes our type augmentations
|
|
13
|
+
// for BaseContext (e.g., ctx.db) before type-checking procedures.
|
|
14
|
+
// This is NOT a runtime import - it only affects type checking.
|
|
15
|
+
/// <reference path="./types.ts" />
|
|
16
|
+
|
|
12
17
|
import { createRouter, extractRoutes } from '@veloxts/velox';
|
|
13
18
|
|
|
14
19
|
import { healthProcedures } from './procedures/health.js';
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* The server entry point (index.ts) handles environment setup.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
// Triple-slash reference ensures TypeScript processes our type augmentations
|
|
13
|
+
// for BaseContext (e.g., ctx.db) before type-checking procedures.
|
|
14
|
+
// This is NOT a runtime import - it only affects type checking.
|
|
15
|
+
/// <reference path="./types.ts" />
|
|
16
|
+
|
|
12
17
|
import { createRouter } from '@veloxts/velox';
|
|
13
18
|
|
|
14
19
|
import { healthProcedures } from './procedures/health.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for VeloxTS application
|
|
3
|
+
*
|
|
4
|
+
* This file uses declaration merging to extend the framework's base types
|
|
5
|
+
* with application-specific properties:
|
|
6
|
+
*
|
|
7
|
+
* - `ctx.db`: Typed PrismaClient for database access in procedure handlers
|
|
8
|
+
* - `ctx.user.name`: Additional user field from your Prisma schema
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT: This file must be imported (side-effect import) in your entry
|
|
11
|
+
* point to ensure the declaration merging is processed by TypeScript.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // In your index.ts entry point:
|
|
16
|
+
* import './types.js'; // Side-effect import for declaration merging
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { PrismaClient } from '@prisma/client';
|
|
21
|
+
|
|
22
|
+
declare module '@veloxts/core' {
|
|
23
|
+
interface BaseContext {
|
|
24
|
+
db: PrismaClient;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Extend User interface to include name field from Prisma model
|
|
29
|
+
declare module '@veloxts/auth' {
|
|
30
|
+
interface User {
|
|
31
|
+
name?: string;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// This export ensures the file is treated as a module, not a script.
|
|
36
|
+
// Without an export, TypeScript may not process the declaration merging correctly.
|
|
37
|
+
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type declarations for VeloxTS application
|
|
3
|
-
*
|
|
4
|
-
* Extends the base context with the specific Prisma client types.
|
|
5
|
-
* This enables full autocomplete for ctx.db in procedure handlers.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { PrismaClient } from '@prisma/client';
|
|
9
|
-
|
|
10
|
-
declare module '@veloxts/core' {
|
|
11
|
-
interface BaseContext {
|
|
12
|
-
db: PrismaClient;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Extend User interface to include name field from Prisma model
|
|
17
|
-
declare module '@veloxts/auth' {
|
|
18
|
-
interface User {
|
|
19
|
-
name?: string;
|
|
20
|
-
}
|
|
21
|
-
}
|