vako 1.3.14 → 1.3.16

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.
@@ -106,36 +106,105 @@ class SetupExecutor {
106
106
  }
107
107
 
108
108
  getDirectoriesForTemplate() {
109
- const baseDirectories = [
110
- 'views',
111
- 'views/layouts',
112
- 'views/partials',
113
- 'views/components',
114
- 'routes',
115
- 'routes/api',
116
- 'public',
117
- 'public/css',
118
- 'public/js',
119
- 'public/images',
120
- 'config',
121
- 'middleware',
122
- 'plugins',
123
- 'data',
124
- 'utils'
125
- ];
126
-
127
- const templateDirectories = {
128
- blog: ['content', 'content/posts', 'admin', 'uploads'],
129
- admin: ['admin', 'admin/views', 'dashboard'],
130
- ecommerce: ['shop', 'products', 'orders', 'cart'],
131
- portfolio: ['portfolio', 'projects', 'gallery'],
132
- pwa: ['pwa', 'sw', 'manifest', 'offline']
133
- };
109
+ const { codeType } = this.config;
110
+
111
+ // Structure de base pour EJS
112
+ if (codeType === 'ejs' || !codeType) {
113
+ const baseDirectories = [
114
+ 'views',
115
+ 'views/layouts',
116
+ 'views/partials',
117
+ 'views/components',
118
+ 'routes',
119
+ 'routes/api',
120
+ 'public',
121
+ 'public/css',
122
+ 'public/js',
123
+ 'public/images',
124
+ 'config',
125
+ 'middleware',
126
+ 'plugins',
127
+ 'data',
128
+ 'utils',
129
+ 'locales' // Dossier pour les traductions
130
+ ];
131
+
132
+ const templateDirectories = {
133
+ blog: ['content', 'content/posts', 'admin', 'uploads'],
134
+ admin: ['admin', 'admin/views', 'dashboard'],
135
+ ecommerce: ['shop', 'products', 'orders', 'cart'],
136
+ portfolio: ['portfolio', 'projects', 'gallery'],
137
+ pwa: ['pwa', 'sw', 'manifest', 'offline']
138
+ };
139
+
140
+ return [
141
+ ...baseDirectories,
142
+ ...(templateDirectories[this.config.template] || [])
143
+ ];
144
+ }
145
+
146
+ // Structure pour TypeScript
147
+ if (codeType === 'typescript') {
148
+ const baseDirectories = [
149
+ 'src',
150
+ 'src/routes',
151
+ 'src/routes/api',
152
+ 'src/middleware',
153
+ 'src/utils',
154
+ 'src/types',
155
+ 'src/config',
156
+ 'views',
157
+ 'views/layouts',
158
+ 'public',
159
+ 'public/css',
160
+ 'public/js',
161
+ 'public/images',
162
+ 'config',
163
+ 'plugins',
164
+ 'data'
165
+ ];
166
+
167
+ const templateDirectories = {
168
+ blog: ['src/content', 'src/admin', 'uploads'],
169
+ admin: ['src/admin', 'src/dashboard'],
170
+ ecommerce: ['src/shop', 'src/products', 'src/orders'],
171
+ portfolio: ['src/portfolio', 'src/projects', 'src/gallery']
172
+ };
173
+
174
+ return [
175
+ ...baseDirectories,
176
+ ...(templateDirectories[this.config.template] || [])
177
+ ];
178
+ }
179
+
180
+ // Structure pour Next.js
181
+ if (codeType === 'nextjs') {
182
+ const baseDirectories = [
183
+ 'src',
184
+ 'src/app',
185
+ 'src/app/api',
186
+ 'src/components',
187
+ 'src/lib',
188
+ 'src/types',
189
+ 'public',
190
+ 'public/images',
191
+ 'config',
192
+ 'plugins'
193
+ ];
194
+
195
+ const templateDirectories = {
196
+ blog: ['src/app/blog', 'src/app/admin', 'src/content'],
197
+ admin: ['src/app/admin', 'src/app/dashboard'],
198
+ portfolio: ['src/app/portfolio', 'src/app/projects']
199
+ };
200
+
201
+ return [
202
+ ...baseDirectories,
203
+ ...(templateDirectories[this.config.template] || [])
204
+ ];
205
+ }
134
206
 
135
- return [
136
- ...baseDirectories,
137
- ...(templateDirectories[this.config.template] || [])
138
- ];
207
+ return [];
139
208
  }
140
209
 
