create-charcole 2.2.0 → 2.2.2

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 (77) 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 +357 -354
  5. package/bin/index.js +494 -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/BACKWARD_COMPATIBILITY.md +1 -1
  10. package/packages/swagger/CHANGELOG.md +1 -1
  11. package/packages/swagger/README.md +3 -3
  12. package/packages/swagger/package.json +57 -44
  13. package/packages/swagger/src/index.d.ts +126 -126
  14. package/packages/swagger/src/index.js +12 -12
  15. package/packages/swagger/src/setup.js +100 -100
  16. package/template/js/.env.example +16 -15
  17. package/template/js/README.md +982 -978
  18. package/template/js/basePackage.json +26 -26
  19. package/template/js/src/app.js +81 -81
  20. package/template/js/src/config/constants.js +20 -20
  21. package/template/js/src/config/env.js +26 -26
  22. package/template/js/src/config/swagger.config.js +15 -15
  23. package/template/js/src/lib/swagger/SWAGGER_GUIDE.md +3 -3
  24. package/template/js/src/middlewares/errorHandler.js +180 -180
  25. package/template/js/src/middlewares/requestLogger.js +33 -33
  26. package/template/js/src/middlewares/validateRequest.js +42 -42
  27. package/template/js/src/modules/auth/auth.constants.js +3 -3
  28. package/template/js/src/modules/auth/auth.controller.js +29 -29
  29. package/template/js/src/modules/auth/auth.middlewares.js +19 -19
  30. package/template/js/src/modules/auth/auth.routes.js +131 -131
  31. package/template/js/src/modules/auth/auth.schemas.js +60 -60
  32. package/template/js/src/modules/auth/auth.service.js +67 -67
  33. package/template/js/src/modules/auth/package.json +6 -6
  34. package/template/js/src/modules/health/controller.js +151 -151
  35. package/template/js/src/modules/swagger/package.json +5 -5
  36. package/template/js/src/repositories/user.repo.js +19 -19
  37. package/template/js/src/routes/index.js +25 -25
  38. package/template/js/src/routes/protected.js +57 -57
  39. package/template/js/src/server.js +38 -38
  40. package/template/js/src/utils/AppError.js +182 -182
  41. package/template/js/src/utils/logger.js +73 -73
  42. package/template/js/src/utils/response.js +51 -51
  43. package/template/ts/.env.example +16 -15
  44. package/template/ts/README.md +982 -978
  45. package/template/ts/basePackage.json +36 -36
  46. package/template/ts/build.js +46 -46
  47. package/template/ts/src/app.ts +71 -71
  48. package/template/ts/src/config/constants.ts +27 -27
  49. package/template/ts/src/config/env.ts +40 -40
  50. package/template/ts/src/config/swagger.config.ts +30 -30
  51. package/template/ts/src/lib/swagger/SWAGGER_GUIDE.md +2 -2
  52. package/template/ts/src/middlewares/errorHandler.ts +201 -201
  53. package/template/ts/src/middlewares/requestLogger.ts +38 -38
  54. package/template/ts/src/middlewares/validateRequest.ts +46 -46
  55. package/template/ts/src/modules/auth/auth.constants.ts +6 -6
  56. package/template/ts/src/modules/auth/auth.controller.ts +32 -32
  57. package/template/ts/src/modules/auth/auth.middlewares.ts +46 -46
  58. package/template/ts/src/modules/auth/auth.routes.ts +52 -52
  59. package/template/ts/src/modules/auth/auth.schemas.ts +73 -73
  60. package/template/ts/src/modules/auth/auth.service.ts +106 -106
  61. package/template/ts/src/modules/auth/package.json +10 -10
  62. package/template/ts/src/modules/health/controller.ts +80 -80
  63. package/template/ts/src/modules/swagger/package.json +5 -5
  64. package/template/ts/src/repositories/user.repo.ts +33 -33
  65. package/template/ts/src/routes/index.ts +24 -24
  66. package/template/ts/src/routes/protected.ts +46 -46
  67. package/template/ts/src/server.ts +41 -41
  68. package/template/ts/src/types/express.d.ts +9 -9
  69. package/template/ts/src/utils/AppError.ts +220 -220
  70. package/template/ts/src/utils/logger.ts +55 -55
  71. package/template/ts/src/utils/response.ts +100 -100
  72. package/template/ts/tsconfig.json +26 -26
  73. package/packages/swagger/package-lock.json +0 -1715
  74. package/tmpclaude-1049-cwd +0 -1
  75. package/tmpclaude-3e37-cwd +0 -1
  76. package/tmpclaude-4d73-cwd +0 -1
  77. 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
+ }