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,49 +1,49 @@
1
- const { execSync } = require("child_process");
2
- const fs = require("fs");
3
- const path = require("path");
4
-
5
- /**
6
- * Detect which package manager the user is using
7
- * Priority: pnpm > yarn > npm
8
- */
9
- function detectPackageManager() {
10
- const userAgent = process.env.npm_config_user_agent;
11
-
12
- if (userAgent) {
13
- if (userAgent.includes("pnpm")) return "pnpm";
14
- if (userAgent.includes("yarn")) return "yarn";
15
- if (userAgent.includes("npm")) return "npm";
16
- }
17
-
18
- const lockFiles = {
19
- "pnpm-lock.yaml": "pnpm",
20
- "yarn.lock": "yarn",
21
- "package-lock.json": "npm",
22
- };
23
-
24
- for (const [lockFile, manager] of Object.entries(lockFiles)) {
25
- if (fs.existsSync(path.join(process.cwd(), lockFile))) {
26
- return manager;
27
- }
28
- }
29
-
30
- return "npm";
31
- }
32
-
33
- /**
34
- * Install dependencies
35
- */
36
- function installDependencies(targetDir, pkgManager) {
37
- const installCmd =
38
- pkgManager === "yarn" ? "yarn install" : `${pkgManager} install`;
39
-
40
- execSync(installCmd, {
41
- cwd: targetDir,
42
- stdio: "inherit",
43
- });
44
- }
45
-
46
- module.exports = {
47
- detectPackageManager,
48
- installDependencies,
49
- };
1
+ const { execSync } = require("child_process");
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+
5
+ /**
6
+ * Detect which package manager the user is using
7
+ * Priority: pnpm > yarn > npm
8
+ */
9
+ function detectPackageManager() {
10
+ const userAgent = process.env.npm_config_user_agent;
11
+
12
+ if (userAgent) {
13
+ if (userAgent.includes("pnpm")) return "pnpm";
14
+ if (userAgent.includes("yarn")) return "yarn";
15
+ if (userAgent.includes("npm")) return "npm";
16
+ }
17
+
18
+ const lockFiles = {
19
+ "pnpm-lock.yaml": "pnpm",
20
+ "yarn.lock": "yarn",
21
+ "package-lock.json": "npm",
22
+ };
23
+
24
+ for (const [lockFile, manager] of Object.entries(lockFiles)) {
25
+ if (fs.existsSync(path.join(process.cwd(), lockFile))) {
26
+ return manager;
27
+ }
28
+ }
29
+
30
+ return "npm";
31
+ }
32
+
33
+ /**
34
+ * Install dependencies
35
+ */
36
+ function installDependencies(targetDir, pkgManager) {
37
+ const installCmd =
38
+ pkgManager === "yarn" ? "yarn install" : `${pkgManager} install`;
39
+
40
+ execSync(installCmd, {
41
+ cwd: targetDir,
42
+ stdio: "inherit",
43
+ });
44
+ }
45
+
46
+ module.exports = {
47
+ detectPackageManager,
48
+ installDependencies,
49
+ };
@@ -1,33 +1,33 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- /**
5
- * Recursively copy directory contents, excluding specific files
6
- */
7
- function copyDir(src, dest, excludeFiles = []) {
8
- if (!fs.existsSync(dest)) {
9
- fs.mkdirSync(dest, { recursive: true });
10
- }
11
-
12
- const entries = fs.readdirSync(src, { withFileTypes: true });
13
-
14
- for (const entry of entries) {
15
- const srcPath = path.join(src, entry.name);
16
- const destPath = path.join(dest, entry.name);
17
-
18
- // Skip excluded files
19
- if (excludeFiles.includes(entry.name)) {
20
- continue;
21
- }
22
-
23
- if (entry.isDirectory()) {
24
- copyDir(srcPath, destPath, excludeFiles);
25
- } else {
26
- fs.copyFileSync(srcPath, destPath);
27
- }
28
- }
29
- }
30
-
31
- module.exports = {
32
- copyDir,
33
- };
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ /**
5
+ * Recursively copy directory contents, excluding specific files
6
+ */
7
+ function copyDir(src, dest, excludeFiles = []) {
8
+ if (!fs.existsSync(dest)) {
9
+ fs.mkdirSync(dest, { recursive: true });
10
+ }
11
+
12
+ const entries = fs.readdirSync(src, { withFileTypes: true });
13
+
14
+ for (const entry of entries) {
15
+ const srcPath = path.join(src, entry.name);
16
+ const destPath = path.join(dest, entry.name);
17
+
18
+ // Skip excluded files
19
+ if (excludeFiles.includes(entry.name)) {
20
+ continue;
21
+ }
22
+
23
+ if (entry.isDirectory()) {
24
+ copyDir(srcPath, destPath, excludeFiles);
25
+ } else {
26
+ fs.copyFileSync(srcPath, destPath);
27
+ }
28
+ }
29
+ }
30
+
31
+ module.exports = {
32
+ copyDir,
33
+ };
package/package.json CHANGED
@@ -1,27 +1,42 @@
1
- {
2
- "name": "create-charcole",
3
- "version": "2.2.0",
4
- "description": "CLI to create production-ready Node.js Express APIs with TypeScript/JavaScript, JWT auth, auto-generated Swagger docs, and repository pattern",
5
- "license": "MIT",
6
- "author": {
7
- "name": "Sheraz Manzoor",
8
- "email": "sheraz.dev121@gmail.com"
9
- },
10
- "bin": {
11
- "create-charcole": "bin/index.js"
12
- },
13
- "keywords": [
14
- "express",
15
- "backend",
16
- "starter",
17
- "boilerplate",
18
- "production",
19
- "charcole"
20
- ],
21
- "engines": {
22
- "node": ">=16"
23
- },
24
- "dependencies": {
25
- "prompts": "^2.4.2"
26
- }
27
- }
1
+ {
2
+ "name": "create-charcole",
3
+ "version": "2.2.1",
4
+ "description": "CLI to create production-ready Node.js Express APIs with TypeScript/JavaScript, JWT auth, auto-generated Swagger docs, and repository pattern",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Sheraz Manzoor",
8
+ "email": "sheraz.dev121@gmail.com"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/sheraz4196/create-charcole.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/sheraz4196/create-charcole/issues"
16
+ },
17
+ "homepage": "https://www.charcole.site/",
18
+ "bin": {
19
+ "create-charcole": "bin/index.js"
20
+ },
21
+ "keywords": [
22
+ "express",
23
+ "backend",
24
+ "starter",
25
+ "boilerplate",
26
+ "production",
27
+ "charcole",
28
+ "nodejs starter",
29
+ "express starter",
30
+ "typescript backend",
31
+ "swagger",
32
+ "backend template",
33
+ "api-boilerplate",
34
+ "zod validation"
35
+ ],
36
+ "engines": {
37
+ "node": ">=16"
38
+ },
39
+ "dependencies": {
40
+ "prompts": "^2.4.2"
41
+ }
42
+ }