create-wabck 1.0.0 → 1.1.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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ npm create wabck@latest my-api
23
23
  | 🔐 Auth | JWT, Clerk, Firebase, None |
24
24
  | ✅ Validation | Zod, Joi, Express Validator |
25
25
  | 🔗 API Style | REST or GraphQL (Apollo Server 4) |
26
- | 📖 Docs | Swagger / OpenAPI 3 |
26
+ | 📖 Docs | Swagger UI + openapi.yaml (OpenAPI 3.0) |
27
27
  | 🐳 Docker | Multi-stage Dockerfile + docker-compose |
28
28
  | ⚡ Package managers | npm, pnpm, yarn, bun |
29
29
 
@@ -53,6 +53,7 @@ my-api/
53
53
  │ ├── graphql/ (GraphQL only)
54
54
  │ ├── app.js
55
55
  │ └── server.js
56
+ ├── openapi.yaml (optional, OpenAPI 3.0 YAML spec)
56
57
  ├── .env.example
57
58
  ├── .prettierrc
58
59
  ├── eslint.config.js
@@ -73,6 +74,9 @@ my-api/
73
74
  | POST | `/api/v1/auth/register` | Register (JWT) |
74
75
  | POST | `/api/v1/auth/login` | Login (JWT) |
75
76
  | GET | `/api/v1/auth/me` | Profile (JWT) |
77
+ | GET | `/api-docs` | Swagger UI (Interactive Docs) |
78
+ | GET | `/api-docs.yaml` | OpenAPI 3.0 YAML Spec |
79
+ | GET | `/api-docs.json` | OpenAPI 3.0 JSON Spec |
76
80
 
77
81
  ## 📜 License
78
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wabck",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Scaffold production-ready Express.js backends in seconds",
5
5
  "type": "module",
6
6
  "bin": {
@@ -40,9 +40,5 @@
40
40
  "graphql"
41
41
  ],
42
42
  "author": "w4simz",
43
- "license": "MIT",
44
- "repository": {
45
- "type": "git",
46
- "url": ""
47
- }
43
+ "license": "MIT"
48
44
  }
package/src/generator.js CHANGED
@@ -20,7 +20,7 @@ import * as T from './templates/index.js';
20
20
  * @returns {Promise<string>} - Absolute path to the created project
21
21
  */
22
22
  export async function generate(options) {
23
- const { projectName, language, database, auth, validation, apiStyle, docker } = options;
23
+ const { projectName, language, database, auth, validation, apiStyle, docker, swagger } = options;
24
24
  const isTS = language === 'typescript';
25
25
  const ext = isTS ? 'ts' : 'js';
26
26
  const hasDB = database !== 'none';
@@ -28,6 +28,7 @@ export async function generate(options) {
28
28
  const hasJwt = auth === 'jwt';
29
29
  const isGql = apiStyle === 'graphql';
30
30
  const hasValidation = validation && validation !== 'none';
31
+ const hasSwagger = swagger === true;
31
32
 
32
33
  const projectDir = path.resolve(process.cwd(), projectName);
33
34
  const createdDirs = [];
@@ -93,6 +94,9 @@ export async function generate(options) {
93
94
  await write('.prettierrc', T.prettierrc());
94
95
  await write('eslint.config.js', T.eslintConfig(options));
95
96
  await write('README.md', T.readme(options));
97
+ if (hasSwagger) {
98
+ await write('openapi.yaml', T.swaggerYaml(options));
99
+ }
96
100
 
97
101
  // ── TypeScript extras ─────────────────────────────────────────────────
98
102
  if (isTS) {
@@ -107,6 +111,9 @@ export async function generate(options) {
107
111
  // ── Config ────────────────────────────────────────────────────────────
108
112
  await write(`src/config/db.${ext}`, T.db(options));
109
113
  await write(`src/config/env.${ext}`, T.envConfig(options));
114
+ if (hasSwagger) {
115
+ await write(`src/config/swagger.${ext}`, T.swaggerConfig(options));
116
+ }
110
117
 
111
118
  // ── Routes ────────────────────────────────────────────────────────────
112
119
  await write(`src/routes/index.${ext}`, T.routesIndex(options));
package/src/index.js CHANGED
@@ -73,10 +73,10 @@ async function main() {
73
73
  // ─────────────────────────────────────────────────────────────────────────────
74
74
 
75
75
  function printSuccessSummary(options, projectDir) {
76
- const { projectName, language, database, auth, validation, docker, packageManager, installDeps } = options;
76
+ const { projectName, language, database, auth, validation, docker, swagger, packageManager, installDeps } = options;
77
77
  const pm = packageManager;
78
78
  const relDir = path.relative(process.cwd(), projectDir) || projectName;
79
- const devCmd = language === 'typescript' ? `${pm} run dev` : `${pm} run dev`;
79
+ const devCmd = `${pm} run dev`;
80
80
 
81
81
  // Progress recap
82
82
  log.success('Project scaffolded successfully!');
@@ -85,7 +85,8 @@ function printSuccessSummary(options, projectDir) {
85
85
  log.label(' Database', database === 'none' ? 'None' : database);
86
86
  log.label(' Auth', auth === 'none' ? 'None' : auth);
87
87
  if (validation && validation !== 'none') log.label(' Validation', validation);
88
- if (docker) log.label(' Docker', 'Dockerfile + docker-compose.yml');
88
+ if (swagger) log.label(' OpenAPI Docs', 'Swagger UI → /api-docs (openapi.yaml)');
89
+ if (docker) log.label(' Docker', 'Dockerfile + docker-compose.yml');
89
90
  log.blank();
90
91
 
91
92
  // Next steps
package/src/prompts.js CHANGED
@@ -62,7 +62,7 @@ export async function runPrompts(initialName) {
62
62
  choices: [
63
63
  { name: `${chalk.yellow('JWT')} — jsonwebtoken + bcryptjs`, value: 'jwt' },
64
64
  { name: `${chalk.blue('Clerk')} — @clerk/express`, value: 'clerk' },
65
- { name: `${chalk.orange?.('Firebase') || chalk.red('Firebase')} — firebase-admin`, value: 'firebase' },
65
+ { name: `${chalk.hex('#FFA500')('Firebase')} — firebase-admin`, value: 'firebase' },
66
66
  { name: `${chalk.dim('None')} — no auth`, value: 'none' },
67
67
  ],
68
68
  });
@@ -93,12 +93,19 @@ export async function runPrompts(initialName) {
93
93
  default: true,
94
94
  });
95
95
 
96
- // 9. Install Dependencies
96
+ // 9. Swagger / OpenAPI docs
97
+ const swagger = await confirm({
98
+ message: 'Include Swagger / OpenAPI 3 docs? (served at /api-docs)',
99
+ default: true,
100
+ });
101
+
102
+ // 10. Install Dependencies
97
103
  const installDeps = await confirm({
98
104
  message: `Install dependencies now with ${chalk.cyan(packageManager)}?`,
99
105
  default: true,
100
106
  });
101
107
 
108
+
102
109
  return {
103
110
  projectName: projectName.trim(),
104
111
  language,
@@ -108,6 +115,7 @@ export async function runPrompts(initialName) {
108
115
  validation,
109
116
  apiStyle,
110
117
  docker,
118
+ swagger,
111
119
  installDeps,
112
120
  };
113
121
  }