vasuzex 2.0.10 → 2.0.11
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.
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
generateDatabaseConfigTemplate,
|
|
21
21
|
generateEnvHelperTemplate,
|
|
22
22
|
generateApiEnvTemplate,
|
|
23
|
+
generateJSConfigTemplate,
|
|
23
24
|
} from './apiTemplates.js';
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -127,6 +128,12 @@ export async function generateCompleteAPIStructure(targetDir) {
|
|
|
127
128
|
await generateAPIRequests(targetDir);
|
|
128
129
|
await generateAPIRoutes(targetDir);
|
|
129
130
|
await generateDatabaseConfig(targetDir);
|
|
131
|
+
|
|
132
|
+
// Generate jsconfig.json for path aliases
|
|
133
|
+
await writeFileContent(
|
|
134
|
+
join(targetDir, 'jsconfig.json'),
|
|
135
|
+
generateJSConfigTemplate()
|
|
136
|
+
);
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
/**
|
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
* Templates for API-specific files (controllers, models, routes, etc.)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Generate jsconfig.json with path aliases
|
|
8
|
+
*/
|
|
9
|
+
export function generateJSConfigTemplate() {
|
|
10
|
+
return `{
|
|
11
|
+
"compilerOptions": {
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"paths": {
|
|
14
|
+
"@root/*": ["../../../../*"],
|
|
15
|
+
"@database/*": ["../../../../database/*"],
|
|
16
|
+
"@models/*": ["../../../../database/models/*"],
|
|
17
|
+
"@config/*": ["./config/*"],
|
|
18
|
+
"@src/*": ["./src/*"],
|
|
19
|
+
"@controllers/*": ["./src/controllers/*"],
|
|
20
|
+
"@services/*": ["./src/services/*"],
|
|
21
|
+
"@middleware/*": ["./src/middleware/*"],
|
|
22
|
+
"@routes/*": ["./src/routes/*"],
|
|
23
|
+
"@requests/*": ["./src/requests/*"],
|
|
24
|
+
"@helpers/*": ["./src/helpers/*"]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"exclude": ["node_modules"]
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
|
|
6
32
|
/**
|
|
7
33
|
* Generate BaseController
|
|
8
34
|
*/
|
|
@@ -226,7 +252,7 @@ export function generateAuthServiceTemplate() {
|
|
|
226
252
|
|
|
227
253
|
import bcrypt from 'bcryptjs';
|
|
228
254
|
import jwt from 'jsonwebtoken';
|
|
229
|
-
import User from '
|
|
255
|
+
import User from '@models/User.js';
|
|
230
256
|
|
|
231
257
|
export class AuthService {
|
|
232
258
|
/**
|
|
@@ -327,7 +353,7 @@ export function generateAuthMiddlewareTemplate() {
|
|
|
327
353
|
*/
|
|
328
354
|
|
|
329
355
|
import { AuthService } from '../services/AuthService.js';
|
|
330
|
-
import User from '
|
|
356
|
+
import User from '@models/User.js';
|
|
331
357
|
|
|
332
358
|
export async function authMiddleware(req, res, next) {
|
|
333
359
|
try {
|