141
210
  async generateTemplateFiles() {
@@ -168,8 +237,11 @@ class SetupExecutor {
168
237
  }
169
238
 
170
239
  generateEjsFiles() {
171
- const { projectName, description, author, license } = this.config;
240
+ const { projectName, description, author, license, language } = this.config;
172
241
  const files = {};
242
+
243
+ // Générer les fichiers de traduction selon la langue
244
+ const translations = this.getTranslations(language);
173
245
 
174
246
  // package.json
175
247
  files['package.json'] = JSON.stringify({
@@ -245,8 +317,9 @@ module.exports = router;
245
317
  `;
246
318
 
247
319
  // views/index.ejs
320
+ const langAttr = language === 'multi' ? 'fr' : language;
248
321
  files['views/index.ejs'] = `<!DOCTYPE html>
249
- <html lang="en">
322
+ <html lang="${langAttr}">
250
323
  <head>
251
324
  <meta charset="UTF-8">
252
325
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -254,11 +327,30 @@ module.exports = router;
254
327
  </head>
255
328
  <body>
256
329
  <h1><%= title %></h1>
257
- <p>Welcome to your Vako application!</p>
330
+ <p>${translations.welcome || 'Welcome to your Vako application!'}</p>
258
331
  </body>
259
332
  </html>
260
333
  `;
261
334
 
335
+ // Créer les fichiers de traduction
336
+ if (language === 'multi') {
337
+ files['locales/fr.json'] = JSON.stringify({
338
+ welcome: 'Bienvenue dans votre application Vako!',
339
+ title: 'Bienvenue sur ${projectName}'
340
+ }, null, 2);
341
+ files['locales/en.json'] = JSON.stringify({
342
+ welcome: 'Welcome to your Vako application!',
343
+ title: 'Welcome to ${projectName}'
344
+ }, null, 2);
345
+ files['locales/es.json'] = JSON.stringify({
346
+ welcome: '¡Bienvenido a tu aplicación Vako!',
347
+ title: 'Bienvenido a ${projectName}'
348
+ }, null, 2);
349
+ } else {
350
+ // Fichier de traduction pour une seule langue
351
+ files[`locales/${language}.json`] = JSON.stringify(translations, null, 2);
352
+ }
353
+
262
354
  // public/css/style.css
263
355
  files['public/css/style.css'] = `body {
264
356
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
@@ -718,6 +810,48 @@ module.exports = router;
718
810
  }
719
811
  }
720
812
 
813
+ getTranslations(language) {
814
+ const translations = {
815
+ fr: {
816
+ welcome: 'Bienvenue dans votre application Vako!',
817
+ title: 'Bienvenue sur',
818
+ description: 'Une application web moderne construite avec Vako'
819
+ },
820
+ en: {
821
+ welcome: 'Welcome to your Vako application!',
822
+ title: 'Welcome to',
823
+ description: 'A modern web application built with Vako'
824
+ },
825
+ es: {
826
+ welcome: '¡Bienvenido a tu aplicación Vako!',
827
+ title: 'Bienvenido a',
828
+ description: 'Una aplicación web moderna construida con Vako'
829
+ },
830
+ de: {
831
+ welcome: 'Willkommen in Ihrer Vako-Anwendung!',
832
+ title: 'Willkommen bei',
833
+ description: 'Eine moderne Webanwendung, die mit Vako erstellt wurde'
834
+ },
835
+ it: {
836
+ welcome: 'Benvenuto nella tua applicazione Vako!',
837
+ title: 'Benvenuto in',
838
+ description: 'Un\'applicazione web moderna costruita con Vako'
839
+ },
840
+ pt: {
841
+ welcome: 'Bem-vindo à sua aplicação Vako!',
842
+ title: 'Bem-vindo a',
843
+ description: 'Uma aplicação web moderna construída com Vako'
844
+ },
845
+ nl: {
846
+ welcome: 'Welkom bij uw Vako-applicatie!',
847
+ title: 'Welkom bij',
848
+ description: 'Een moderne webapplicatie gebouwd met Vako'
849
+ }
850
+ };
851
+
852
+ return translations[language] || translations.en;
853
+ }
854
+
721
855
  sleep(ms) {
722
856
  return new Promise(resolve => setTimeout(resolve, ms));
723
857
  }
@@ -18,6 +18,7 @@ class SetupWizard {
18
18
  projectName: '',
19
19
  template: 'default',
20
20
  codeType: 'ejs', // 'ejs', 'typescript', 'nextjs'
21
+ language: 'fr', // 'fr', 'en', 'es', 'de', etc.
21
22
  features: [],
22
23
  database: 'sqlite',
23
24
  auth: { enabled: false },
@@ -92,6 +93,8 @@ class SetupWizard {
92
93
  console.clear();
93
94
  await this.showWelcome();
94
95
  await this.gatherProjectInfo();
96
+ await this.selectCodeType();
97
+ await this.selectLanguage();
95
98
  await this.selectTemplate();
96
99
  await this.selectFeatures();
97
100
  await this.configureDatabase();
@@ -248,6 +251,72 @@ class SetupWizard {
248
251
  console.log(chalk.gray(`\n✓ Selected: ${selectedChoice.description}\n`));
249
252
  }
250
253
 
254
+ /**
255
+ * Sélection de la langue du site
256
+ */
257
+ async selectLanguage() {
258
+ console.log(chalk.blue.bold('\n🌍 Choose Your Site Language\n'));
259
+
260
+ const languageChoices = [
261
+ {
262
+ name: '🇫🇷 Français - French',
263
+ value: 'fr',
264
+ description: 'French language for your site'
265
+ },
266
+ {
267
+ name: '🇬🇧 English - English',
268
+ value: 'en',
269
+ description: 'English language for your site'
270
+ },
271
+ {
272
+ name: '🇪🇸 Español - Spanish',
273
+ value: 'es',
274
+ description: 'Spanish language for your site'
275
+ },
276
+ {
277
+ name: '🇩🇪 Deutsch - German',
278
+ value: 'de',
279
+ description: 'German language for your site'
280
+ },
281
+ {
282
+ name: '🇮🇹 Italiano - Italian',
283
+ value: 'it',
284
+ description: 'Italian language for your site'
285
+ },
286
+ {
287
+ name: '🇵🇹 Português - Portuguese',
288
+ value: 'pt',
289
+ description: 'Portuguese language for your site'
290
+ },
291
+ {
292
+ name: '🇳🇱 Nederlands - Dutch',
293
+ value: 'nl',
294
+ description: 'Dutch language for your site'
295
+ },
296
+ {
297
+ name: '🌐 Multi-language - Multiple languages',
298
+ value: 'multi',
299
+ description: 'Support for multiple languages'
300
+ }
301
+ ];
302
+
303
+ const { language } = await inquirer.prompt([{
304
+ type: 'list',
305
+ name: 'language',
306
+ message: '🌍 Select the language for your site:',
307
+ choices: languageChoices.map(choice => ({
308
+ name: choice.name,
309
+ value: choice.value
310
+ })),
311
+ pageSize: 10
312
+ }]);
313
+
314
+ this.config.language = language;
315
+
316
+ const selectedChoice = languageChoices.find(c => c.value === language);
317
+ console.log(chalk.gray(`\n✓ Selected: ${selectedChoice.description}\n`));
318
+ }
319
+
251
320
  /**
252
321
  * Sélection du template de projet
253
322
  */
@@ -584,12 +653,31 @@ class SetupWizard {
584
653
  * Génération du résumé de configuration
585
654
  */
586
655
  generateSummary() {
587
- const { projectName, template, features, database, auth, plugins, styling, theme } = this.config;
656
+ const { projectName, template, features, database, auth, plugins, styling, theme, codeType, language } = this.config;
657
+
658
+ const codeTypeLabels = {
659
+ 'ejs': '📄 EJS',
660
+ 'typescript': '📘 TypeScript',
661
+ 'nextjs': '⚛️ Next.js'
662
+ };
663
+
664
+ const languageLabels = {
665
+ 'fr': '🇫🇷 Français',
666
+ 'en': '🇬🇧 English',
667
+ 'es': '🇪🇸 Español',
668
+ 'de': '🇩🇪 Deutsch',
669
+ 'it': '🇮🇹 Italiano',
670
+ 'pt': '🇵🇹 Português',
671
+ 'nl': '🇳🇱 Nederlands',
672
+ 'multi': '🌐 Multi-language'
673
+ };
588
674
 
589
675
  return chalk.white(`
590
676
  🏷️ Project: ${chalk.cyan.bold(projectName)}
591
677
  📝 Description: ${chalk.gray(this.config.description)}
592
678
  👤 Author: ${chalk.green(this.config.author)}
679
+ 💻 Code Type: ${chalk.cyan(codeTypeLabels[codeType] || codeType)}
680
+ 🌍 Language: ${chalk.magenta(languageLabels[language] || language)}
593
681
  🎨 Template: ${chalk.yellow(template)}
594
682
  🗄️ Database: ${chalk.blue(database)}
595
683
  🔐 Auth: ${chalk.magenta(auth.enabled ? '✅ Enabled' : '❌ Disabled')}
package/bin/vako.js CHANGED
@@ -21,7 +21,7 @@ const program = new Command();
21
21
  program
22
22
  .name('vako')
23
23
  .description('Vako Framework CLI')
24
- .version('1.3.14');
24
+ .version('1.3.16');
25
25
 
26
26
  // ============= DEV COMMAND =============
27
27
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vako",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "description": "🚀 Ultra-modern Node.js framework with hot reload, plugins, authentication, TypeScript support, and Next.js integration",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",