@arcpkg/initiator 0.0.1-beta.0.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 ADDED
@@ -0,0 +1,524 @@
1
+ # @arcpkg/initiator
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
+ ![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-007ACC)
5
+ ![React](https://img.shields.io/badge/React-18+-61DAFB)
6
+ ![React Router](https://img.shields.io/badge/React%20Router-6+-CA4245)
7
+
8
+ **@arcpkg/initiator** est un plugin d'initialisation intelligent pour les applications React avec TypeScript/Javascript. Il génère automatiquement les fichiers de configuration, de routage, d'internationalisation et de providers basés sur la structure de votre projet.
9
+
10
+ ## ✨ Fonctionnalités Principales
11
+
12
+ ### 🗺️ Génération Automatique
13
+ - **Génération automatique des routes** à partir de la structure du système de fichiers
14
+ - **Configuration modulaire** avec détection automatique des modules
15
+ - **Internationalisation automatisée** avec extraction des clés de traduction
16
+ - **Providers React organisés** par module et priorité
17
+ - **Fichiers de configuration** générés dynamiquement
18
+
19
+ ### ⚙️ Initialisation Intelligente
20
+ - **Détection automatique** des fichiers de pages, modules et providers
21
+ - **Génération de fichiers TypeScript** typesafe
22
+ - **Support des layouts hiérarchiques** avec héritage automatique
23
+ - **Organisation automatique des providers** (Context, Redux, Router, etc.)
24
+ - **Configuration minimale** requise
25
+
26
+ ### 📁 Structure de Projet
27
+ - **Organisation modulaire** naturelle
28
+ - **Support des pages spéciales** (layout, error, 404)
29
+ - **Routes dynamiques** avec paramètres
30
+ - **Modules indépendants** avec leur propre configuration et providers
31
+ - **Providers globaux et par module** hiérarchisés
32
+
33
+ ## 📦 Installation
34
+
35
+ ### Installation globale (recommandée)
36
+ ```bash
37
+ npm install -g @arcpkg/initiator
38
+ # ou
39
+ yarn global add @arcpkg/initiator
40
+ # ou
41
+ pnpm add -g @arcpkg/initiator
42
+ ```
43
+
44
+ ### Installation locale
45
+ ```bash
46
+ npm install @arcpkg/initiator
47
+ # ou
48
+ yarn add @arcpkg/initiator
49
+ # ou
50
+ pnpm add @arcpkg/initiator
51
+ ```
52
+
53
+ ## 🚀 Utilisation Rapide
54
+
55
+ ### Commande de base
56
+ ```bash
57
+ # Depuis la racine de votre projet
58
+ arc-init
59
+ # ou
60
+ npx @arcpkg/initiator
61
+ ```
62
+
63
+ ### Options disponibles
64
+ ```bash
65
+ # Initialiser avec un répertoire spécifique
66
+ arc-init --dir ./mon-projet
67
+
68
+ # Forcer la régénération des fichiers
69
+ arc-init --force
70
+
71
+ # Mode silencieux (moins de logs)
72
+ arc-init --quiet
73
+
74
+ # Afficher l'aide
75
+ arc-init --help
76
+ ```
77
+
78
+ ### Structure de projet générée
79
+ ```
80
+ src/
81
+ ├── auto-config.ts # Configuration générée
82
+ ├── auto-intl.ts # Internationalisation générée
83
+ ├── auto-routes.tsx # Routes générées
84
+ ├── auto-provider.tsx # Providers organisés
85
+ ├── config.json # Configuration racine
86
+ ├── locales/
87
+ │ ├── en.json # Traductions anglais
88
+ │ └── fr.json # Traductions français
89
+ ├── providers/ # Providers globaux
90
+ │ ├── RouterProvider.tsx
91
+ │ ├── ReduxProvider.tsx
92
+ │ ├── ThemeProvider.tsx
93
+ │ └── AuthProvider.tsx
94
+ ├── pages/
95
+ │ ├── _layout.tsx # Layout racine
96
+ │ ├── _error.tsx # Page d'erreur
97
+ │ ├── _404.tsx # Page 404
98
+ │ └── index.tsx # Page d'accueil
99
+ └── modules/
100
+ └── example/
101
+ ├── config.json # Configuration du module
102
+ ├── locales/
103
+ │ ├── en.json # Traductions module
104
+ │ └── fr.json # Traductions module
105
+ ├── providers/ # Providers du module
106
+ │ ├── ReduxProvider.tsx
107
+ │ └── AuthProvider.tsx
108
+ └── pages/
109
+ └── index.tsx # Page du module
110
+ ```
111
+
112
+ ## 🔧 Fonctionnalités Détaillées
113
+
114
+ ### 1. Génération de Routes
115
+ Le plugin scanne automatiquement vos dossiers `pages/` et `modules/*/pages/` pour :
116
+ - **Créer des routes React Router** automatiquement
117
+ - **Gérer les layouts hiérarchiques**
118
+ - **Supporter les pages d'erreur spécifiques**
119
+ - **Générer des composants lazy-loaded**
120
+
121
+ ### 2. Internationalisation
122
+ Extraction automatique des clés de traduction :
123
+ - **Scan des fichiers source** pour les appels `t()`
124
+ - **Détection des modules** avec fichiers de traduction
125
+ - **Génération des imports dynamiques**
126
+ - **Support multi-langue**
127
+
128
+ ### 3. Configuration
129
+ Génération centralisée de configuration :
130
+ - **Configuration racine** depuis `config.json`
131
+ - **Configuration des modules** depuis `modules/*/config.json`
132
+ - **Fichier TypeScript** avec imports dynamiques
133
+
134
+ ### 4. Génération de Providers
135
+ Organisation automatique des providers React :
136
+ - **Détection automatique** des fichiers provider (`Provider.tsx`)
137
+ - **Hiérarchisation intelligente** par priorité
138
+ - **Organisation par module** avec encapsulation automatique
139
+ - **Chargement lazy** avec Suspense intégré
140
+ - **Typage TypeScript** complet
141
+
142
+ ## 📚 API du Plugin
143
+
144
+ ### Fonction principale
145
+ ```typescript
146
+ import init from '@arcpkg/initiator';
147
+
148
+ // Initialisation par défaut (utilise __dirname)
149
+ init();
150
+
151
+ // Avec répertoire personnalisé
152
+ init('/chemin/vers/mon/projet');
153
+ ```
154
+
155
+ ### Classes exportées
156
+ ```typescript
157
+ import {
158
+ TranslationGenerator,
159
+ RouteGenerator,
160
+ ConfigGenerator,
161
+ ProviderGenerator
162
+ } from '@arcpkg/initiator';
163
+
164
+ // Utilisation avancée
165
+ const translationGen = new TranslationGenerator(config);
166
+ const routeGen = new RouteGenerator(config);
167
+ const configGen = new ConfigGenerator(config);
168
+ const providerGen = new ProviderGenerator(config);
169
+ ```
170
+
171
+ ### Interfaces TypeScript
172
+ ```typescript
173
+ import type {
174
+ TranslationConfig,
175
+ RouteConfig,
176
+ ConfigGeneratorOptions,
177
+ ProviderConfig,
178
+ TranslationKey,
179
+ RouteFile,
180
+ ProviderInfo
181
+ } from '@arcpkg/initiator';
182
+ ```
183
+
184
+ ## 🎯 Exemples d'Utilisation
185
+
186
+ ### Exemple 1 : Script d'initialisation
187
+ ```javascript
188
+ // scripts/init.js
189
+ import init from '@arcpkg/initiator';
190
+
191
+ // Initialiser avec le répertoire du projet
192
+ init(process.cwd());
193
+
194
+ console.log('✅ Initialisation terminée !');
195
+ ```
196
+
197
+ ### Exemple 2 : Personnalisation avancée
198
+ ```typescript
199
+ // scripts/custom-init.ts
200
+ import { ProviderGenerator } from '@arcpkg/initiator';
201
+
202
+ const customConfig = {
203
+ srcDir: './src',
204
+ modulesDir: './src/modules',
205
+ providersDir: './src/providers',
206
+ globalProvidersDir: './src/global-providers', // Dossier personnalisé
207
+ outputFile: './src/generated/provider.tsx'
208
+ };
209
+
210
+ const generator = new ProviderGenerator(customConfig);
211
+ await generator.generate();
212
+ ```
213
+
214
+ ### Exemple 3 : Intégration avec un build personnalisé
215
+ ```json
216
+ {
217
+ "scripts": {
218
+ "dev": "vite",
219
+ "build": "npm run generate && vite build",
220
+ "generate": "node scripts/generate-all.js",
221
+ "generate:routes": "node scripts/generate-routes.js",
222
+ "generate:intl": "node scripts/generate-intl.js",
223
+ "generate:config": "node scripts/generate-config.js",
224
+ "generate:providers": "node scripts/generate-providers.js"
225
+ }
226
+ }
227
+ ```
228
+
229
+ ## 🔧 Configuration Avancée
230
+
231
+ ### Configuration de la traduction
232
+ ```typescript
233
+ const translationConfig = {
234
+ srcDir: './src',
235
+ supportedLocales: ['en', 'fr', 'es'], // Langues supportées
236
+ outputFile: './src/auto-intl.ts',
237
+ modulesDir: './src/modules',
238
+ localesDir: './src/locales'
239
+ };
240
+ ```
241
+
242
+ ### Configuration du routage
243
+ ```typescript
244
+ const routeConfig = {
245
+ srcDir: './src',
246
+ modulesDir: './src/modules',
247
+ pagesDir: './src/pages', // Ou 'views', 'screens', etc.
248
+ outputFile: './src/auto-routes.tsx',
249
+ layoutFileName: '_layout', // Fichier de layout
250
+ errorFileName: '_error', // Fichier d'erreur
251
+ notFoundFileName: '_404' // Fichier 404
252
+ };
253
+ ```
254
+
255
+ ### Configuration des providers
256
+ ```typescript
257
+ const providerConfig = {
258
+ srcDir: './src',
259
+ modulesDir: './src/modules',
260
+ providersDir: './src/providers',
261
+ outputFile: './src/auto-provider.tsx',
262
+ globalProvidersDir: './src/providers' // Dossier des providers globaux
263
+ };
264
+ ```
265
+
266
+ ### Fichier config.json racine
267
+ ```json
268
+ {
269
+ "name": "Mon Application",
270
+ "version": "1.0.0",
271
+ "description": "Description de l'application",
272
+ "author": "Votre Nom",
273
+ "defaultLocale": "fr",
274
+ "supportedLocales": ["fr", "en"],
275
+ "apiUrl": "https://api.example.com",
276
+ "features": {
277
+ "auth": true,
278
+ "analytics": false,
279
+ "pwa": true
280
+ }
281
+ }
282
+ ```
283
+
284
+ ### Fichier config.json de module
285
+ ```json
286
+ {
287
+ "name": "Module Admin",
288
+ "description": "Module d'administration",
289
+ "author": "Équipe Admin",
290
+ "version": "1.0.0",
291
+ "routePrefix": "/admin",
292
+ "isEnabled": true,
293
+ "dependencies": ["auth"],
294
+ "permissions": ["admin", "superuser"]
295
+ }
296
+ ```
297
+
298
+ ## 📁 Conventions de Fichiers
299
+
300
+ ### Pages spéciales
301
+ | Fichier | Description | Route générée |
302
+ |---------|-------------|---------------|
303
+ | `_layout.tsx` | Layout du dossier | Non accessible directement |
304
+ | `_error.tsx` | Page d'erreur | Utilisée comme errorElement |
305
+ | `_404.tsx` | Page non trouvée | Route catch-all |
306
+ | `[param].tsx` | Route paramétrée | `/:param` |
307
+ | `[...slug].tsx` | Route catch-all | `/*` |
308
+ | `index.tsx` | Page d'index | `/` ou `/dossier/` |
309
+
310
+ ### Providers détectés automatiquement
311
+ | Pattern | Type détecté | Priorité |
312
+ |---------|-------------|----------|
313
+ | `*Router*.tsx` | Provider Router | Haute |
314
+ | `*Redux*.tsx` | Provider Redux | Haute |
315
+ | `*Theme*.tsx` | Provider Theme | Moyenne |
316
+ | `*Context*.tsx` | Provider Context | Moyenne |
317
+ | `*Provider.tsx` | Provider générique | Basse |
318
+ | `*Error*.tsx` | Error Boundary | Très basse |
319
+
320
+ ### Structure de module
321
+ ```
322
+ modules/
323
+ └── nom-du-module/
324
+ ├── config.json # Configuration du module
325
+ ├── locales/ # Traductions du module
326
+ │ ├── en.json
327
+ │ └── fr.json
328
+ ├── providers/ # Providers du module
329
+ │ ├── ReduxProvider.tsx
330
+ │ ├── AuthProvider.tsx
331
+ │ └── ThemeProvider.tsx
332
+ ├── pages/ # Pages du module
333
+ │ ├── _layout.tsx # Layout du module
334
+ │ ├── _error.tsx # Erreur du module
335
+ │ ├── _404.tsx # 404 du module
336
+ │ └── index.tsx # Page d'accueil du module
337
+ └── components/ # Composants du module (optionnel)
338
+ ```
339
+
340
+ ## 🔄 Workflow de Développement
341
+
342
+ ### 1. Initialisation du projet
343
+ ```bash
344
+ # Créer un nouveau projet
345
+ npm create vite@latest mon-app -- --template react-ts
346
+ cd mon-app
347
+
348
+ # Installer l'initiator
349
+ npm install @arcpkg/initiator
350
+
351
+ # Générer la structure initiale
352
+ npx @arcpkg/initiator
353
+ ```
354
+
355
+ ### 2. Ajout d'un nouveau module
356
+ ```bash
357
+ # Créer la structure du module
358
+ mkdir -p src/modules/admin/{locales,providers,pages,components}
359
+
360
+ # Ajouter les fichiers de base
361
+ touch src/modules/admin/config.json
362
+ touch src/modules/admin/pages/index.tsx
363
+ touch src/modules/admin/locales/fr.json
364
+ touch src/modules/admin/providers/ReduxProvider.tsx
365
+
366
+ # Régénérer les fichiers
367
+ npx @arcpkg/initiator
368
+ ```
369
+
370
+ ### 3. Ajout d'un provider global
371
+ ```bash
372
+ # Créer un provider global
373
+ mkdir -p src/providers
374
+ touch src/providers/ThemeProvider.tsx
375
+
376
+ # Régénérer le fichier auto-provider.tsx
377
+ npx @arcpkg/initiator
378
+ ```
379
+
380
+ ### 4. Développement avec hot-reload
381
+ ```bash
382
+ # Démarrer le serveur de développement
383
+ npm run dev
384
+
385
+ # Dans un autre terminal, surveiller les changements
386
+ npx @arcpkg/initiator --watch
387
+ ```
388
+
389
+ ## 🛠️ Intégration avec d'autres outils
390
+
391
+ ### Avec Vite
392
+ ```javascript
393
+ // vite.config.js
394
+ import { defineConfig } from 'vite';
395
+ import react from '@vitejs/plugin-react';
396
+
397
+ export default defineConfig({
398
+ plugins: [react()],
399
+ build: {
400
+ rollupOptions: {
401
+ external: ['@arcpkg/initiator']
402
+ }
403
+ }
404
+ });
405
+ ```
406
+
407
+ ### Utilisation du AppProvider généré
408
+ ```tsx
409
+ // main.tsx
410
+ import React from 'react';
411
+ import ReactDOM from 'react-dom/client';
412
+ import App from './App';
413
+ import { AppProvider } from './auto-provider';
414
+ import './index.css';
415
+
416
+ ReactDOM.createRoot(document.getElementById('root')!).render(
417
+ <React.StrictMode>
418
+ <AppProvider>
419
+ <App />
420
+ </AppProvider>
421
+ </React.StrictMode>
422
+ );
423
+ ```
424
+
425
+ ### Avec Next.js (Adaptation)
426
+ ```javascript
427
+ // next.config.js
428
+ const { generateRoutes } = require('@arcpkg/initiator/adapters/next');
429
+
430
+ module.exports = {
431
+ async rewrites() {
432
+ const routes = await generateRoutes();
433
+ return routes.map(route => ({
434
+ source: route.path,
435
+ destination: route.filePath
436
+ }));
437
+ }
438
+ };
439
+ ```
440
+
441
+ ### Avec Webpack
442
+ ```javascript
443
+ // webpack.config.js
444
+ const { GenerateRoutesPlugin } = require('@arcpkg/initiator/webpack');
445
+
446
+ module.exports = {
447
+ plugins: [
448
+ new GenerateRoutesPlugin({
449
+ watch: process.env.NODE_ENV === 'development'
450
+ })
451
+ ]
452
+ };
453
+ ```
454
+
455
+ ## 🐛 Dépannage
456
+
457
+ ### Problèmes courants
458
+
459
+ 1. **"Cannot find module"**
460
+ ```bash
461
+ # Réinstaller le plugin
462
+ npm install @arcpkg/initiator
463
+ ```
464
+
465
+ 2. **Fichiers non générés**
466
+ ```bash
467
+ # Forcer la régénération
468
+ npx @arcpkg/initiator --force
469
+
470
+ # Vérifier les permissions
471
+ chmod +x node_modules/.bin/arc-init
472
+ ```
473
+
474
+ 3. **Erreurs TypeScript**
475
+ ```bash
476
+ # Vérifier les types
477
+ npm run type-check
478
+
479
+ # Régénérer les fichiers
480
+ npx @arcpkg/initiator
481
+ ```
482
+
483
+ 4. **Providers non détectés**
484
+ ```bash
485
+ # Vérifier que le fichier contient "Provider" dans le nom
486
+ # Ou utilise createContext / Context.Provider
487
+ mv src/my-context.tsx src/MyContextProvider.tsx
488
+ ```
489
+
490
+ ### Logs de débogage
491
+ ```bash
492
+ # Activer les logs détaillés
493
+ DEBUG=arcpkg:* npx @arcpkg/initiator
494
+
495
+ # Sauvegarder les logs dans un fichier
496
+ npx @arcpkg/initiator 2>&1 | tee init.log
497
+ ```
498
+
499
+ ## 📄 Licence
500
+
501
+ MIT License - Voir le fichier [LICENSE](LICENSE) pour plus de détails.
502
+
503
+ ## 🤝 Contribution
504
+
505
+ Les contributions sont les bienvenues ! Pour contribuer :
506
+
507
+ 1. Fork le projet
508
+ 2. Créer une branche (`git checkout -b feature/amazing-feature`)
509
+ 3. Commit vos changements (`git commit -m 'Add amazing feature'`)
510
+ 4. Push vers la branche (`git push origin feature/amazing-feature`)
511
+ 5. Ouvrir une Pull Request
512
+
513
+ ## 🐛 Signaler un Bug
514
+
515
+ Envoyez nous un mail à l'adresse `contact.inicode@gmail.com` pour :
516
+ - Signaler un bug
517
+ - Proposer une amélioration
518
+ - Poser une question
519
+
520
+ ---
521
+
522
+ **@arcpkg/initiator** - Le plugin d'initialisation intelligent pour React et TypeScript.
523
+
524
+ *Développé par l'équipe INICODE*
package/config.ts ADDED
@@ -0,0 +1,153 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { Pajo } from '@arcpkg/pajo';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ export interface ConfigGeneratorOptions {
10
+ srcDir: string;
11
+ outputFile: string;
12
+ modulesDir: string;
13
+ rootConfigPath: string;
14
+ projectRoot: string;
15
+ }
16
+
17
+ export class ConfigGenerator {
18
+ private config: ConfigGeneratorOptions;
19
+ private modules: Set<string> = new Set();
20
+
21
+ constructor(
22
+ config: Partial<ConfigGeneratorOptions> = {},
23
+ dirname: string | undefined = __dirname,
24
+ ) {
25
+ this.config = {
26
+ srcDir: config.srcDir || Pajo.join(dirname, 'src') || '',
27
+ outputFile: config.outputFile || Pajo.join(dirname, 'src\\auto-config.ts') || '',
28
+ modulesDir: config.modulesDir || Pajo.join(dirname, 'src\\modules') || '',
29
+ rootConfigPath: config.rootConfigPath || Pajo.join(dirname, 'src\\config.json') || '',
30
+ projectRoot: config.projectRoot || dirname || ''
31
+ };
32
+ console.log(`--> ConfigGenerator config:: `, this.config);
33
+ }
34
+
35
+ public async generate(): Promise<void> {
36
+ console.log('🔍 Scanning for configuration files...');
37
+
38
+ await this.discoverModules();
39
+
40
+ await this.generateAutoConfigFile();
41
+
42
+ console.log(`✅ Generated ${this.config.outputFile}`);
43
+ console.log(`📦 Found modules with config: ${Array.from(this.modules).join(', ')}`);
44
+ }
45
+
46
+ private async discoverModules(): Promise<void> {
47
+ try {
48
+
49
+ if (!fs.existsSync(this.config.modulesDir)) {
50
+ console.log(`⚠️ Modules directory not found: ${this.config.modulesDir}`);
51
+ return;
52
+ }
53
+
54
+ const moduleDirs = fs.readdirSync(this.config.modulesDir, { withFileTypes: true })
55
+ .filter(dirent => dirent.isDirectory())
56
+ .map(dirent => dirent.name);
57
+
58
+ for (const moduleName of moduleDirs) {
59
+ const configPath = path.join(this.config.modulesDir, moduleName, 'config.json');
60
+
61
+ if (fs.existsSync(configPath)) {
62
+ this.modules.add(moduleName);
63
+ console.log(`📁 Found config for module: ${moduleName}`);
64
+ }
65
+ }
66
+ } catch (error) {
67
+ console.error('Error discovering modules:', error);
68
+ }
69
+ }
70
+
71
+ private async generateAutoConfigFile(): Promise<void> {
72
+ const outputDir = path.dirname(this.config.outputFile);
73
+
74
+ if (!fs.existsSync(outputDir)) {
75
+ fs.mkdirSync(outputDir, { recursive: true });
76
+ }
77
+
78
+ const content = this.generateFileContent();
79
+ fs.writeFileSync(this.config.outputFile, content, 'utf-8');
80
+ }
81
+
82
+ private getRelativeImportPath(targetPath: string): string {
83
+
84
+ const outputDir = path.dirname(this.config.outputFile);
85
+ const relative = path.relative(outputDir, targetPath);
86
+
87
+ let importPath = relative.replace(/\\/g, '/');
88
+
89
+ if (!importPath.startsWith('.') && !importPath.startsWith('/')) {
90
+ importPath = './' + importPath;
91
+ }
92
+
93
+ return importPath;
94
+ }
95
+
96
+ private generateFileContent(): string {
97
+ const { rootConfigPath, modulesDir } = this.config;
98
+
99
+ const sortedModules = Array.from(this.modules).sort();
100
+
101
+ const rootConfigExists = fs.existsSync(rootConfigPath);
102
+ console.log(`📄 Root config exists: ${rootConfigExists} at ${rootConfigPath}`);
103
+
104
+ const baseImportPath = rootConfigExists
105
+ ? this.getRelativeImportPath(rootConfigPath)
106
+ : null;
107
+
108
+ const baseConfig = rootConfigExists && baseImportPath
109
+ ? ` 'app': (() => import('${baseImportPath}').then(module => module.default || module))`
110
+ : ` 'app': (() => Promise.resolve({}))`;
111
+
112
+ const modulesImports = sortedModules.map(moduleName => {
113
+ const configPath = path.join(modulesDir, moduleName, 'config.json');
114
+ const configExists = fs.existsSync(configPath);
115
+
116
+ if (configExists) {
117
+ const importPath = this.getRelativeImportPath(configPath);
118
+ console.log(`📄 Module ${moduleName} config: ${configPath} -> ${importPath}`);
119
+ return ` '${moduleName}': (() => import('${importPath}').then(module => module.default || module))`;
120
+ } else {
121
+ console.log(`⚠️ Module ${moduleName} config not found: ${configPath}`);
122
+ return ` '${moduleName}': (() => Promise.resolve({}))`;
123
+ }
124
+ }).join(',\n');
125
+
126
+ return `export const configs = {
127
+ 'base': {
128
+ ${baseConfig}
129
+ },
130
+ 'modules': {
131
+ ${modulesImports.length > 0 ? modulesImports : ' // No modules with config.json found'}
132
+ }
133
+ };
134
+
135
+ export default configs;`;
136
+ }
137
+ }
138
+
139
+ async function ConfigInitiator(
140
+ dirname: string | undefined = __dirname
141
+ ) {
142
+ const config: Partial<ConfigGeneratorOptions> = {};
143
+
144
+ const generator = new ConfigGenerator(config, dirname);
145
+
146
+ generator.generate().then(() => {
147
+ console.log('🎉 Config generation completed successfully!');
148
+ }).catch((err) => {
149
+ console.error('❌ Failed to generate config: ', err);
150
+ });
151
+ }
152
+
153
+ export default ConfigInitiator;
package/index.ts ADDED
@@ -0,0 +1,23 @@
1
+ import TranslationInitiator from './intl';
2
+ import ConfigInitiator from './config';
3
+ import RouteInitiator from './routing';
4
+ import ProviderInitiator from './provider';
5
+ import NativeRouteInitiator from './native-routing';
6
+
7
+ export default function(
8
+ dirname: string = __dirname,
9
+ isNative: boolean = false,
10
+ ) {
11
+ isNative = (
12
+ typeof isNative === 'boolean'
13
+ ) ? isNative : false;
14
+
15
+ TranslationInitiator(dirname);
16
+ ConfigInitiator(dirname);
17
+ if(!!isNative) {
18
+ NativeRouteInitiator(dirname);
19
+ } else {
20
+ RouteInitiator(dirname);
21
+ }
22
+ ProviderInitiator(dirname);
23
+ }