create-charcole 2.2.0 → 2.2.1

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 (72) hide show
  1. package/.github/workflows/release.yml +26 -26
  2. package/CHANGELOG.md +301 -301
  3. package/LICENSE +21 -21
  4. package/README.md +354 -354
  5. package/bin/index.js +444 -444
  6. package/bin/lib/pkgManager.js +49 -49
  7. package/bin/lib/templateHandler.js +33 -33
  8. package/package.json +42 -27
  9. package/packages/swagger/package-lock.json +1715 -1715
  10. package/packages/swagger/package.json +57 -44
  11. package/packages/swagger/src/index.d.ts +126 -126
  12. package/packages/swagger/src/index.js +12 -12
  13. package/packages/swagger/src/setup.js +100 -100
  14. package/template/js/.env.example +15 -15
  15. package/template/js/README.md +978 -978
  16. package/template/js/basePackage.json +26 -26
  17. package/template/js/src/app.js +81 -81
  18. package/template/js/src/config/constants.js +20 -20
  19. package/template/js/src/config/env.js +26 -26
  20. package/template/js/src/config/swagger.config.js +15 -15
  21. package/template/js/src/middlewares/errorHandler.js +180 -180
  22. package/template/js/src/middlewares/requestLogger.js +33 -33
  23. package/template/js/src/middlewares/validateRequest.js +42 -42
  24. package/template/js/src/modules/auth/auth.constants.js +3 -3
  25. package/template/js/src/modules/auth/auth.controller.js +29 -29
  26. package/template/js/src/modules/auth/auth.middlewares.js +19 -19
  27. package/template/js/src/modules/auth/auth.routes.js +131 -131
  28. package/template/js/src/modules/auth/auth.schemas.js +60 -60
  29. package/template/js/src/modules/auth/auth.service.js +67 -67
  30. package/template/js/src/modules/auth/package.json +6 -6
  31. package/template/js/src/modules/health/controller.js +151 -151
  32. package/template/js/src/modules/swagger/package.json +5 -5
  33. package/template/js/src/repositories/user.repo.js +19 -19
  34. package/template/js/src/routes/index.js +25 -25
  35. package/template/js/src/routes/protected.js +57 -57
  36. package/template/js/src/server.js +38 -38
  37. package/template/js/src/utils/AppError.js +182 -182
  38. package/template/js/src/utils/logger.js +73 -73
  39. package/template/js/src/utils/response.js +51 -51
  40. package/template/ts/.env.example +15 -15
  41. package/template/ts/README.md +978 -978
  42. package/template/ts/basePackage.json +36 -36
  43. package/template/ts/build.js +46 -46
  44. package/template/ts/src/app.ts +71 -71
  45. package/template/ts/src/config/constants.ts +27 -27
  46. package/template/ts/src/config/env.ts +40 -40
  47. package/template/ts/src/config/swagger.config.ts +30 -30
  48. package/template/ts/src/middlewares/errorHandler.ts +201 -201
  49. package/template/ts/src/middlewares/requestLogger.ts +38 -38
  50. package/template/ts/src/middlewares/validateRequest.ts +46 -46
  51. package/template/ts/src/modules/auth/auth.constants.ts +6 -6
  52. package/template/ts/src/modules/auth/auth.controller.ts +32 -32
  53. package/template/ts/src/modules/auth/auth.middlewares.ts +46 -46
  54. package/template/ts/src/modules/auth/auth.routes.ts +52 -52
  55. package/template/ts/src/modules/auth/auth.schemas.ts +73 -73
  56. package/template/ts/src/modules/auth/auth.service.ts +106 -106
  57. package/template/ts/src/modules/auth/package.json +10 -10
  58. package/template/ts/src/modules/health/controller.ts +80 -80
  59. package/template/ts/src/modules/swagger/package.json +5 -5
  60. package/template/ts/src/repositories/user.repo.ts +33 -33
  61. package/template/ts/src/routes/index.ts +24 -24
  62. package/template/ts/src/routes/protected.ts +46 -46
  63. package/template/ts/src/server.ts +41 -41
  64. package/template/ts/src/types/express.d.ts +9 -9
  65. package/template/ts/src/utils/AppError.ts +220 -220
  66. package/template/ts/src/utils/logger.ts +55 -55
  67. package/template/ts/src/utils/response.ts +100 -100
  68. package/template/ts/tsconfig.json +26 -26
  69. package/tmpclaude-1049-cwd +0 -1
  70. package/tmpclaude-3e37-cwd +0 -1
  71. package/tmpclaude-4d73-cwd +0 -1
  72. package/tmpclaude-8a8e-cwd +0 -1
