create-charcole 2.2.1 → 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.
package/CHANGELOG.md CHANGED
@@ -5,7 +5,7 @@ All notable changes to Charcole will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [2.2.1] – 2026-02-06
8
+ ## [2.2.2] – 2026-02-06
9
9
 
10
10
  ### 🎉 Major Release: Auto-Generated Swagger Documentation
11
11
 
package/README.md CHANGED
@@ -349,6 +349,9 @@ We welcome contributions! Please:
349
349
  6. Update README.md for significant changes
350
350
  7. If adding Swagger docs, use Zod schemas as single source of truth
351
351
 
352
+
353
+ Good luck!!!
354
+
352
355
  ## 📄 License
353
356
 
354
357
  ISC
package/bin/index.js CHANGED
@@ -233,14 +233,14 @@ function copyDirRecursive(src, dest, excludeFiles = [], excludeDirs = []) {
233
233
  const swaggerPkgPath = path.join(swaggerModuleDir, "package.json");
234
234
  const swaggerTgzPath = path.join(
235
235
  swaggerModuleDir,
236
- "charcole-swagger-1.0.0.tgz",
236
+ "charcole-swagger-1.0.1.tgz",
237
237
  );
238
238
 
239
239
  // Copy tarball temporarily for npm install (will be cleaned up after)
240
240
  if (fs.existsSync(swaggerTgzPath)) {
241
241
  fs.copyFileSync(
242
242
  swaggerTgzPath,
243
- path.join(targetDir, "charcole-swagger-1.0.0.tgz"),
243
+ path.join(targetDir, "charcole-swagger-1.0.1.tgz"),
244
244
  );
245
245
  console.log("✓ Copied Swagger tarball temporarily for installation");
246
246
  } else {
@@ -418,12 +418,62 @@ function copyDirRecursive(src, dest, excludeFiles = [], excludeDirs = []) {
418
418
  Object.keys(mergedPkg.devDependencies || {}).join(", "),
419
419
  );
420
420
 
421
+ // Create .env from .env.example and ensure APP_NAME default exists
422
+ try {
423
+ const exampleEnvPath = path.join(targetDir, ".env.example");
424
+ const envPath = path.join(targetDir, ".env");
425
+
426
+ if (fs.existsSync(exampleEnvPath) && !fs.existsSync(envPath)) {
427
+ let exampleContent = fs.readFileSync(exampleEnvPath, "utf-8");
428
+
429
+ if (!/APP_NAME\s*=/.test(exampleContent)) {
430
+ exampleContent = `APP_NAME=CHARCOLE API\n` + exampleContent;
431
+ }
432
+
433
+ fs.writeFileSync(envPath, exampleContent, "utf-8");
434
+ console.log("✓ Created .env from .env.example with default APP_NAME");
435
+ }
436
+ } catch (err) {
437
+ console.warn("⚠️ Failed to create .env automatically:", err.message);
438
+ }
439
+
440
+ // Initialize git repository to make project git-friendly
441
+ try {
442
+ const { execSync } = require("child_process");
443
+
444
+ execSync("git --version", { stdio: "ignore" });
445
+ execSync("git init", { cwd: targetDir, stdio: "ignore" });
446
+
447
+ // Ensure .gitignore exists (copy from template if missing)
448
+ const gitignoreSrc = path.join(templateDir, ".gitignore");
449
+ const gitignoreDest = path.join(targetDir, ".gitignore");
450
+ if (!fs.existsSync(gitignoreDest) && fs.existsSync(gitignoreSrc)) {
451
+ fs.copyFileSync(gitignoreSrc, gitignoreDest);
452
+ }
453
+
454
+ // Stage files and attempt initial commit; ignore commit errors (e.g., missing git user config)
455
+ try {
456
+ execSync("git add .", { cwd: targetDir, stdio: "ignore" });
457
+ execSync('git commit -m "chore: initial commit from Charcole"', {
458
+ cwd: targetDir,
459
+ stdio: "ignore",
460
+ });
461
+ console.log("✓ Initialized git repository and created initial commit");
462
+ } catch (commitErr) {
463
+ console.log(
464
+ "✓ Initialized git repository (skipped commit — configure git user to enable commits)",
465
+ );
466
+ }
467
+ } catch (gitErr) {
468
+ console.log("ℹ️ Git not available; skipping repository initialization");
469
+ }
470
+
421
471
  console.log(`\n📦 Installing dependencies using ${pkgManager}...`);
422
472
  installDependencies(targetDir, pkgManager);
423
473
 
424
474
  // Clean up the swagger tarball after installation
425
475
  if (swagger) {
426
- const tgzPath = path.join(targetDir, "charcole-swagger-1.0.0.tgz");
476
+ const tgzPath = path.join(targetDir, "charcole-swagger-1.0.1.tgz");
427
477
  if (fs.existsSync(tgzPath)) {
428
478
  fs.unlinkSync(tgzPath);
429
479
  console.log("✓ Cleaned up temporary Swagger tarball");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-charcole",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "CLI to create production-ready Node.js Express APIs with TypeScript/JavaScript, JWT auth, auto-generated Swagger docs, and repository pattern",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -9,10 +9,10 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/sheraz4196/create-charcole.git"
12
+ "url": "https://github.com/sheraz4196/charcole.git"
13
13
  },
14
14
  "bugs": {
15
- "url": "https://github.com/sheraz4196/create-charcole/issues"
15
+ "url": "https://github.com/sheraz4196/charcole/issues"
16
16
  },
17
17
  "homepage": "https://www.charcole.site/",
18
18
  "bin": {
@@ -37,7 +37,7 @@ Old setup without new options:
37
37
  ```typescript
38
38
  setupSwagger(app, {
39
39
  title: "My API",
40
- version: "1.0.0",
40
+ version: "1.0.1",
41
41
  });
42
42
  ```
43
43
 
@@ -121,7 +121,7 @@ import {
121
121
  setupSwagger(app, {
122
122
  // Old options (still work)
123
123
  title: "My API",
124
- version: "1.0.0",
124
+ version: "1.0.1",
125
125
  path: "/api-docs",
126
126
  servers: [...],
127
127
 
@@ -30,7 +30,7 @@ const app = express();
30
30
 
31
31
  setupSwagger(app, {
32
32
  title: "My API",
33
- version: "1.0.0",
33
+ version: "1.0.1",
34
34
  schemas: {
35
35
  createUserSchema, // Auto-converted from Zod!
36
36
  loginSchema,
@@ -107,7 +107,7 @@ Sets up Swagger UI and documentation generation.
107
107
  | Option | Type | Default | Description |
108
108
  | ------------------------ | ------- | ---------------------------------- | ----------------------------------- |
109
109
  | `title` | string | "Charcole API" | API title |
110
- | `version` | string | "1.0.0" | API version |
110
+ | `version` | string | "1.0.1" | API version |
111
111
  | `description` | string | "Auto-generated API documentation" | API description |
112
112
  | `path` | string | "/api-docs" | Swagger UI path |
113
113
  | `servers` | array | `[{url: "http://localhost:3000"}]` | Server URLs |
@@ -267,7 +267,7 @@ const app: Application = express();
267
267
 
268
268
  const options: SwaggerOptions = {
269
269
  title: "My API",
270
- version: "1.0.0",
270
+ version: "1.0.1",
271
271
  schemas: {
272
272
  mySchema,
273
273
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoles/swagger",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Auto-generated Swagger documentation for Charcole APIs",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -17,11 +17,11 @@
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "https://github.com/sheraz4196/create-charcole.git",
20
+ "url": "https://github.com/sheraz4196/charcole.git",
21
21
  "directory": "packages/swagger"
22
22
  },
23
23
  "bugs": {
24
- "url": "https://github.com/sheraz4196/create-charcole/issues"
24
+ "url": "https://github.com/sheraz4196/charcole/issues"
25
25
  },
26
26
  "homepage": "https://www.charcole.site/guides/swagger/introduction",
27
27
  "scripts": {
@@ -7,7 +7,7 @@ import { registerSchemas, getCommonResponses } from "./helpers.js";
7
7
  export function setupSwagger(app, options = {}) {
8
8
  const defaultOptions = {
9
9
  title: "Charcole API",
10
- version: "1.0.0",
10
+ version: "1.0.1",
11
11
  description: "Auto-generated API documentation",
12
12
  path: "/api-docs",
13
13
  servers: [{ url: "http://localhost:3000", description: "Local server" }],
@@ -1,4 +1,5 @@
1
1
  # Server Configuration
2
+ APP_NAME=CHARCOLE API
2
3
  NODE_ENV=development
3
4
  PORT=3000
4
5
 
@@ -34,9 +34,13 @@ Welcome! This guide will help you set up and start using the Charcole API framew
34
34
 
35
35
  2. **Create environment file**
36
36
 
37
- ```bash
38
- cp .env.example .env
39
- ```
37
+ The `create-charcole` CLI will automatically create a `.env` from `.env.example` and initialize a Git repository for you. Edit the generated `.env` as needed.
38
+
39
+ If you prefer to create it manually:
40
+
41
+ ```bash
42
+ cp .env.example .env
43
+ ```
40
44
 
41
45
  3. **Run the charcole**
42
46
  ```bash
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "charcole",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Production-grade Node.js Express API",
5
5
  "main": "src/server.js",
6
6
  "type": "module",
@@ -56,7 +56,7 @@ app.get(
56
56
  res,
57
57
  {
58
58
  message: "Welcome to Charcole API",
59
- version: "1.0.0",
59
+ version: "1.0.1",
60
60
  environment: env.NODE_ENV,
61
61
  },
62
62
  200,
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  title: process.env.APP_NAME || "Charcole API",
3
- version: process.env.APP_VERSION || "1.0.0",
3
+ version: process.env.APP_VERSION || "1.0.1",
4
4
  description: "Production-ready Node.js Express API",
5
5
  path: "/api-docs",
6
6
  servers: [
@@ -18,8 +18,8 @@ import { createItemSchema } from "../modules/health/controller.ts";
18
18
 
19
19
  const swaggerConfig = {
20
20
  title: "My API",
21
- version: "1.0.0",
22
- // Auto-register schemas - they'll be converted to OpenAPI automatically!
21
+ version: "1.0.1",
22
+ // Auto-register schemas - they'll be converted to OpenAPI automatically!
23
23
  schemas: {
24
24
  registerSchema,
25
25
  loginSchema,
@@ -472,7 +472,7 @@ const app = express();
472
472
 
473
473
  setupSwagger(app, {
474
474
  title: "My API",
475
- version: "1.0.0",
475
+ version: "1.0.1",
476
476
  schemas: {
477
477
  mySchema, // Your Zod schemas
478
478
  },
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "dependencies": {
3
- "@charcoles/swagger": "file:./charcole-swagger-1.0.0.tgz"
3
+ "@charcoles/swagger": "file:./charcole-swagger-1.0.1.tgz"
4
4
  }
5
5
  }
@@ -1,4 +1,5 @@
1
1
  # Server Configuration
2
+ APP_NAME=CHARCOLE API
2
3
  NODE_ENV=development
3
4
  PORT=3000
4
5
 
@@ -34,9 +34,13 @@ Welcome! This guide will help you set up and start using the Charcole API framew
34
34
 
35
35
  2. **Create environment file**
36
36
 
37
- ```bash
38
- cp .env.example .env
39
- ```
37
+ The `create-charcole` CLI will automatically create a `.env` from `.env.example` and initialize a Git repository for you. Edit the generated `.env` as needed.
38
+
39
+ If you prefer to create it manually:
40
+
41
+ ```bash
42
+ cp .env.example .env
43
+ ```
40
44
 
41
45
  3. **Run the charcole**
42
46
  ```bash
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "charcole",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Production-grade Node.js Express API",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
@@ -3,7 +3,7 @@ import { createItemSchema } from "../modules/health/controller.ts";
3
3
 
4
4
  const swaggerConfig = {
5
5
  title: process.env.APP_NAME || "Charcole API",
6
- version: process.env.APP_VERSION || "1.0.0",
6
+ version: process.env.APP_VERSION || "1.0.1",
7
7
  description: "Production-ready Node.js Express API",
8
8
  path: "/api-docs",
9
9
  servers: [
@@ -18,7 +18,7 @@ import { createItemSchema } from "../modules/health/controller.ts";
18
18
 
19
19
  const swaggerConfig = {
20
20
  title: "My API",
21
- version: "1.0.0",
21
+ version: "1.0.1",
22
22
  // Auto-register schemas - they'll be converted to OpenAPI automatically!
23
23
  schemas: {
24
24
  registerSchema,
@@ -472,7 +472,7 @@ const app = express();
472
472
 
473
473
  setupSwagger(app, {
474
474
  title: "My API",
475
- version: "1.0.0",
475
+ version: "1.0.1",
476
476
  schemas: {
477
477
  mySchema, // Your Zod schemas
478
478
  },
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "dependencies": {
3
- "@charcoles/swagger": "file:./charcole-swagger-1.0.0.tgz"
3
+ "@charcoles/swagger": "file:./charcole-swagger-1.0.1.tgz"
4
4
  }
5
5
  }