novatec-cli 3.0.5 → 3.0.6

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 (2) hide show
  1. package/lib/create.js +52 -5
  2. package/package.json +1 -1
package/lib/create.js CHANGED
@@ -118,18 +118,65 @@ export async function runCreate(nameArg, options) {
118
118
 
119
119
  // ── ARQUITECTURA ──────────────────────────────────────────────────────────────
120
120
  async function applyArchitecture(config, root) {
121
- const beDir = path.join(root, 'backend', 'src');
122
121
  const arch = config.architecture || 'mvc';
123
122
 
124
- const dirs = {
123
+ // Backend
124
+ const beDirs = {
125
125
  mvc: ['controllers', 'models', 'routes', 'middlewares', 'services'],
126
126
  hexagonal: ['domain/entities', 'domain/ports', 'application/usecases', 'infrastructure/adapters', 'infrastructure/repositories', 'interfaces/http'],
127
127
  clean: ['domain/entities', 'domain/usecases', 'data/repositories', 'data/datasources', 'presentation/controllers', 'presentation/routes'],
128
128
  };
129
+ const beBase = path.join(root, 'backend', 'src');
130
+ for (const dir of (beDirs[arch] || beDirs.mvc)) {
131
+ await fse.ensureDir(path.join(beBase, dir));
132
+ await fse.writeFile(path.join(beBase, dir, '.gitkeep'), '');
133
+ }
134
+
135
+ // Frontend — estructura de src según arquitectura
136
+ const feDirs = {
137
+ mvc: [
138
+ 'components',
139
+ 'pages',
140
+ 'services',
141
+ 'hooks',
142
+ 'utils',
143
+ 'assets',
144
+ ],
145
+ hexagonal: [
146
+ 'domain/entities',
147
+ 'domain/ports',
148
+ 'application/usecases',
149
+ 'infrastructure/api',
150
+ 'infrastructure/storage',
151
+ 'presentation/components',
152
+ 'presentation/pages',
153
+ 'presentation/hooks',
154
+ ],
155
+ clean: [
156
+ 'domain/entities',
157
+ 'domain/usecases',
158
+ 'data/repositories',
159
+ 'data/datasources',
160
+ 'presentation/components',
161
+ 'presentation/pages',
162
+ 'presentation/hooks',
163
+ 'core/utils',
164
+ ],
165
+ };
129
166
 
130
- for (const dir of (dirs[arch] || dirs.mvc)) {
131
- await fse.ensureDir(path.join(beDir, dir));
132
- await fse.writeFile(path.join(beDir, dir, '.gitkeep'), '');
167
+ const feBase = path.join(root, 'frontend', 'src');
168
+ // Solo crear si existe el directorio src (algunos frameworks lo generan, otros no)
169
+ if (await fse.pathExists(feBase)) {
170
+ for (const dir of (feDirs[arch] || feDirs.mvc)) {
171
+ await fse.ensureDir(path.join(feBase, dir));
172
+ await fse.writeFile(path.join(feBase, dir, '.gitkeep'), '');
173
+ }
174
+ } else {
175
+ // Si no existe src aún (ej: nuxt, astro), crearlo igual
176
+ for (const dir of (feDirs[arch] || feDirs.mvc)) {
177
+ await fse.ensureDir(path.join(feBase, dir));
178
+ await fse.writeFile(path.join(feBase, dir, '.gitkeep'), '');
179
+ }
133
180
  }
134
181
  }
135
182
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "novatec-cli",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "🚀 NOVATEC FULLSTACK CLI — Generador profesional de proyectos full stack | React, Next.js, Vue, Express, NestJS, FastAPI y más",
5
5
  "type": "module",
6
6
  "main": "./lib/create.js",