@@ -1,100 +1,100 @@
1
- import type { Response } from "express";
2
-
3
- /**
4
- * Standard success response shape
5
- */
6
- export type SuccessResponse<T> = {
7
- success: true;
8
- message: string;
9
- data: T;
10
- timestamp: string;
11
- };
12
-
13
- /**
14
- * Send success response
15
- */
16
- export const sendSuccess = <T>(
17
- res: Response,
18
- data: T,
19
- statusCode = 200,
20
- message = "Success",
21
- ): Response<SuccessResponse<T>> => {
22
- return res.status(statusCode).json({
23
- success: true,
24
- message,
25
- data,
26
- timestamp: new Date().toISOString(),
27
- });
28
- };
29
-
30
- /**
31
- * Error response shape (legacy)
32
- */
33
- type ErrorResponse = {
34
- success: false;
35
- message: string;
36
- errors?: unknown;
37
- timestamp: string;
38
- };
39
-
40
- /**
41
- * Send error response (DEPRECATED — use AppError instead)
42
- * Kept for backward compatibility
43
- */
44
- export const sendError = (
45
- res: Response,
46
- message: string,
47
- statusCode = 500,
48
- errors: unknown = null,
49
- ): Response<ErrorResponse> => {
50
- return res.status(statusCode).json({
51
- success: false,
52
- message,
53
- ...(errors !== null && { errors }),
54
- timestamp: new Date().toISOString(),
55
- });
56
- };
57
-
58
- /**
59
- * Validation error item (Zod / Joi–style compatible)
60
- */
61
- type ValidationIssue = {
62
- path: (string | number)[];
63
- message: string;
64
- code?: string;
65
- };
66
-
67
- /**
68
- * Validation error response shape
69
- */
70
- type ValidationErrorResponse = {
71
- success: false;
72
- message: string;
73
- errors: {
74
- field: string;
75
- message: string;
76
- code?: string;
77
- }[];
78
- timestamp: string;
79
- };
80
-
81
- /**
82
- * Send validation error response (DEPRECATED — use ValidationError instead)
83
- * Kept for backward compatibility
84
- */
85
- export const sendValidationError = (
86
- res: Response,
87
- errors: ValidationIssue[],
88
- statusCode = 422,
89
- ): Response<ValidationErrorResponse> => {
90
- return res.status(statusCode).json({
91
- success: false,
92
- message: "Validation failed",
93
- errors: errors.map((err) => ({
94
- field: err.path.join("."),
95
- message: err.message,
96
- code: err.code,
97
- })),
98
- timestamp: new Date().toISOString(),
99
- });
100
- };
1
+ import type { Response } from "express";
2
+
3
+ /**
4
+ * Standard success response shape
5
+ */
6
+ export type SuccessResponse<T> = {
7
+ success: true;
8
+ message: string;
9
+ data: T;
10
+ timestamp: string;
11
+ };
12
+
13
+ /**
14
+ * Send success response
15
+ */
16
+ export const sendSuccess = <T>(
17
+ res: Response,
18
+ data: T,
19
+ statusCode = 200,
20
+ message = "Success",
21
+ ): Response<SuccessResponse<T>> => {
22
+ return res.status(statusCode).json({
23
+ success: true,
24
+ message,
25
+ data,
26
+ timestamp: new Date().toISOString(),
27
+ });
28
+ };
29
+
30
+ /**
31
+ * Error response shape (legacy)
32
+ */
33
+ type ErrorResponse = {
34
+ success: false;
35
+ message: string;
36
+ errors?: unknown;
37
+ timestamp: string;
38
+ };
39
+
40
+ /**
41
+ * Send error response (DEPRECATED — use AppError instead)
42
+ * Kept for backward compatibility
43
+ */
44
+ export const sendError = (
45
+ res: Response,
46
+ message: string,
47
+ statusCode = 500,
48
+ errors: unknown = null,
49
+ ): Response<ErrorResponse> => {
50
+ return res.status(statusCode).json({
51
+ success: false,
52
+ message,
53
+ ...(errors !== null && { errors }),
54
+ timestamp: new Date().toISOString(),
55
+ });
56
+ };
57
+
58
+ /**
59
+ * Validation error item (Zod / Joi–style compatible)
60
+ */
61
+ type ValidationIssue = {
62
+ path: (string | number)[];
63
+ message: string;
64
+ code?: string;
65
+ };
66
+
67
+ /**
68
+ * Validation error response shape
69
+ */
70
+ type ValidationErrorResponse = {
71
+ success: false;
72
+ message: string;
73
+ errors: {
74
+ field: string;
75
+ message: string;
76
+ code?: string;
77
+ }[];
78
+ timestamp: string;
79
+ };
80
+
81
+ /**
82
+ * Send validation error response (DEPRECATED — use ValidationError instead)
83
+ * Kept for backward compatibility
84
+ */
85
+ export const sendValidationError = (
86
+ res: Response,
87
+ errors: ValidationIssue[],
88
+ statusCode = 422,
89
+ ): Response<ValidationErrorResponse> => {
90
+ return res.status(statusCode).json({
91
+ success: false,
92
+ message: "Validation failed",
93
+ errors: errors.map((err) => ({
94
+ field: err.path.join("."),
95
+ message: err.message,
96
+ code: err.code,
97
+ })),
98
+ timestamp: new Date().toISOString(),
99
+ });
100
+ };
@@ -1,26 +1,26 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "rootDir": "./src",
7
- "outDir": "./dist",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "skipLibCheck": true,
12
- "resolveJsonModule": true,
13
- "allowJs": false,
14
- "noEmitOnError": false,
15
- "sourceMap": true,
16
- "declaration": false,
17
- "allowImportingTsExtensions": true,
18
- "noEmit": true
19
- },
20
- "include": ["src/**/*"],
21
- "exclude": ["node_modules", "dist"],
22
- "ts-node": {
23
- "esm": true,
24
- "experimentalSpecifierResolution": "node"
25
- }
26
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "rootDir": "./src",
7
+ "outDir": "./dist",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "skipLibCheck": true,
12
+ "resolveJsonModule": true,
13
+ "allowJs": false,
14
+ "noEmitOnError": false,
15
+ "sourceMap": true,
16
+ "declaration": false,
17
+ "allowImportingTsExtensions": true,
18
+ "noEmit": true
19
+ },
20
+ "include": ["src/**/*"],
21
+ "exclude": ["node_modules", "dist"],
22
+ "ts-node": {
23
+ "esm": true,
24
+ "experimentalSpecifierResolution": "node"
25
+ }
26
+ }
@@ -1 +0,0 @@
1
- /e/SAFEZONE/charcole
@@ -1 +0,0 @@
1
- /e/SAFEZONE/charcole
@@ -1 +0,0 @@
1
- /e/SAFEZONE/charcole
@@ -1 +0,0 @@
1
- /e/SAFEZONE/charcole