@configjs/cli 1.1.8 → 1.1.9
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.fr.md +31 -9
- package/README.md +31 -9
- package/dist/{check-KHMCB7NK.js → check-IOMRDWLB.js} +5 -4
- package/dist/{chunk-MQV3WNMH.js → chunk-6GV4NKUX.js} +11 -3
- package/dist/{chunk-4N3JFZLA.js → chunk-6WWDHX4E.js} +798 -727
- package/dist/{chunk-AMBG3TCE.js → chunk-ABHFQM5U.js} +113 -108
- package/dist/{chunk-YQVYFXOD.js → chunk-ATUTE7PE.js} +7 -5
- package/dist/{chunk-HM2JWJOO.js → chunk-FIB2J36N.js} +4 -81
- package/dist/chunk-QPEUT7QG.js +157 -0
- package/dist/{chunk-TVZWTKJU.js → chunk-WHV4KF4U.js} +28 -18
- package/dist/cli.js +12 -8
- package/dist/{installed-WA6I2IFD.js → installed-LZE6LH7A.js} +4 -3
- package/dist/{list-ICEIQD7X.js → list-TDMIAZPQ.js} +4 -3
- package/dist/{nextjs-command-SGU7KCFM.js → nextjs-command-W53FZE7U.js} +7 -6
- package/dist/{nextjs-installer-5C3VBCZE.js → nextjs-installer-TJXAUIQK.js} +4 -2
- package/dist/{react-command-AXYWRMBH.js → react-command-NHCD2L7R.js} +7 -6
- package/dist/{remove-JBICRDXX.js → remove-XQBB4NC3.js} +4 -3
- package/dist/{vite-installer-OPE53M3C.js → vite-installer-J7BO22KD.js} +4 -2
- package/dist/{vue-command-SLT6ILZT.js → vue-command-GYKDHJRJ.js} +7 -6
- package/dist/{vue-installer-LWQQCYOP.js → vue-installer-3AWLLT53.js} +4 -2
- package/package.json +1 -1
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
installPackages
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6GV4NKUX.js";
|
|
4
4
|
import {
|
|
5
5
|
checkPathExists,
|
|
6
6
|
ensureDirectory,
|
|
7
|
-
logger,
|
|
8
7
|
normalizePath,
|
|
9
8
|
readFileContent,
|
|
10
9
|
readPackageJson,
|
|
11
10
|
writeFileContent,
|
|
12
11
|
writePackageJson
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FIB2J36N.js";
|
|
13
|
+
import {
|
|
14
|
+
getModuleLogger
|
|
15
|
+
} from "./chunk-QPEUT7QG.js";
|
|
14
16
|
|
|
15
17
|
// src/types/index.ts
|
|
16
18
|
var Category = /* @__PURE__ */ ((Category2) => {
|
|
@@ -31,8 +33,230 @@ var Category = /* @__PURE__ */ ((Category2) => {
|
|
|
31
33
|
// src/plugins/animation/framer-motion.ts
|
|
32
34
|
import { join } from "path";
|
|
33
35
|
|
|
36
|
+
// src/core/backup-manager.ts
|
|
37
|
+
import { resolve } from "path";
|
|
38
|
+
var BackupManager = class {
|
|
39
|
+
/**
|
|
40
|
+
* @param fsAdapter - Adaptateur de filesystem optionnel (pour tests avec memfs)
|
|
41
|
+
*/
|
|
42
|
+
constructor(fsAdapter) {
|
|
43
|
+
this.fsAdapter = fsAdapter;
|
|
44
|
+
}
|
|
45
|
+
logger = getModuleLogger();
|
|
46
|
+
/**
|
|
47
|
+
* Map des backups : filePath -> content
|
|
48
|
+
*/
|
|
49
|
+
backups = /* @__PURE__ */ new Map();
|
|
50
|
+
/**
|
|
51
|
+
* Sauvegarde le contenu d'un fichier avant modification
|
|
52
|
+
*
|
|
53
|
+
* @param filePath - Chemin du fichier à sauvegarder
|
|
54
|
+
* @param content - Contenu actuel du fichier
|
|
55
|
+
* @throws {Error} Si le backup échoue
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* backupManager.backup('/path/to/file.txt', 'original content')
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
backup(filePath, content) {
|
|
63
|
+
const fullPath = resolve(filePath);
|
|
64
|
+
if (this.backups.has(fullPath)) {
|
|
65
|
+
this.logger.debug(`Backup already exists for ${fullPath}, overwriting`);
|
|
66
|
+
}
|
|
67
|
+
this.backups.set(fullPath, content);
|
|
68
|
+
this.logger.debug(`Backed up file: ${fullPath}`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sauvegarde le contenu d'un fichier en le lisant depuis le disque
|
|
72
|
+
*
|
|
73
|
+
* @param filePath - Chemin du fichier à sauvegarder
|
|
74
|
+
* @returns Promise qui se résout quand le backup est terminé
|
|
75
|
+
* @throws {Error} Si le fichier n'existe pas ou si la lecture échoue
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* await backupManager.backupFromDisk('/path/to/file.txt')
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
async backupFromDisk(filePath) {
|
|
83
|
+
const fullPath = resolve(filePath);
|
|
84
|
+
if (!await checkPathExists(fullPath, this.fsAdapter)) {
|
|
85
|
+
throw new Error(`File not found for backup: ${fullPath}`);
|
|
86
|
+
}
|
|
87
|
+
const content = await readFileContent(fullPath, "utf-8", this.fsAdapter);
|
|
88
|
+
this.backup(fullPath, content);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Restaure un fichier depuis son backup
|
|
92
|
+
*
|
|
93
|
+
* @param filePath - Chemin du fichier à restaurer
|
|
94
|
+
* @returns Promise qui se résout quand la restauration est terminée
|
|
95
|
+
* @throws {Error} Si aucun backup n'existe pour ce fichier
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* await backupManager.restore('/path/to/file.txt')
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
async restore(filePath) {
|
|
103
|
+
const fullPath = resolve(filePath);
|
|
104
|
+
const backupContent = this.backups.get(fullPath);
|
|
105
|
+
if (!backupContent) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`No backup found for file: ${fullPath}. Available backups: ${Array.from(
|
|
108
|
+
this.backups.keys()
|
|
109
|
+
).join(", ")}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
await writeFileContent(fullPath, backupContent, "utf-8", this.fsAdapter);
|
|
114
|
+
this.logger.debug(`Restored file from backup: ${fullPath}`);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
117
|
+
throw new Error(`Failed to restore file ${fullPath}: ${errorMessage}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Restaure tous les fichiers sauvegardés
|
|
122
|
+
*
|
|
123
|
+
* @returns Promise qui se résout quand toutes les restaurations sont terminées
|
|
124
|
+
* @throws {Error} Si une restauration échoue (mais continue avec les autres)
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* await backupManager.restoreAll()
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
async restoreAll() {
|
|
132
|
+
const filePaths = Array.from(this.backups.keys());
|
|
133
|
+
if (filePaths.length === 0) {
|
|
134
|
+
this.logger.debug("No backups to restore");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.logger.debug(`Restoring ${filePaths.length} file(s) from backup`);
|
|
138
|
+
const errors = [];
|
|
139
|
+
for (const filePath of filePaths) {
|
|
140
|
+
try {
|
|
141
|
+
await this.restore(filePath);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
144
|
+
errors.push({
|
|
145
|
+
filePath,
|
|
146
|
+
error: new Error(errorMessage)
|
|
147
|
+
});
|
|
148
|
+
this.logger.error(`Failed to restore ${filePath}: ${errorMessage}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (errors.length > 0) {
|
|
152
|
+
const errorMessages = errors.map((e) => `${e.filePath}: ${e.error.message}`).join("; ");
|
|
153
|
+
throw new Error(
|
|
154
|
+
`Failed to restore ${errors.length} file(s): ${errorMessages}`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
this.logger.debug(`Successfully restored ${filePaths.length} file(s)`);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Vérifie si un backup existe pour un fichier
|
|
161
|
+
*
|
|
162
|
+
* @param filePath - Chemin du fichier à vérifier
|
|
163
|
+
* @returns true si un backup existe, false sinon
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* if (backupManager.hasBackup('/path/to/file.txt')) {
|
|
168
|
+
* await backupManager.restore('/path/to/file.txt')
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
hasBackup(filePath) {
|
|
173
|
+
const fullPath = resolve(filePath);
|
|
174
|
+
return this.backups.has(fullPath);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Récupère le contenu du backup d'un fichier sans le restaurer
|
|
178
|
+
*
|
|
179
|
+
* @param filePath - Chemin du fichier
|
|
180
|
+
* @returns Contenu du backup ou undefined si aucun backup n'existe
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const backupContent = backupManager.getBackup('/path/to/file.txt')
|
|
185
|
+
* if (backupContent) {
|
|
186
|
+
* console.log('Backup content:', backupContent)
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
getBackup(filePath) {
|
|
191
|
+
const fullPath = resolve(filePath);
|
|
192
|
+
return this.backups.get(fullPath);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Supprime le backup d'un fichier spécifique
|
|
196
|
+
*
|
|
197
|
+
* @param filePath - Chemin du fichier
|
|
198
|
+
* @returns true si le backup a été supprimé, false s'il n'existait pas
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* backupManager.removeBackup('/path/to/file.txt')
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
removeBackup(filePath) {
|
|
206
|
+
const fullPath = resolve(filePath);
|
|
207
|
+
const removed = this.backups.delete(fullPath);
|
|
208
|
+
if (removed) {
|
|
209
|
+
this.logger.debug(`Removed backup for: ${fullPath}`);
|
|
210
|
+
}
|
|
211
|
+
return removed;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Vide tous les backups
|
|
215
|
+
*
|
|
216
|
+
* Utile après une opération réussie pour libérer la mémoire
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* backupManager.clear()
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
clear() {
|
|
224
|
+
const count = this.backups.size;
|
|
225
|
+
this.backups.clear();
|
|
226
|
+
this.logger.debug(`Cleared ${count} backup(s)`);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Retourne le nombre de backups actuellement stockés
|
|
230
|
+
*
|
|
231
|
+
* @returns Nombre de backups
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* const count = backupManager.size()
|
|
236
|
+
* console.log(`${count} file(s) backed up`)
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
size() {
|
|
240
|
+
return this.backups.size;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Retourne la liste des fichiers sauvegardés
|
|
244
|
+
*
|
|
245
|
+
* @returns Tableau des chemins de fichiers sauvegardés
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* const files = backupManager.listBackups()
|
|
250
|
+
* console.log('Backed up files:', files)
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
listBackups() {
|
|
254
|
+
return Array.from(this.backups.keys());
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
34
258
|
// src/core/config-writer.ts
|
|
35
|
-
import { resolve, dirname } from "path";
|
|
259
|
+
import { resolve as resolve2, dirname } from "path";
|
|
36
260
|
var ConfigWriter = class {
|
|
37
261
|
/**
|
|
38
262
|
* @param backupManager - Gestionnaire de backups à utiliser
|
|
@@ -42,6 +266,7 @@ var ConfigWriter = class {
|
|
|
42
266
|
this.backupManager = backupManager;
|
|
43
267
|
this.fsAdapter = fsAdapter;
|
|
44
268
|
}
|
|
269
|
+
logger = getModuleLogger();
|
|
45
270
|
/**
|
|
46
271
|
* Écrit ou modifie un fichier avec backup automatique
|
|
47
272
|
*
|
|
@@ -58,7 +283,7 @@ var ConfigWriter = class {
|
|
|
58
283
|
*/
|
|
59
284
|
async writeFile(path, content, options = {}) {
|
|
60
285
|
const { backup = true, ensureDir: shouldEnsureDir = true } = options;
|
|
61
|
-
const fullPath =
|
|
286
|
+
const fullPath = resolve2(path);
|
|
62
287
|
const fileExists = await checkPathExists(fullPath, this.fsAdapter);
|
|
63
288
|
if (fileExists && backup) {
|
|
64
289
|
try {
|
|
@@ -70,7 +295,7 @@ var ConfigWriter = class {
|
|
|
70
295
|
this.backupManager.backup(fullPath, existingContent);
|
|
71
296
|
} catch (error) {
|
|
72
297
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
73
|
-
logger.warn(
|
|
298
|
+
this.logger.warn(
|
|
74
299
|
`Failed to backup file before write: ${fullPath}. ${errorMessage}`
|
|
75
300
|
);
|
|
76
301
|
}
|
|
@@ -81,7 +306,7 @@ var ConfigWriter = class {
|
|
|
81
306
|
}
|
|
82
307
|
try {
|
|
83
308
|
await writeFileContent(fullPath, content, "utf-8", this.fsAdapter);
|
|
84
|
-
logger.debug(`Wrote file: ${fullPath}`);
|
|
309
|
+
this.logger.debug(`Wrote file: ${fullPath}`);
|
|
85
310
|
} catch (error) {
|
|
86
311
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
87
312
|
throw new Error(`Failed to write file ${fullPath}: ${errorMessage}`);
|
|
@@ -102,7 +327,7 @@ var ConfigWriter = class {
|
|
|
102
327
|
* ```
|
|
103
328
|
*/
|
|
104
329
|
async createFile(path, content, options = {}) {
|
|
105
|
-
const fullPath =
|
|
330
|
+
const fullPath = resolve2(path);
|
|
106
331
|
if (await checkPathExists(fullPath, this.fsAdapter)) {
|
|
107
332
|
throw new Error(`File already exists: ${fullPath}`);
|
|
108
333
|
}
|
|
@@ -110,7 +335,7 @@ var ConfigWriter = class {
|
|
|
110
335
|
...options,
|
|
111
336
|
backup: false
|
|
112
337
|
});
|
|
113
|
-
logger.debug(`Created new file: ${fullPath}`);
|
|
338
|
+
this.logger.debug(`Created new file: ${fullPath}`);
|
|
114
339
|
}
|
|
115
340
|
/**
|
|
116
341
|
* Modifie le package.json d'un projet
|
|
@@ -132,7 +357,7 @@ var ConfigWriter = class {
|
|
|
132
357
|
* ```
|
|
133
358
|
*/
|
|
134
359
|
async modifyPackageJson(projectRoot, modifier) {
|
|
135
|
-
const fullPath =
|
|
360
|
+
const fullPath = resolve2(projectRoot);
|
|
136
361
|
let pkg;
|
|
137
362
|
try {
|
|
138
363
|
pkg = await readPackageJson(fullPath, this.fsAdapter);
|
|
@@ -142,7 +367,7 @@ var ConfigWriter = class {
|
|
|
142
367
|
`Failed to read package.json: ${errorMessage}. Make sure you're in a valid project directory.`
|
|
143
368
|
);
|
|
144
369
|
}
|
|
145
|
-
const packageJsonPath =
|
|
370
|
+
const packageJsonPath = resolve2(fullPath, "package.json");
|
|
146
371
|
if (this.backupManager.hasBackup(packageJsonPath)) {
|
|
147
372
|
} else {
|
|
148
373
|
try {
|
|
@@ -154,7 +379,7 @@ var ConfigWriter = class {
|
|
|
154
379
|
this.backupManager.backup(packageJsonPath, existingContent);
|
|
155
380
|
} catch (error) {
|
|
156
381
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
157
|
-
logger.warn(
|
|
382
|
+
this.logger.warn(
|
|
158
383
|
`Failed to backup package.json: ${errorMessage}. Continuing anyway.`
|
|
159
384
|
);
|
|
160
385
|
}
|
|
@@ -162,7 +387,7 @@ var ConfigWriter = class {
|
|
|
162
387
|
const modifiedPkg = modifier(pkg);
|
|
163
388
|
try {
|
|
164
389
|
await writePackageJson(fullPath, modifiedPkg, this.fsAdapter);
|
|
165
|
-
logger.debug(`Modified package.json: ${packageJsonPath}`);
|
|
390
|
+
this.logger.debug(`Modified package.json: ${packageJsonPath}`);
|
|
166
391
|
} catch (error) {
|
|
167
392
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
168
393
|
throw new Error(
|
|
@@ -185,7 +410,7 @@ var ConfigWriter = class {
|
|
|
185
410
|
* ```
|
|
186
411
|
*/
|
|
187
412
|
async appendToFile(path, content, options = {}) {
|
|
188
|
-
const fullPath =
|
|
413
|
+
const fullPath = resolve2(path);
|
|
189
414
|
const { backup = true } = options;
|
|
190
415
|
let existingContent = "";
|
|
191
416
|
const fileExists = await checkPathExists(fullPath, this.fsAdapter);
|
|
@@ -200,7 +425,7 @@ var ConfigWriter = class {
|
|
|
200
425
|
this.backupManager.backup(fullPath, existingContent);
|
|
201
426
|
} catch (error) {
|
|
202
427
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
203
|
-
logger.warn(
|
|
428
|
+
this.logger.warn(
|
|
204
429
|
`Failed to backup file before append: ${fullPath}. ${errorMessage}`
|
|
205
430
|
);
|
|
206
431
|
}
|
|
@@ -218,7 +443,7 @@ var ConfigWriter = class {
|
|
|
218
443
|
backup: false
|
|
219
444
|
// Déjà fait si nécessaire
|
|
220
445
|
});
|
|
221
|
-
logger.debug(`Appended to file: ${fullPath}`);
|
|
446
|
+
this.logger.debug(`Appended to file: ${fullPath}`);
|
|
222
447
|
}
|
|
223
448
|
/**
|
|
224
449
|
* Injecte un import dans un fichier TypeScript/JavaScript
|
|
@@ -237,13 +462,13 @@ var ConfigWriter = class {
|
|
|
237
462
|
* ```
|
|
238
463
|
*/
|
|
239
464
|
async injectImport(filePath, importStatement, options = {}) {
|
|
240
|
-
const fullPath =
|
|
465
|
+
const fullPath = resolve2(filePath);
|
|
241
466
|
if (!await checkPathExists(fullPath, this.fsAdapter)) {
|
|
242
467
|
throw new Error(`File not found: ${fullPath}`);
|
|
243
468
|
}
|
|
244
469
|
const content = await readFileContent(fullPath, "utf-8", this.fsAdapter);
|
|
245
470
|
if (content.includes(importStatement)) {
|
|
246
|
-
logger.debug(`Import already exists in ${fullPath}`);
|
|
471
|
+
this.logger.debug(`Import already exists in ${fullPath}`);
|
|
247
472
|
return;
|
|
248
473
|
}
|
|
249
474
|
const lines = content.split("\n");
|
|
@@ -269,232 +494,22 @@ var ConfigWriter = class {
|
|
|
269
494
|
backup: false
|
|
270
495
|
// Déjà fait
|
|
271
496
|
});
|
|
272
|
-
logger.debug(`Injected import into ${fullPath}`);
|
|
497
|
+
this.logger.debug(`Injected import into ${fullPath}`);
|
|
273
498
|
}
|
|
274
499
|
};
|
|
275
500
|
|
|
276
|
-
// src/
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Map des backups : filePath -> content
|
|
287
|
-
*/
|
|
288
|
-
backups = /* @__PURE__ */ new Map();
|
|
289
|
-
/**
|
|
290
|
-
* Sauvegarde le contenu d'un fichier avant modification
|
|
291
|
-
*
|
|
292
|
-
* @param filePath - Chemin du fichier à sauvegarder
|
|
293
|
-
* @param content - Contenu actuel du fichier
|
|
294
|
-
* @throws {Error} Si le backup échoue
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
* ```typescript
|
|
298
|
-
* backupManager.backup('/path/to/file.txt', 'original content')
|
|
299
|
-
* ```
|
|
300
|
-
*/
|
|
301
|
-
backup(filePath, content) {
|
|
302
|
-
const fullPath = resolve2(filePath);
|
|
303
|
-
if (this.backups.has(fullPath)) {
|
|
304
|
-
logger.debug(`Backup already exists for ${fullPath}, overwriting`);
|
|
305
|
-
}
|
|
306
|
-
this.backups.set(fullPath, content);
|
|
307
|
-
logger.debug(`Backed up file: ${fullPath}`);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Sauvegarde le contenu d'un fichier en le lisant depuis le disque
|
|
311
|
-
*
|
|
312
|
-
* @param filePath - Chemin du fichier à sauvegarder
|
|
313
|
-
* @returns Promise qui se résout quand le backup est terminé
|
|
314
|
-
* @throws {Error} Si le fichier n'existe pas ou si la lecture échoue
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* ```typescript
|
|
318
|
-
* await backupManager.backupFromDisk('/path/to/file.txt')
|
|
319
|
-
* ```
|
|
320
|
-
*/
|
|
321
|
-
async backupFromDisk(filePath) {
|
|
322
|
-
const fullPath = resolve2(filePath);
|
|
323
|
-
if (!await checkPathExists(fullPath, this.fsAdapter)) {
|
|
324
|
-
throw new Error(`File not found for backup: ${fullPath}`);
|
|
325
|
-
}
|
|
326
|
-
const content = await readFileContent(fullPath, "utf-8", this.fsAdapter);
|
|
327
|
-
this.backup(fullPath, content);
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Restaure un fichier depuis son backup
|
|
331
|
-
*
|
|
332
|
-
* @param filePath - Chemin du fichier à restaurer
|
|
333
|
-
* @returns Promise qui se résout quand la restauration est terminée
|
|
334
|
-
* @throws {Error} Si aucun backup n'existe pour ce fichier
|
|
335
|
-
*
|
|
336
|
-
* @example
|
|
337
|
-
* ```typescript
|
|
338
|
-
* await backupManager.restore('/path/to/file.txt')
|
|
339
|
-
* ```
|
|
340
|
-
*/
|
|
341
|
-
async restore(filePath) {
|
|
342
|
-
const fullPath = resolve2(filePath);
|
|
343
|
-
const backupContent = this.backups.get(fullPath);
|
|
344
|
-
if (!backupContent) {
|
|
345
|
-
throw new Error(
|
|
346
|
-
`No backup found for file: ${fullPath}. Available backups: ${Array.from(
|
|
347
|
-
this.backups.keys()
|
|
348
|
-
).join(", ")}`
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
try {
|
|
352
|
-
await writeFileContent(fullPath, backupContent, "utf-8", this.fsAdapter);
|
|
353
|
-
logger.debug(`Restored file from backup: ${fullPath}`);
|
|
354
|
-
} catch (error) {
|
|
355
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
356
|
-
throw new Error(`Failed to restore file ${fullPath}: ${errorMessage}`);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Restaure tous les fichiers sauvegardés
|
|
361
|
-
*
|
|
362
|
-
* @returns Promise qui se résout quand toutes les restaurations sont terminées
|
|
363
|
-
* @throws {Error} Si une restauration échoue (mais continue avec les autres)
|
|
364
|
-
*
|
|
365
|
-
* @example
|
|
366
|
-
* ```typescript
|
|
367
|
-
* await backupManager.restoreAll()
|
|
368
|
-
* ```
|
|
369
|
-
*/
|
|
370
|
-
async restoreAll() {
|
|
371
|
-
const filePaths = Array.from(this.backups.keys());
|
|
372
|
-
if (filePaths.length === 0) {
|
|
373
|
-
logger.debug("No backups to restore");
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
logger.debug(`Restoring ${filePaths.length} file(s) from backup`);
|
|
377
|
-
const errors = [];
|
|
378
|
-
for (const filePath of filePaths) {
|
|
379
|
-
try {
|
|
380
|
-
await this.restore(filePath);
|
|
381
|
-
} catch (error) {
|
|
382
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
383
|
-
errors.push({
|
|
384
|
-
filePath,
|
|
385
|
-
error: new Error(errorMessage)
|
|
386
|
-
});
|
|
387
|
-
logger.error(`Failed to restore ${filePath}: ${errorMessage}`);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (errors.length > 0) {
|
|
391
|
-
const errorMessages = errors.map((e) => `${e.filePath}: ${e.error.message}`).join("; ");
|
|
392
|
-
throw new Error(
|
|
393
|
-
`Failed to restore ${errors.length} file(s): ${errorMessages}`
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
logger.debug(`Successfully restored ${filePaths.length} file(s)`);
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Vérifie si un backup existe pour un fichier
|
|
400
|
-
*
|
|
401
|
-
* @param filePath - Chemin du fichier à vérifier
|
|
402
|
-
* @returns true si un backup existe, false sinon
|
|
403
|
-
*
|
|
404
|
-
* @example
|
|
405
|
-
* ```typescript
|
|
406
|
-
* if (backupManager.hasBackup('/path/to/file.txt')) {
|
|
407
|
-
* await backupManager.restore('/path/to/file.txt')
|
|
408
|
-
* }
|
|
409
|
-
* ```
|
|
410
|
-
*/
|
|
411
|
-
hasBackup(filePath) {
|
|
412
|
-
const fullPath = resolve2(filePath);
|
|
413
|
-
return this.backups.has(fullPath);
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* Récupère le contenu du backup d'un fichier sans le restaurer
|
|
417
|
-
*
|
|
418
|
-
* @param filePath - Chemin du fichier
|
|
419
|
-
* @returns Contenu du backup ou undefined si aucun backup n'existe
|
|
420
|
-
*
|
|
421
|
-
* @example
|
|
422
|
-
* ```typescript
|
|
423
|
-
* const backupContent = backupManager.getBackup('/path/to/file.txt')
|
|
424
|
-
* if (backupContent) {
|
|
425
|
-
* console.log('Backup content:', backupContent)
|
|
426
|
-
* }
|
|
427
|
-
* ```
|
|
428
|
-
*/
|
|
429
|
-
getBackup(filePath) {
|
|
430
|
-
const fullPath = resolve2(filePath);
|
|
431
|
-
return this.backups.get(fullPath);
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Supprime le backup d'un fichier spécifique
|
|
435
|
-
*
|
|
436
|
-
* @param filePath - Chemin du fichier
|
|
437
|
-
* @returns true si le backup a été supprimé, false s'il n'existait pas
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* ```typescript
|
|
441
|
-
* backupManager.removeBackup('/path/to/file.txt')
|
|
442
|
-
* ```
|
|
443
|
-
*/
|
|
444
|
-
removeBackup(filePath) {
|
|
445
|
-
const fullPath = resolve2(filePath);
|
|
446
|
-
const removed = this.backups.delete(fullPath);
|
|
447
|
-
if (removed) {
|
|
448
|
-
logger.debug(`Removed backup for: ${fullPath}`);
|
|
449
|
-
}
|
|
450
|
-
return removed;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Vide tous les backups
|
|
454
|
-
*
|
|
455
|
-
* Utile après une opération réussie pour libérer la mémoire
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* ```typescript
|
|
459
|
-
* backupManager.clear()
|
|
460
|
-
* ```
|
|
461
|
-
*/
|
|
462
|
-
clear() {
|
|
463
|
-
const count = this.backups.size;
|
|
464
|
-
this.backups.clear();
|
|
465
|
-
logger.debug(`Cleared ${count} backup(s)`);
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Retourne le nombre de backups actuellement stockés
|
|
469
|
-
*
|
|
470
|
-
* @returns Nombre de backups
|
|
471
|
-
*
|
|
472
|
-
* @example
|
|
473
|
-
* ```typescript
|
|
474
|
-
* const count = backupManager.size()
|
|
475
|
-
* console.log(`${count} file(s) backed up`)
|
|
476
|
-
* ```
|
|
477
|
-
*/
|
|
478
|
-
size() {
|
|
479
|
-
return this.backups.size;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Retourne la liste des fichiers sauvegardés
|
|
483
|
-
*
|
|
484
|
-
* @returns Tableau des chemins de fichiers sauvegardés
|
|
485
|
-
*
|
|
486
|
-
* @example
|
|
487
|
-
* ```typescript
|
|
488
|
-
* const files = backupManager.listBackups()
|
|
489
|
-
* console.log('Backed up files:', files)
|
|
490
|
-
* ```
|
|
491
|
-
*/
|
|
492
|
-
listBackups() {
|
|
493
|
-
return Array.from(this.backups.keys());
|
|
494
|
-
}
|
|
495
|
-
};
|
|
501
|
+
// src/plugins/utils/plugin-services.ts
|
|
502
|
+
function getPluginServices(ctx) {
|
|
503
|
+
const backupManager = ctx.backupManager ?? new BackupManager(ctx.fsAdapter);
|
|
504
|
+
const writer = ctx.configWriter ?? new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
505
|
+
return { backupManager, writer };
|
|
506
|
+
}
|
|
507
|
+
function getRollbackManager(ctx) {
|
|
508
|
+
return ctx.backupManager ?? new BackupManager(ctx.fsAdapter);
|
|
509
|
+
}
|
|
496
510
|
|
|
497
511
|
// src/plugins/animation/framer-motion.ts
|
|
512
|
+
var logger = getModuleLogger();
|
|
498
513
|
var framerMotionPlugin = {
|
|
499
514
|
name: "framer-motion",
|
|
500
515
|
displayName: "Framer Motion",
|
|
@@ -556,8 +571,7 @@ var framerMotionPlugin = {
|
|
|
556
571
|
* Documentation : https://www.framer.com/motion
|
|
557
572
|
*/
|
|
558
573
|
async configure(ctx) {
|
|
559
|
-
const backupManager =
|
|
560
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
574
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
561
575
|
const files = [];
|
|
562
576
|
const srcDir = join(ctx.projectRoot, ctx.srcDir);
|
|
563
577
|
try {
|
|
@@ -608,7 +622,7 @@ var framerMotionPlugin = {
|
|
|
608
622
|
* Rollback de la configuration Framer Motion
|
|
609
623
|
*/
|
|
610
624
|
async rollback(_ctx) {
|
|
611
|
-
const backupManager =
|
|
625
|
+
const backupManager = getRollbackManager(_ctx);
|
|
612
626
|
try {
|
|
613
627
|
await backupManager.restoreAll();
|
|
614
628
|
logger.info("Framer Motion configuration rolled back");
|
|
@@ -726,6 +740,7 @@ function getIndexContentJS() {
|
|
|
726
740
|
|
|
727
741
|
// src/plugins/css/emotion.ts
|
|
728
742
|
import { resolve as resolve3, join as join2 } from "path";
|
|
743
|
+
var logger2 = getModuleLogger();
|
|
729
744
|
var emotionPlugin = {
|
|
730
745
|
name: "@emotion/react",
|
|
731
746
|
displayName: "Emotion",
|
|
@@ -745,7 +760,7 @@ var emotionPlugin = {
|
|
|
745
760
|
*/
|
|
746
761
|
async install(ctx) {
|
|
747
762
|
if (this.detect?.(ctx)) {
|
|
748
|
-
|
|
763
|
+
logger2.info("Emotion is already installed");
|
|
749
764
|
return {
|
|
750
765
|
packages: {},
|
|
751
766
|
success: true,
|
|
@@ -767,7 +782,7 @@ var emotionPlugin = {
|
|
|
767
782
|
exact: false,
|
|
768
783
|
silent: false
|
|
769
784
|
});
|
|
770
|
-
|
|
785
|
+
logger2.info("Successfully installed Emotion");
|
|
771
786
|
return {
|
|
772
787
|
packages: {
|
|
773
788
|
dependencies: ["@emotion/react", "@emotion/styled"]
|
|
@@ -776,7 +791,7 @@ var emotionPlugin = {
|
|
|
776
791
|
message: "Installed @emotion/react and @emotion/styled"
|
|
777
792
|
};
|
|
778
793
|
} catch (error) {
|
|
779
|
-
|
|
794
|
+
logger2.error("Failed to install Emotion:", error);
|
|
780
795
|
return {
|
|
781
796
|
packages: {},
|
|
782
797
|
success: false,
|
|
@@ -795,8 +810,7 @@ var emotionPlugin = {
|
|
|
795
810
|
* Documentation : https://emotion.sh/docs/introduction
|
|
796
811
|
*/
|
|
797
812
|
async configure(ctx) {
|
|
798
|
-
const
|
|
799
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
813
|
+
const { writer } = getPluginServices(ctx);
|
|
800
814
|
const files = [];
|
|
801
815
|
const srcDir = resolve3(ctx.projectRoot, ctx.srcDir);
|
|
802
816
|
const extension = ctx.typescript ? "tsx" : "jsx";
|
|
@@ -812,7 +826,7 @@ var emotionPlugin = {
|
|
|
812
826
|
content: buttonContent,
|
|
813
827
|
backup: false
|
|
814
828
|
});
|
|
815
|
-
|
|
829
|
+
logger2.info(`Created Button component: ${buttonPath}`);
|
|
816
830
|
const cardPath = join2(emotionDir, `Card.${extension}`);
|
|
817
831
|
const cardContent = ctx.typescript ? getCardContentTS() : getCardContentJS();
|
|
818
832
|
await writer.createFile(cardPath, cardContent);
|
|
@@ -822,7 +836,7 @@ var emotionPlugin = {
|
|
|
822
836
|
content: cardContent,
|
|
823
837
|
backup: false
|
|
824
838
|
});
|
|
825
|
-
|
|
839
|
+
logger2.info(`Created Card component: ${cardPath}`);
|
|
826
840
|
const indexPath = join2(
|
|
827
841
|
emotionDir,
|
|
828
842
|
`index.${ctx.typescript ? "ts" : "js"}`
|
|
@@ -835,14 +849,14 @@ var emotionPlugin = {
|
|
|
835
849
|
content: indexContent,
|
|
836
850
|
backup: false
|
|
837
851
|
});
|
|
838
|
-
|
|
852
|
+
logger2.info(`Created emotion components index: ${indexPath}`);
|
|
839
853
|
return {
|
|
840
854
|
files,
|
|
841
855
|
success: true,
|
|
842
856
|
message: "Emotion configured successfully"
|
|
843
857
|
};
|
|
844
858
|
} catch (error) {
|
|
845
|
-
|
|
859
|
+
logger2.error("Failed to configure Emotion:", error);
|
|
846
860
|
return {
|
|
847
861
|
files,
|
|
848
862
|
success: false,
|
|
@@ -854,12 +868,12 @@ var emotionPlugin = {
|
|
|
854
868
|
* Rollback de la configuration Emotion
|
|
855
869
|
*/
|
|
856
870
|
async rollback(_ctx) {
|
|
857
|
-
const backupManager =
|
|
871
|
+
const backupManager = getRollbackManager(_ctx);
|
|
858
872
|
try {
|
|
859
873
|
await backupManager.restoreAll();
|
|
860
|
-
|
|
874
|
+
logger2.info("Emotion configuration rolled back");
|
|
861
875
|
} catch (error) {
|
|
862
|
-
|
|
876
|
+
logger2.error("Failed to rollback Emotion configuration:", error);
|
|
863
877
|
throw error;
|
|
864
878
|
}
|
|
865
879
|
}
|
|
@@ -1057,6 +1071,7 @@ export { Card } from './Card'
|
|
|
1057
1071
|
|
|
1058
1072
|
// src/plugins/css/react-bootstrap.ts
|
|
1059
1073
|
import { resolve as resolve4, join as join3 } from "path";
|
|
1074
|
+
var logger3 = getModuleLogger();
|
|
1060
1075
|
var reactBootstrapPlugin = {
|
|
1061
1076
|
name: "react-bootstrap",
|
|
1062
1077
|
displayName: "React Bootstrap",
|
|
@@ -1077,7 +1092,7 @@ var reactBootstrapPlugin = {
|
|
|
1077
1092
|
*/
|
|
1078
1093
|
async install(ctx) {
|
|
1079
1094
|
if (this.detect?.(ctx)) {
|
|
1080
|
-
|
|
1095
|
+
logger3.info("React Bootstrap is already installed");
|
|
1081
1096
|
return {
|
|
1082
1097
|
packages: {},
|
|
1083
1098
|
success: true,
|
|
@@ -1092,7 +1107,7 @@ var reactBootstrapPlugin = {
|
|
|
1092
1107
|
exact: false,
|
|
1093
1108
|
silent: false
|
|
1094
1109
|
});
|
|
1095
|
-
|
|
1110
|
+
logger3.info("Successfully installed React Bootstrap");
|
|
1096
1111
|
return {
|
|
1097
1112
|
packages: {
|
|
1098
1113
|
dependencies: ["react-bootstrap", "bootstrap"]
|
|
@@ -1101,7 +1116,7 @@ var reactBootstrapPlugin = {
|
|
|
1101
1116
|
message: "Installed react-bootstrap and bootstrap"
|
|
1102
1117
|
};
|
|
1103
1118
|
} catch (error) {
|
|
1104
|
-
|
|
1119
|
+
logger3.error("Failed to install React Bootstrap:", error);
|
|
1105
1120
|
return {
|
|
1106
1121
|
packages: {},
|
|
1107
1122
|
success: false,
|
|
@@ -1139,7 +1154,7 @@ var reactBootstrapPlugin = {
|
|
|
1139
1154
|
content: exampleContent,
|
|
1140
1155
|
backup: false
|
|
1141
1156
|
});
|
|
1142
|
-
|
|
1157
|
+
logger3.info(`Created Bootstrap example: ${examplePath}`);
|
|
1143
1158
|
const indexPath = join3(srcDir, `index.${ctx.typescript ? "tsx" : "jsx"}`);
|
|
1144
1159
|
const indexExists = await checkPathExists(indexPath, ctx.fsAdapter);
|
|
1145
1160
|
if (indexExists) {
|
|
@@ -1159,7 +1174,7 @@ var reactBootstrapPlugin = {
|
|
|
1159
1174
|
content: modifiedIndexContent,
|
|
1160
1175
|
backup: true
|
|
1161
1176
|
});
|
|
1162
|
-
|
|
1177
|
+
logger3.info(
|
|
1163
1178
|
`Updated index.${ctx.typescript ? "tsx" : "jsx"} with Bootstrap CSS`
|
|
1164
1179
|
);
|
|
1165
1180
|
}
|
|
@@ -1172,7 +1187,7 @@ var reactBootstrapPlugin = {
|
|
|
1172
1187
|
content: indexContent,
|
|
1173
1188
|
backup: false
|
|
1174
1189
|
});
|
|
1175
|
-
|
|
1190
|
+
logger3.info(
|
|
1176
1191
|
`Created index.${ctx.typescript ? "tsx" : "jsx"} with Bootstrap CSS`
|
|
1177
1192
|
);
|
|
1178
1193
|
}
|
|
@@ -1182,7 +1197,7 @@ var reactBootstrapPlugin = {
|
|
|
1182
1197
|
message: "React Bootstrap configured successfully"
|
|
1183
1198
|
};
|
|
1184
1199
|
} catch (error) {
|
|
1185
|
-
|
|
1200
|
+
logger3.error("Failed to configure React Bootstrap:", error);
|
|
1186
1201
|
return {
|
|
1187
1202
|
files,
|
|
1188
1203
|
success: false,
|
|
@@ -1197,9 +1212,9 @@ var reactBootstrapPlugin = {
|
|
|
1197
1212
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
1198
1213
|
try {
|
|
1199
1214
|
await backupManager.restoreAll();
|
|
1200
|
-
|
|
1215
|
+
logger3.info("React Bootstrap configuration rolled back");
|
|
1201
1216
|
} catch (error) {
|
|
1202
|
-
|
|
1217
|
+
logger3.error("Failed to rollback React Bootstrap configuration:", error);
|
|
1203
1218
|
throw error;
|
|
1204
1219
|
}
|
|
1205
1220
|
}
|
|
@@ -1319,7 +1334,7 @@ ReactDOM.createRoot(document.getElementById('root')).render(
|
|
|
1319
1334
|
}
|
|
1320
1335
|
function injectBootstrapCSS(content) {
|
|
1321
1336
|
if (content.includes("'bootstrap/dist/css/bootstrap.min.css'") || content.includes('"bootstrap/dist/css/bootstrap.min.css"') || content.includes("'bootstrap/dist/css/bootstrap.css'") || content.includes('"bootstrap/dist/css/bootstrap.css"')) {
|
|
1322
|
-
|
|
1337
|
+
logger3.warn("Bootstrap CSS already imported in index file");
|
|
1323
1338
|
return content;
|
|
1324
1339
|
}
|
|
1325
1340
|
const bootstrapImport = "import 'bootstrap/dist/css/bootstrap.min.css'\n";
|
|
@@ -1340,6 +1355,7 @@ function injectBootstrapCSS(content) {
|
|
|
1340
1355
|
|
|
1341
1356
|
// src/plugins/css/styled-components.ts
|
|
1342
1357
|
import { resolve as resolve5, join as join4 } from "path";
|
|
1358
|
+
var logger4 = getModuleLogger();
|
|
1343
1359
|
var styledComponentsPlugin = {
|
|
1344
1360
|
name: "styled-components",
|
|
1345
1361
|
displayName: "Styled Components",
|
|
@@ -1359,7 +1375,7 @@ var styledComponentsPlugin = {
|
|
|
1359
1375
|
*/
|
|
1360
1376
|
async install(ctx) {
|
|
1361
1377
|
if (this.detect?.(ctx)) {
|
|
1362
|
-
|
|
1378
|
+
logger4.info("Styled Components is already installed");
|
|
1363
1379
|
return {
|
|
1364
1380
|
packages: {},
|
|
1365
1381
|
success: true,
|
|
@@ -1383,7 +1399,7 @@ var styledComponentsPlugin = {
|
|
|
1383
1399
|
silent: false
|
|
1384
1400
|
});
|
|
1385
1401
|
}
|
|
1386
|
-
|
|
1402
|
+
logger4.info("Successfully installed Styled Components");
|
|
1387
1403
|
return {
|
|
1388
1404
|
packages: {
|
|
1389
1405
|
dependencies: ["styled-components"],
|
|
@@ -1395,7 +1411,7 @@ var styledComponentsPlugin = {
|
|
|
1395
1411
|
message: `Installed styled-components${ctx.typescript ? " and @types/styled-components" : ""}`
|
|
1396
1412
|
};
|
|
1397
1413
|
} catch (error) {
|
|
1398
|
-
|
|
1414
|
+
logger4.error("Failed to install Styled Components:", error);
|
|
1399
1415
|
return {
|
|
1400
1416
|
packages: {},
|
|
1401
1417
|
success: false,
|
|
@@ -1414,8 +1430,7 @@ var styledComponentsPlugin = {
|
|
|
1414
1430
|
* Documentation : https://styled-components.com/docs/basics#getting-started
|
|
1415
1431
|
*/
|
|
1416
1432
|
async configure(ctx) {
|
|
1417
|
-
const
|
|
1418
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
1433
|
+
const { writer } = getPluginServices(ctx);
|
|
1419
1434
|
const files = [];
|
|
1420
1435
|
const srcDir = resolve5(ctx.projectRoot, ctx.srcDir);
|
|
1421
1436
|
const extension = ctx.typescript ? "tsx" : "jsx";
|
|
@@ -1431,7 +1446,7 @@ var styledComponentsPlugin = {
|
|
|
1431
1446
|
content: buttonContent,
|
|
1432
1447
|
backup: false
|
|
1433
1448
|
});
|
|
1434
|
-
|
|
1449
|
+
logger4.info(`Created Button component: ${buttonPath}`);
|
|
1435
1450
|
const cardPath = join4(styledDir, `Card.${extension}`);
|
|
1436
1451
|
const cardContent = ctx.typescript ? getCardContentTS2() : getCardContentJS2();
|
|
1437
1452
|
await writer.createFile(cardPath, cardContent);
|
|
@@ -1441,7 +1456,7 @@ var styledComponentsPlugin = {
|
|
|
1441
1456
|
content: cardContent,
|
|
1442
1457
|
backup: false
|
|
1443
1458
|
});
|
|
1444
|
-
|
|
1459
|
+
logger4.info(`Created Card component: ${cardPath}`);
|
|
1445
1460
|
const indexPath = join4(styledDir, `index.${ctx.typescript ? "ts" : "js"}`);
|
|
1446
1461
|
const indexContent = getIndexContent2();
|
|
1447
1462
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -1451,14 +1466,14 @@ var styledComponentsPlugin = {
|
|
|
1451
1466
|
content: indexContent,
|
|
1452
1467
|
backup: false
|
|
1453
1468
|
});
|
|
1454
|
-
|
|
1469
|
+
logger4.info(`Created styled components index: ${indexPath}`);
|
|
1455
1470
|
return {
|
|
1456
1471
|
files,
|
|
1457
1472
|
success: true,
|
|
1458
1473
|
message: "Styled Components configured successfully"
|
|
1459
1474
|
};
|
|
1460
1475
|
} catch (error) {
|
|
1461
|
-
|
|
1476
|
+
logger4.error("Failed to configure Styled Components:", error);
|
|
1462
1477
|
return {
|
|
1463
1478
|
files,
|
|
1464
1479
|
success: false,
|
|
@@ -1470,12 +1485,12 @@ var styledComponentsPlugin = {
|
|
|
1470
1485
|
* Rollback de la configuration Styled Components
|
|
1471
1486
|
*/
|
|
1472
1487
|
async rollback(_ctx) {
|
|
1473
|
-
const backupManager =
|
|
1488
|
+
const backupManager = getRollbackManager(_ctx);
|
|
1474
1489
|
try {
|
|
1475
1490
|
await backupManager.restoreAll();
|
|
1476
|
-
|
|
1491
|
+
logger4.info("Styled Components configuration rolled back");
|
|
1477
1492
|
} catch (error) {
|
|
1478
|
-
|
|
1493
|
+
logger4.error("Failed to rollback Styled Components configuration:", error);
|
|
1479
1494
|
throw error;
|
|
1480
1495
|
}
|
|
1481
1496
|
}
|
|
@@ -1664,6 +1679,7 @@ export { Card } from './Card'
|
|
|
1664
1679
|
|
|
1665
1680
|
// src/plugins/css/tailwindcss.ts
|
|
1666
1681
|
import { resolve as resolve6, join as join5 } from "path";
|
|
1682
|
+
var logger5 = getModuleLogger();
|
|
1667
1683
|
var tailwindcssPlugin = {
|
|
1668
1684
|
name: "tailwindcss",
|
|
1669
1685
|
displayName: "TailwindCSS",
|
|
@@ -1683,7 +1699,7 @@ var tailwindcssPlugin = {
|
|
|
1683
1699
|
*/
|
|
1684
1700
|
async install(ctx) {
|
|
1685
1701
|
if (this.detect?.(ctx)) {
|
|
1686
|
-
|
|
1702
|
+
logger5.info("TailwindCSS is already installed");
|
|
1687
1703
|
return {
|
|
1688
1704
|
packages: {},
|
|
1689
1705
|
success: true,
|
|
@@ -1699,7 +1715,7 @@ var tailwindcssPlugin = {
|
|
|
1699
1715
|
exact: false,
|
|
1700
1716
|
silent: false
|
|
1701
1717
|
});
|
|
1702
|
-
|
|
1718
|
+
logger5.info("Successfully installed TailwindCSS");
|
|
1703
1719
|
return {
|
|
1704
1720
|
packages: {
|
|
1705
1721
|
devDependencies: packages
|
|
@@ -1708,7 +1724,7 @@ var tailwindcssPlugin = {
|
|
|
1708
1724
|
message: `Installed ${packages.join(", ")}`
|
|
1709
1725
|
};
|
|
1710
1726
|
} catch (error) {
|
|
1711
|
-
|
|
1727
|
+
logger5.error("Failed to install TailwindCSS:", error);
|
|
1712
1728
|
return {
|
|
1713
1729
|
packages: {},
|
|
1714
1730
|
success: false,
|
|
@@ -1757,7 +1773,7 @@ var tailwindcssPlugin = {
|
|
|
1757
1773
|
content: modifiedViteConfig,
|
|
1758
1774
|
backup: true
|
|
1759
1775
|
});
|
|
1760
|
-
|
|
1776
|
+
logger5.info(`Updated vite.config.${extension} with TailwindCSS plugin`);
|
|
1761
1777
|
} else {
|
|
1762
1778
|
const viteConfigContent = ctx.typescript ? getViteConfigContentTS() : getViteConfigContentJS();
|
|
1763
1779
|
await writer.createFile(viteConfigPath, viteConfigContent);
|
|
@@ -1767,7 +1783,7 @@ var tailwindcssPlugin = {
|
|
|
1767
1783
|
content: viteConfigContent,
|
|
1768
1784
|
backup: false
|
|
1769
1785
|
});
|
|
1770
|
-
|
|
1786
|
+
logger5.info(`Created vite.config.${extension} with TailwindCSS plugin`);
|
|
1771
1787
|
}
|
|
1772
1788
|
const cssFiles = [
|
|
1773
1789
|
join5(srcDir, "index.css"),
|
|
@@ -1792,7 +1808,7 @@ var tailwindcssPlugin = {
|
|
|
1792
1808
|
content: modifiedCss,
|
|
1793
1809
|
backup: true
|
|
1794
1810
|
});
|
|
1795
|
-
|
|
1811
|
+
logger5.info(`Updated ${cssPath} with TailwindCSS import`);
|
|
1796
1812
|
cssFileModified = true;
|
|
1797
1813
|
break;
|
|
1798
1814
|
}
|
|
@@ -1807,7 +1823,7 @@ var tailwindcssPlugin = {
|
|
|
1807
1823
|
content: cssContent,
|
|
1808
1824
|
backup: false
|
|
1809
1825
|
});
|
|
1810
|
-
|
|
1826
|
+
logger5.info(`Created ${cssPath} with TailwindCSS import`);
|
|
1811
1827
|
}
|
|
1812
1828
|
return {
|
|
1813
1829
|
files,
|
|
@@ -1815,7 +1831,7 @@ var tailwindcssPlugin = {
|
|
|
1815
1831
|
message: "TailwindCSS configured successfully"
|
|
1816
1832
|
};
|
|
1817
1833
|
} catch (error) {
|
|
1818
|
-
|
|
1834
|
+
logger5.error("Failed to configure TailwindCSS:", error);
|
|
1819
1835
|
return {
|
|
1820
1836
|
files,
|
|
1821
1837
|
success: false,
|
|
@@ -1830,9 +1846,9 @@ var tailwindcssPlugin = {
|
|
|
1830
1846
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
1831
1847
|
try {
|
|
1832
1848
|
await backupManager.restoreAll();
|
|
1833
|
-
|
|
1849
|
+
logger5.info("TailwindCSS configuration rolled back");
|
|
1834
1850
|
} catch (error) {
|
|
1835
|
-
|
|
1851
|
+
logger5.error("Failed to rollback TailwindCSS configuration:", error);
|
|
1836
1852
|
throw error;
|
|
1837
1853
|
}
|
|
1838
1854
|
}
|
|
@@ -1863,7 +1879,7 @@ function getCssContent() {
|
|
|
1863
1879
|
}
|
|
1864
1880
|
function injectVitePlugin(content, isTypeScript) {
|
|
1865
1881
|
if (content.includes("@tailwindcss/vite") || content.includes("tailwindcss()")) {
|
|
1866
|
-
|
|
1882
|
+
logger5.warn("TailwindCSS plugin already present in vite.config");
|
|
1867
1883
|
return content;
|
|
1868
1884
|
}
|
|
1869
1885
|
let modifiedContent = content;
|
|
@@ -1924,7 +1940,7 @@ function injectVitePlugin(content, isTypeScript) {
|
|
|
1924
1940
|
}
|
|
1925
1941
|
function injectTailwindImport(content) {
|
|
1926
1942
|
if (content.includes('@import "tailwindcss"') || content.includes("@import 'tailwindcss'")) {
|
|
1927
|
-
|
|
1943
|
+
logger5.warn("TailwindCSS import already present in CSS file");
|
|
1928
1944
|
return content;
|
|
1929
1945
|
}
|
|
1930
1946
|
return `@import "tailwindcss";
|
|
@@ -1934,6 +1950,7 @@ ${content}`;
|
|
|
1934
1950
|
|
|
1935
1951
|
// src/plugins/css/tailwindcss-nextjs.ts
|
|
1936
1952
|
import { join as join6 } from "path";
|
|
1953
|
+
var logger6 = getModuleLogger();
|
|
1937
1954
|
var tailwindcssNextjsPlugin = {
|
|
1938
1955
|
name: "tailwindcss-nextjs",
|
|
1939
1956
|
displayName: "TailwindCSS (Next.js)",
|
|
@@ -1952,7 +1969,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
1952
1969
|
*/
|
|
1953
1970
|
async install(ctx) {
|
|
1954
1971
|
if (this.detect?.(ctx)) {
|
|
1955
|
-
|
|
1972
|
+
logger6.info("TailwindCSS is already installed");
|
|
1956
1973
|
return {
|
|
1957
1974
|
packages: {},
|
|
1958
1975
|
success: true,
|
|
@@ -1968,7 +1985,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
1968
1985
|
exact: false,
|
|
1969
1986
|
silent: false
|
|
1970
1987
|
});
|
|
1971
|
-
|
|
1988
|
+
logger6.info("Successfully installed TailwindCSS for Next.js");
|
|
1972
1989
|
return {
|
|
1973
1990
|
packages: {
|
|
1974
1991
|
devDependencies: packages
|
|
@@ -1977,7 +1994,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
1977
1994
|
message: `Installed ${packages.join(", ")}`
|
|
1978
1995
|
};
|
|
1979
1996
|
} catch (error) {
|
|
1980
|
-
|
|
1997
|
+
logger6.error("Failed to install TailwindCSS:", error);
|
|
1981
1998
|
return {
|
|
1982
1999
|
packages: {},
|
|
1983
2000
|
success: false,
|
|
@@ -2016,7 +2033,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
2016
2033
|
ctx.fsAdapter
|
|
2017
2034
|
);
|
|
2018
2035
|
if (existingContent.includes("content:") && existingContent.includes("theme:")) {
|
|
2019
|
-
|
|
2036
|
+
logger6.info("TailwindCSS config already exists");
|
|
2020
2037
|
} else {
|
|
2021
2038
|
const tailwindConfig = getTailwindConfigContent(ctx, extension);
|
|
2022
2039
|
await writer.writeFile(tailwindConfigPath, tailwindConfig, {
|
|
@@ -2038,7 +2055,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
2038
2055
|
content: tailwindConfig,
|
|
2039
2056
|
backup: false
|
|
2040
2057
|
});
|
|
2041
|
-
|
|
2058
|
+
logger6.info(`Created tailwind.config.${extension}`);
|
|
2042
2059
|
}
|
|
2043
2060
|
const postcssConfigPath = join6(
|
|
2044
2061
|
projectRoot,
|
|
@@ -2057,7 +2074,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
2057
2074
|
content: postcssConfig,
|
|
2058
2075
|
backup: false
|
|
2059
2076
|
});
|
|
2060
|
-
|
|
2077
|
+
logger6.info(`Created postcss.config.${postcssExtension}`);
|
|
2061
2078
|
}
|
|
2062
2079
|
const cssFiles = [
|
|
2063
2080
|
join6(projectRoot, "app", "globals.css"),
|
|
@@ -2082,7 +2099,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
2082
2099
|
content: modifiedCss,
|
|
2083
2100
|
backup: true
|
|
2084
2101
|
});
|
|
2085
|
-
|
|
2102
|
+
logger6.info(`Updated ${cssPath} with TailwindCSS directives`);
|
|
2086
2103
|
cssFileModified = true;
|
|
2087
2104
|
break;
|
|
2088
2105
|
}
|
|
@@ -2097,7 +2114,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
2097
2114
|
content: cssContent,
|
|
2098
2115
|
backup: false
|
|
2099
2116
|
});
|
|
2100
|
-
|
|
2117
|
+
logger6.info(`Created ${cssPath} with TailwindCSS directives`);
|
|
2101
2118
|
}
|
|
2102
2119
|
return {
|
|
2103
2120
|
files,
|
|
@@ -2105,7 +2122,7 @@ var tailwindcssNextjsPlugin = {
|
|
|
2105
2122
|
message: "TailwindCSS configured successfully for Next.js"
|
|
2106
2123
|
};
|
|
2107
2124
|
} catch (error) {
|
|
2108
|
-
|
|
2125
|
+
logger6.error("Failed to configure TailwindCSS:", error);
|
|
2109
2126
|
return {
|
|
2110
2127
|
files,
|
|
2111
2128
|
success: false,
|
|
@@ -2120,9 +2137,9 @@ var tailwindcssNextjsPlugin = {
|
|
|
2120
2137
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
2121
2138
|
try {
|
|
2122
2139
|
await backupManager.restoreAll();
|
|
2123
|
-
|
|
2140
|
+
logger6.info("TailwindCSS configuration rolled back");
|
|
2124
2141
|
} catch (error) {
|
|
2125
|
-
|
|
2142
|
+
logger6.error("Failed to rollback TailwindCSS configuration:", error);
|
|
2126
2143
|
throw error;
|
|
2127
2144
|
}
|
|
2128
2145
|
}
|
|
@@ -2194,7 +2211,7 @@ function getCssContent2() {
|
|
|
2194
2211
|
}
|
|
2195
2212
|
function injectTailwindDirectives(content) {
|
|
2196
2213
|
if (content.includes("@tailwind base") || content.includes("@tailwind components") || content.includes("@tailwind utilities")) {
|
|
2197
|
-
|
|
2214
|
+
logger6.warn("TailwindCSS directives already present in CSS file");
|
|
2198
2215
|
return content;
|
|
2199
2216
|
}
|
|
2200
2217
|
return `@tailwind base;
|
|
@@ -2206,6 +2223,7 @@ ${content}`;
|
|
|
2206
2223
|
|
|
2207
2224
|
// src/plugins/forms/react-hook-form.ts
|
|
2208
2225
|
import { resolve as resolve7, join as join7 } from "path";
|
|
2226
|
+
var logger7 = getModuleLogger();
|
|
2209
2227
|
var reactHookFormPlugin = {
|
|
2210
2228
|
name: "react-hook-form",
|
|
2211
2229
|
displayName: "React Hook Form",
|
|
@@ -2224,7 +2242,7 @@ var reactHookFormPlugin = {
|
|
|
2224
2242
|
*/
|
|
2225
2243
|
async install(ctx) {
|
|
2226
2244
|
if (this.detect?.(ctx)) {
|
|
2227
|
-
|
|
2245
|
+
logger7.info("React Hook Form is already installed");
|
|
2228
2246
|
return {
|
|
2229
2247
|
packages: {},
|
|
2230
2248
|
success: true,
|
|
@@ -2239,7 +2257,7 @@ var reactHookFormPlugin = {
|
|
|
2239
2257
|
exact: false,
|
|
2240
2258
|
silent: false
|
|
2241
2259
|
});
|
|
2242
|
-
|
|
2260
|
+
logger7.info("Successfully installed React Hook Form");
|
|
2243
2261
|
return {
|
|
2244
2262
|
packages: {
|
|
2245
2263
|
dependencies: ["react-hook-form"]
|
|
@@ -2248,7 +2266,7 @@ var reactHookFormPlugin = {
|
|
|
2248
2266
|
message: "Installed react-hook-form"
|
|
2249
2267
|
};
|
|
2250
2268
|
} catch (error) {
|
|
2251
|
-
|
|
2269
|
+
logger7.error("Failed to install React Hook Form:", error);
|
|
2252
2270
|
return {
|
|
2253
2271
|
packages: {},
|
|
2254
2272
|
success: false,
|
|
@@ -2266,8 +2284,7 @@ var reactHookFormPlugin = {
|
|
|
2266
2284
|
* Documentation : https://react-hook-form.com/get-started
|
|
2267
2285
|
*/
|
|
2268
2286
|
async configure(ctx) {
|
|
2269
|
-
const backupManager =
|
|
2270
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
2287
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
2271
2288
|
const files = [];
|
|
2272
2289
|
const srcDir = resolve7(ctx.projectRoot, ctx.srcDir);
|
|
2273
2290
|
const extension = ctx.typescript ? "tsx" : "jsx";
|
|
@@ -2283,7 +2300,7 @@ var reactHookFormPlugin = {
|
|
|
2283
2300
|
content: exampleFormContent,
|
|
2284
2301
|
backup: false
|
|
2285
2302
|
});
|
|
2286
|
-
|
|
2303
|
+
logger7.info(`Created example form: ${exampleFormPath}`);
|
|
2287
2304
|
const validatedFormPath = join7(formsDir, `ValidatedForm.${extension}`);
|
|
2288
2305
|
const validatedFormContent = ctx.typescript ? getValidatedFormContentTS() : getValidatedFormContentJS();
|
|
2289
2306
|
await writer.createFile(validatedFormPath, validatedFormContent);
|
|
@@ -2293,7 +2310,7 @@ var reactHookFormPlugin = {
|
|
|
2293
2310
|
content: validatedFormContent,
|
|
2294
2311
|
backup: false
|
|
2295
2312
|
});
|
|
2296
|
-
|
|
2313
|
+
logger7.info(`Created validated form: ${validatedFormPath}`);
|
|
2297
2314
|
const indexPath = join7(formsDir, `index.${ctx.typescript ? "ts" : "js"}`);
|
|
2298
2315
|
const indexContent = ctx.typescript ? getIndexContentTS3() : getIndexContentJS3();
|
|
2299
2316
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -2303,14 +2320,14 @@ var reactHookFormPlugin = {
|
|
|
2303
2320
|
content: indexContent,
|
|
2304
2321
|
backup: false
|
|
2305
2322
|
});
|
|
2306
|
-
|
|
2323
|
+
logger7.info(`Created forms index: ${indexPath}`);
|
|
2307
2324
|
return {
|
|
2308
2325
|
files,
|
|
2309
2326
|
success: true,
|
|
2310
2327
|
message: "React Hook Form configured successfully"
|
|
2311
2328
|
};
|
|
2312
2329
|
} catch (error) {
|
|
2313
|
-
|
|
2330
|
+
logger7.error("Failed to configure React Hook Form:", error);
|
|
2314
2331
|
await backupManager.restoreAll();
|
|
2315
2332
|
return {
|
|
2316
2333
|
files,
|
|
@@ -2323,12 +2340,12 @@ var reactHookFormPlugin = {
|
|
|
2323
2340
|
* Rollback de la configuration React Hook Form
|
|
2324
2341
|
*/
|
|
2325
2342
|
async rollback(_ctx) {
|
|
2326
|
-
const backupManager =
|
|
2343
|
+
const backupManager = getRollbackManager(_ctx);
|
|
2327
2344
|
try {
|
|
2328
2345
|
await backupManager.restoreAll();
|
|
2329
|
-
|
|
2346
|
+
logger7.info("React Hook Form configuration rolled back");
|
|
2330
2347
|
} catch (error) {
|
|
2331
|
-
|
|
2348
|
+
logger7.error("Failed to rollback React Hook Form configuration:", error);
|
|
2332
2349
|
throw error;
|
|
2333
2350
|
}
|
|
2334
2351
|
}
|
|
@@ -2368,7 +2385,7 @@ export function ExampleForm() {
|
|
|
2368
2385
|
} = useForm<FormInputs>()
|
|
2369
2386
|
|
|
2370
2387
|
const onSubmit: SubmitHandler<FormInputs> = (data) => {
|
|
2371
|
-
|
|
2388
|
+
logger.info(data)
|
|
2372
2389
|
// Traiter les donn\xE9es du formulaire ici
|
|
2373
2390
|
}
|
|
2374
2391
|
|
|
@@ -2439,7 +2456,7 @@ export function ExampleForm() {
|
|
|
2439
2456
|
} = useForm()
|
|
2440
2457
|
|
|
2441
2458
|
const onSubmit = (data) => {
|
|
2442
|
-
|
|
2459
|
+
logger.info(data)
|
|
2443
2460
|
// Traiter les donn\xE9es du formulaire ici
|
|
2444
2461
|
}
|
|
2445
2462
|
|
|
@@ -2528,7 +2545,7 @@ export function ValidatedForm() {
|
|
|
2528
2545
|
} = useForm<FormInputs>()
|
|
2529
2546
|
|
|
2530
2547
|
const onSubmit: SubmitHandler<FormInputs> = (data) => {
|
|
2531
|
-
|
|
2548
|
+
logger.info(data)
|
|
2532
2549
|
// Traiter les donn\xE9es du formulaire ici
|
|
2533
2550
|
}
|
|
2534
2551
|
|
|
@@ -2634,7 +2651,7 @@ export function ValidatedForm() {
|
|
|
2634
2651
|
} = useForm()
|
|
2635
2652
|
|
|
2636
2653
|
const onSubmit = (data) => {
|
|
2637
|
-
|
|
2654
|
+
logger.info(data)
|
|
2638
2655
|
// Traiter les donn\xE9es du formulaire ici
|
|
2639
2656
|
}
|
|
2640
2657
|
|
|
@@ -2731,6 +2748,7 @@ export { ValidatedForm } from './ValidatedForm'
|
|
|
2731
2748
|
|
|
2732
2749
|
// src/plugins/forms/zod.ts
|
|
2733
2750
|
import { join as join8 } from "path";
|
|
2751
|
+
var logger8 = getModuleLogger();
|
|
2734
2752
|
var zodPlugin = {
|
|
2735
2753
|
name: "zod",
|
|
2736
2754
|
displayName: "Zod",
|
|
@@ -2749,7 +2767,7 @@ var zodPlugin = {
|
|
|
2749
2767
|
*/
|
|
2750
2768
|
async install(ctx) {
|
|
2751
2769
|
if (this.detect?.(ctx)) {
|
|
2752
|
-
|
|
2770
|
+
logger8.info("Zod is already installed");
|
|
2753
2771
|
return {
|
|
2754
2772
|
packages: {},
|
|
2755
2773
|
success: true,
|
|
@@ -2765,7 +2783,7 @@ var zodPlugin = {
|
|
|
2765
2783
|
exact: false,
|
|
2766
2784
|
silent: false
|
|
2767
2785
|
});
|
|
2768
|
-
|
|
2786
|
+
logger8.info("Successfully installed Zod");
|
|
2769
2787
|
return {
|
|
2770
2788
|
packages: {
|
|
2771
2789
|
dependencies: packages
|
|
@@ -2774,7 +2792,7 @@ var zodPlugin = {
|
|
|
2774
2792
|
message: `Installed Zod: ${packages.join(", ")}`
|
|
2775
2793
|
};
|
|
2776
2794
|
} catch (error) {
|
|
2777
|
-
|
|
2795
|
+
logger8.error("Failed to install Zod:", error);
|
|
2778
2796
|
return {
|
|
2779
2797
|
packages: {},
|
|
2780
2798
|
success: false,
|
|
@@ -2792,8 +2810,7 @@ var zodPlugin = {
|
|
|
2792
2810
|
* Documentation : https://zod.dev
|
|
2793
2811
|
*/
|
|
2794
2812
|
async configure(ctx) {
|
|
2795
|
-
const backupManager =
|
|
2796
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
2813
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
2797
2814
|
const files = [];
|
|
2798
2815
|
const srcDir = join8(ctx.projectRoot, ctx.srcDir);
|
|
2799
2816
|
try {
|
|
@@ -2811,7 +2828,7 @@ var zodPlugin = {
|
|
|
2811
2828
|
content: userSchemaContent,
|
|
2812
2829
|
backup: false
|
|
2813
2830
|
});
|
|
2814
|
-
|
|
2831
|
+
logger8.info(`Created user schema: ${userSchemaPath}`);
|
|
2815
2832
|
const indexPath = join8(
|
|
2816
2833
|
schemasDir,
|
|
2817
2834
|
`index.${ctx.typescript ? "ts" : "js"}`
|
|
@@ -2824,14 +2841,14 @@ var zodPlugin = {
|
|
|
2824
2841
|
content: indexContent,
|
|
2825
2842
|
backup: false
|
|
2826
2843
|
});
|
|
2827
|
-
|
|
2844
|
+
logger8.info(`Created schemas index: ${indexPath}`);
|
|
2828
2845
|
return {
|
|
2829
2846
|
files,
|
|
2830
2847
|
success: true,
|
|
2831
2848
|
message: "Zod configured successfully"
|
|
2832
2849
|
};
|
|
2833
2850
|
} catch (error) {
|
|
2834
|
-
|
|
2851
|
+
logger8.error("Failed to configure Zod:", error);
|
|
2835
2852
|
await backupManager.restoreAll();
|
|
2836
2853
|
return {
|
|
2837
2854
|
files,
|
|
@@ -2844,12 +2861,12 @@ var zodPlugin = {
|
|
|
2844
2861
|
* Rollback de la configuration Zod
|
|
2845
2862
|
*/
|
|
2846
2863
|
async rollback(_ctx) {
|
|
2847
|
-
const backupManager =
|
|
2864
|
+
const backupManager = getRollbackManager(_ctx);
|
|
2848
2865
|
try {
|
|
2849
2866
|
await backupManager.restoreAll();
|
|
2850
|
-
|
|
2867
|
+
logger8.info("Zod configuration rolled back");
|
|
2851
2868
|
} catch (error) {
|
|
2852
|
-
|
|
2869
|
+
logger8.error("Failed to rollback Zod configuration:", error);
|
|
2853
2870
|
throw error;
|
|
2854
2871
|
}
|
|
2855
2872
|
}
|
|
@@ -2877,9 +2894,9 @@ function getUserSchemaContentTS() {
|
|
|
2877
2894
|
* })
|
|
2878
2895
|
*
|
|
2879
2896
|
* if (result.success) {
|
|
2880
|
-
*
|
|
2897
|
+
* logger.info(result.data) // Type-safe!
|
|
2881
2898
|
* } else {
|
|
2882
|
-
*
|
|
2899
|
+
* logger.error(result.error)
|
|
2883
2900
|
* }
|
|
2884
2901
|
* \`\`\`
|
|
2885
2902
|
*/
|
|
@@ -2923,6 +2940,7 @@ function getIndexContentJS4() {
|
|
|
2923
2940
|
|
|
2924
2941
|
// src/plugins/http/axios.ts
|
|
2925
2942
|
import { resolve as resolve8, join as join9 } from "path";
|
|
2943
|
+
var logger9 = getModuleLogger();
|
|
2926
2944
|
var axiosPlugin = {
|
|
2927
2945
|
name: "axios",
|
|
2928
2946
|
displayName: "Axios",
|
|
@@ -2941,7 +2959,7 @@ var axiosPlugin = {
|
|
|
2941
2959
|
*/
|
|
2942
2960
|
async install(ctx) {
|
|
2943
2961
|
if (this.detect?.(ctx)) {
|
|
2944
|
-
|
|
2962
|
+
logger9.info("Axios is already installed");
|
|
2945
2963
|
return {
|
|
2946
2964
|
packages: {},
|
|
2947
2965
|
success: true,
|
|
@@ -2957,7 +2975,7 @@ var axiosPlugin = {
|
|
|
2957
2975
|
exact: false,
|
|
2958
2976
|
silent: false
|
|
2959
2977
|
});
|
|
2960
|
-
|
|
2978
|
+
logger9.info("Successfully installed Axios");
|
|
2961
2979
|
return {
|
|
2962
2980
|
packages: {
|
|
2963
2981
|
dependencies: packages
|
|
@@ -2966,7 +2984,7 @@ var axiosPlugin = {
|
|
|
2966
2984
|
message: `Installed ${packages.join(", ")}`
|
|
2967
2985
|
};
|
|
2968
2986
|
} catch (error) {
|
|
2969
|
-
|
|
2987
|
+
logger9.error("Failed to install Axios:", error);
|
|
2970
2988
|
return {
|
|
2971
2989
|
packages: {},
|
|
2972
2990
|
success: false,
|
|
@@ -2984,8 +3002,7 @@ var axiosPlugin = {
|
|
|
2984
3002
|
* Documentation : https://axios-http.com
|
|
2985
3003
|
*/
|
|
2986
3004
|
async configure(ctx) {
|
|
2987
|
-
const
|
|
2988
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
3005
|
+
const { writer } = getPluginServices(ctx);
|
|
2989
3006
|
const files = [];
|
|
2990
3007
|
const srcDir = resolve8(ctx.projectRoot, ctx.srcDir);
|
|
2991
3008
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -3001,7 +3018,7 @@ var axiosPlugin = {
|
|
|
3001
3018
|
content: apiContent,
|
|
3002
3019
|
backup: false
|
|
3003
3020
|
});
|
|
3004
|
-
|
|
3021
|
+
logger9.info(`Created Axios instance: ${apiPath}`);
|
|
3005
3022
|
if (ctx.typescript) {
|
|
3006
3023
|
const typesPath = join9(libDir, "api-types.ts");
|
|
3007
3024
|
const typesContent = getApiTypesContentTS();
|
|
@@ -3012,7 +3029,7 @@ var axiosPlugin = {
|
|
|
3012
3029
|
content: typesContent,
|
|
3013
3030
|
backup: false
|
|
3014
3031
|
});
|
|
3015
|
-
|
|
3032
|
+
logger9.info(`Created API types: ${typesPath}`);
|
|
3016
3033
|
}
|
|
3017
3034
|
return {
|
|
3018
3035
|
files,
|
|
@@ -3020,7 +3037,7 @@ var axiosPlugin = {
|
|
|
3020
3037
|
message: "Axios configured successfully"
|
|
3021
3038
|
};
|
|
3022
3039
|
} catch (error) {
|
|
3023
|
-
|
|
3040
|
+
logger9.error("Failed to configure Axios:", error);
|
|
3024
3041
|
return {
|
|
3025
3042
|
files,
|
|
3026
3043
|
success: false,
|
|
@@ -3032,12 +3049,12 @@ var axiosPlugin = {
|
|
|
3032
3049
|
* Rollback de la configuration Axios
|
|
3033
3050
|
*/
|
|
3034
3051
|
async rollback(_ctx) {
|
|
3035
|
-
const backupManager =
|
|
3052
|
+
const backupManager = getRollbackManager(_ctx);
|
|
3036
3053
|
try {
|
|
3037
3054
|
await backupManager.restoreAll();
|
|
3038
|
-
|
|
3055
|
+
logger9.info("Axios configuration rolled back");
|
|
3039
3056
|
} catch (error) {
|
|
3040
|
-
|
|
3057
|
+
logger9.error("Failed to rollback Axios configuration:", error);
|
|
3041
3058
|
throw error;
|
|
3042
3059
|
}
|
|
3043
3060
|
}
|
|
@@ -3097,27 +3114,27 @@ api.interceptors.response.use(
|
|
|
3097
3114
|
switch (error.response.status) {
|
|
3098
3115
|
case 401:
|
|
3099
3116
|
// Non autoris\xE9 - rediriger vers la page de connexion
|
|
3100
|
-
|
|
3117
|
+
logger.error('Unauthorized - redirecting to login')
|
|
3101
3118
|
// window.location.href = '/login'
|
|
3102
3119
|
break
|
|
3103
3120
|
case 403:
|
|
3104
|
-
|
|
3121
|
+
logger.error('Forbidden')
|
|
3105
3122
|
break
|
|
3106
3123
|
case 404:
|
|
3107
|
-
|
|
3124
|
+
logger.error('Not found')
|
|
3108
3125
|
break
|
|
3109
3126
|
case 500:
|
|
3110
|
-
|
|
3127
|
+
logger.error('Server error')
|
|
3111
3128
|
break
|
|
3112
3129
|
default:
|
|
3113
|
-
|
|
3130
|
+
logger.error('Request failed:', error.response.status)
|
|
3114
3131
|
}
|
|
3115
3132
|
} else if (error.request) {
|
|
3116
3133
|
// La requ\xEAte a \xE9t\xE9 faite mais aucune r\xE9ponse n'a \xE9t\xE9 re\xE7ue
|
|
3117
|
-
|
|
3134
|
+
logger.error('No response received:', error.request)
|
|
3118
3135
|
} else {
|
|
3119
3136
|
// Une erreur s'est produite lors de la configuration de la requ\xEAte
|
|
3120
|
-
|
|
3137
|
+
logger.error('Error setting up request:', error.message)
|
|
3121
3138
|
}
|
|
3122
3139
|
return Promise.reject(error)
|
|
3123
3140
|
}
|
|
@@ -3181,27 +3198,27 @@ api.interceptors.response.use(
|
|
|
3181
3198
|
switch (error.response.status) {
|
|
3182
3199
|
case 401:
|
|
3183
3200
|
// Non autoris\xE9 - rediriger vers la page de connexion
|
|
3184
|
-
|
|
3201
|
+
logger.error('Unauthorized - redirecting to login')
|
|
3185
3202
|
// window.location.href = '/login'
|
|
3186
3203
|
break
|
|
3187
3204
|
case 403:
|
|
3188
|
-
|
|
3205
|
+
logger.error('Forbidden')
|
|
3189
3206
|
break
|
|
3190
3207
|
case 404:
|
|
3191
|
-
|
|
3208
|
+
logger.error('Not found')
|
|
3192
3209
|
break
|
|
3193
3210
|
case 500:
|
|
3194
|
-
|
|
3211
|
+
logger.error('Server error')
|
|
3195
3212
|
break
|
|
3196
3213
|
default:
|
|
3197
|
-
|
|
3214
|
+
logger.error('Request failed:', error.response.status)
|
|
3198
3215
|
}
|
|
3199
3216
|
} else if (error.request) {
|
|
3200
3217
|
// La requ\xEAte a \xE9t\xE9 faite mais aucune r\xE9ponse n'a \xE9t\xE9 re\xE7ue
|
|
3201
|
-
|
|
3218
|
+
logger.error('No response received:', error.request)
|
|
3202
3219
|
} else {
|
|
3203
3220
|
// Une erreur s'est produite lors de la configuration de la requ\xEAte
|
|
3204
|
-
|
|
3221
|
+
logger.error('Error setting up request:', error.message)
|
|
3205
3222
|
}
|
|
3206
3223
|
return Promise.reject(error)
|
|
3207
3224
|
}
|
|
@@ -3258,6 +3275,7 @@ export interface ApiError {
|
|
|
3258
3275
|
|
|
3259
3276
|
// src/plugins/http/tanstack-query.ts
|
|
3260
3277
|
import { resolve as resolve9, join as join10 } from "path";
|
|
3278
|
+
var logger10 = getModuleLogger();
|
|
3261
3279
|
var tanstackQueryPlugin = {
|
|
3262
3280
|
name: "@tanstack/react-query",
|
|
3263
3281
|
displayName: "TanStack Query",
|
|
@@ -3276,7 +3294,7 @@ var tanstackQueryPlugin = {
|
|
|
3276
3294
|
*/
|
|
3277
3295
|
async install(ctx) {
|
|
3278
3296
|
if (this.detect?.(ctx)) {
|
|
3279
|
-
|
|
3297
|
+
logger10.info("TanStack Query is already installed");
|
|
3280
3298
|
return {
|
|
3281
3299
|
packages: {},
|
|
3282
3300
|
success: true,
|
|
@@ -3292,7 +3310,7 @@ var tanstackQueryPlugin = {
|
|
|
3292
3310
|
exact: false,
|
|
3293
3311
|
silent: false
|
|
3294
3312
|
});
|
|
3295
|
-
|
|
3313
|
+
logger10.info("Successfully installed TanStack Query");
|
|
3296
3314
|
return {
|
|
3297
3315
|
packages: {
|
|
3298
3316
|
dependencies: packages
|
|
@@ -3301,7 +3319,7 @@ var tanstackQueryPlugin = {
|
|
|
3301
3319
|
message: `Installed ${packages.join(", ")}`
|
|
3302
3320
|
};
|
|
3303
3321
|
} catch (error) {
|
|
3304
|
-
|
|
3322
|
+
logger10.error("Failed to install TanStack Query:", error);
|
|
3305
3323
|
return {
|
|
3306
3324
|
packages: {},
|
|
3307
3325
|
success: false,
|
|
@@ -3323,8 +3341,7 @@ var tanstackQueryPlugin = {
|
|
|
3323
3341
|
* Documentation : https://tanstack.com/query/latest/docs/framework/react/quick-start
|
|
3324
3342
|
*/
|
|
3325
3343
|
async configure(ctx) {
|
|
3326
|
-
const
|
|
3327
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
3344
|
+
const { writer } = getPluginServices(ctx);
|
|
3328
3345
|
const files = [];
|
|
3329
3346
|
const srcDir = resolve9(ctx.projectRoot, ctx.srcDir);
|
|
3330
3347
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -3340,7 +3357,7 @@ var tanstackQueryPlugin = {
|
|
|
3340
3357
|
content: queryClientContent,
|
|
3341
3358
|
backup: false
|
|
3342
3359
|
});
|
|
3343
|
-
|
|
3360
|
+
logger10.info(`Created query client: ${queryClientPath}`);
|
|
3344
3361
|
const queriesDir = join10(libDir, "queries");
|
|
3345
3362
|
await ensureDirectory(queriesDir, ctx.fsAdapter);
|
|
3346
3363
|
const exampleQueryPath = join10(queriesDir, `example.${extension}`);
|
|
@@ -3352,7 +3369,7 @@ var tanstackQueryPlugin = {
|
|
|
3352
3369
|
content: exampleQueryContent,
|
|
3353
3370
|
backup: false
|
|
3354
3371
|
});
|
|
3355
|
-
|
|
3372
|
+
logger10.info(`Created example query: ${exampleQueryPath}`);
|
|
3356
3373
|
const mutationsDir = join10(libDir, "mutations");
|
|
3357
3374
|
await ensureDirectory(mutationsDir, ctx.fsAdapter);
|
|
3358
3375
|
const exampleMutationPath = join10(mutationsDir, `example.${extension}`);
|
|
@@ -3364,7 +3381,7 @@ var tanstackQueryPlugin = {
|
|
|
3364
3381
|
content: exampleMutationContent,
|
|
3365
3382
|
backup: false
|
|
3366
3383
|
});
|
|
3367
|
-
|
|
3384
|
+
logger10.info(`Created example mutation: ${exampleMutationPath}`);
|
|
3368
3385
|
const appPath = join10(srcDir, `App.${ctx.typescript ? "tsx" : "jsx"}`);
|
|
3369
3386
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
3370
3387
|
if (appExists) {
|
|
@@ -3384,7 +3401,7 @@ var tanstackQueryPlugin = {
|
|
|
3384
3401
|
content: modifiedAppContent,
|
|
3385
3402
|
backup: true
|
|
3386
3403
|
});
|
|
3387
|
-
|
|
3404
|
+
logger10.info(
|
|
3388
3405
|
`Updated App.${ctx.typescript ? "tsx" : "jsx"} with QueryClientProvider`
|
|
3389
3406
|
);
|
|
3390
3407
|
} else {
|
|
@@ -3396,7 +3413,7 @@ var tanstackQueryPlugin = {
|
|
|
3396
3413
|
content: appContent,
|
|
3397
3414
|
backup: false
|
|
3398
3415
|
});
|
|
3399
|
-
|
|
3416
|
+
logger10.info(
|
|
3400
3417
|
`Created App.${ctx.typescript ? "tsx" : "jsx"} with QueryClientProvider`
|
|
3401
3418
|
);
|
|
3402
3419
|
}
|
|
@@ -3406,7 +3423,7 @@ var tanstackQueryPlugin = {
|
|
|
3406
3423
|
message: "TanStack Query configured successfully"
|
|
3407
3424
|
};
|
|
3408
3425
|
} catch (error) {
|
|
3409
|
-
|
|
3426
|
+
logger10.error("Failed to configure TanStack Query:", error);
|
|
3410
3427
|
return {
|
|
3411
3428
|
files,
|
|
3412
3429
|
success: false,
|
|
@@ -3418,12 +3435,12 @@ var tanstackQueryPlugin = {
|
|
|
3418
3435
|
* Rollback de la configuration TanStack Query
|
|
3419
3436
|
*/
|
|
3420
3437
|
async rollback(_ctx) {
|
|
3421
|
-
const backupManager =
|
|
3438
|
+
const backupManager = getRollbackManager(_ctx);
|
|
3422
3439
|
try {
|
|
3423
3440
|
await backupManager.restoreAll();
|
|
3424
|
-
|
|
3441
|
+
logger10.info("TanStack Query configuration rolled back");
|
|
3425
3442
|
} catch (error) {
|
|
3426
|
-
|
|
3443
|
+
logger10.error("Failed to rollback TanStack Query configuration:", error);
|
|
3427
3444
|
throw error;
|
|
3428
3445
|
}
|
|
3429
3446
|
}
|
|
@@ -3727,7 +3744,7 @@ export default App
|
|
|
3727
3744
|
}
|
|
3728
3745
|
function injectQueryClientProvider(content, isTypeScript) {
|
|
3729
3746
|
if (content.includes("QueryClientProvider") && content.includes("@tanstack/react-query")) {
|
|
3730
|
-
|
|
3747
|
+
logger10.warn("QueryClientProvider already present in App file");
|
|
3731
3748
|
return content;
|
|
3732
3749
|
}
|
|
3733
3750
|
const hasQueryClientProviderImport = content.includes("from '@tanstack/react-query'") || content.includes('from "@tanstack/react-query"');
|
|
@@ -3812,6 +3829,7 @@ export default App
|
|
|
3812
3829
|
|
|
3813
3830
|
// src/plugins/http/tanstack-query-vue.ts
|
|
3814
3831
|
import { join as join11 } from "path";
|
|
3832
|
+
var logger11 = getModuleLogger();
|
|
3815
3833
|
var tanstackVueQueryPlugin = {
|
|
3816
3834
|
name: "@tanstack/vue-query",
|
|
3817
3835
|
displayName: "TanStack Query (Vue)",
|
|
@@ -3830,7 +3848,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3830
3848
|
*/
|
|
3831
3849
|
async install(ctx) {
|
|
3832
3850
|
if (this.detect?.(ctx)) {
|
|
3833
|
-
|
|
3851
|
+
logger11.info("TanStack Vue Query is already installed");
|
|
3834
3852
|
return {
|
|
3835
3853
|
packages: {},
|
|
3836
3854
|
success: true,
|
|
@@ -3846,7 +3864,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3846
3864
|
exact: false,
|
|
3847
3865
|
silent: false
|
|
3848
3866
|
});
|
|
3849
|
-
|
|
3867
|
+
logger11.info("Successfully installed TanStack Vue Query");
|
|
3850
3868
|
return {
|
|
3851
3869
|
packages: {
|
|
3852
3870
|
dependencies: packages
|
|
@@ -3855,7 +3873,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3855
3873
|
message: `Installed ${packages.join(", ")}`
|
|
3856
3874
|
};
|
|
3857
3875
|
} catch (error) {
|
|
3858
|
-
|
|
3876
|
+
logger11.error("Failed to install TanStack Vue Query:", error);
|
|
3859
3877
|
return {
|
|
3860
3878
|
packages: {},
|
|
3861
3879
|
success: false,
|
|
@@ -3872,8 +3890,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3872
3890
|
* - src/main.ts (ou main.js)
|
|
3873
3891
|
*/
|
|
3874
3892
|
async configure(ctx) {
|
|
3875
|
-
const backupManager =
|
|
3876
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
3893
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
3877
3894
|
const files = [];
|
|
3878
3895
|
const srcDir = join11(ctx.projectRoot, ctx.srcDir);
|
|
3879
3896
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -3894,7 +3911,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3894
3911
|
content: queryClientContent,
|
|
3895
3912
|
backup: false
|
|
3896
3913
|
});
|
|
3897
|
-
|
|
3914
|
+
logger11.info(`Created TanStack Query client: ${queryClientPath}`);
|
|
3898
3915
|
}
|
|
3899
3916
|
const mainPath = join11(srcDir, `main.${extension}`);
|
|
3900
3917
|
const mainExists = await checkPathExists(mainPath, ctx.fsAdapter);
|
|
@@ -3913,10 +3930,10 @@ var tanstackVueQueryPlugin = {
|
|
|
3913
3930
|
content: updatedMain,
|
|
3914
3931
|
backup: true
|
|
3915
3932
|
});
|
|
3916
|
-
|
|
3933
|
+
logger11.info(`Updated main file with Vue Query: ${mainPath}`);
|
|
3917
3934
|
}
|
|
3918
3935
|
} else {
|
|
3919
|
-
|
|
3936
|
+
logger11.warn(`Main file not found: ${mainPath}`);
|
|
3920
3937
|
}
|
|
3921
3938
|
return {
|
|
3922
3939
|
files,
|
|
@@ -3924,7 +3941,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3924
3941
|
message: "TanStack Vue Query configured successfully"
|
|
3925
3942
|
};
|
|
3926
3943
|
} catch (error) {
|
|
3927
|
-
|
|
3944
|
+
logger11.error("Failed to configure TanStack Vue Query:", error);
|
|
3928
3945
|
await backupManager.restoreAll();
|
|
3929
3946
|
return {
|
|
3930
3947
|
files,
|
|
@@ -3937,12 +3954,12 @@ var tanstackVueQueryPlugin = {
|
|
|
3937
3954
|
* Rollback de la configuration TanStack Vue Query
|
|
3938
3955
|
*/
|
|
3939
3956
|
async rollback(_ctx) {
|
|
3940
|
-
const backupManager =
|
|
3957
|
+
const backupManager = getRollbackManager(_ctx);
|
|
3941
3958
|
try {
|
|
3942
3959
|
await backupManager.restoreAll();
|
|
3943
|
-
|
|
3960
|
+
logger11.info("TanStack Vue Query configuration rolled back");
|
|
3944
3961
|
} catch (error) {
|
|
3945
|
-
|
|
3962
|
+
logger11.error(
|
|
3946
3963
|
"Failed to rollback TanStack Vue Query configuration:",
|
|
3947
3964
|
error
|
|
3948
3965
|
);
|
|
@@ -3999,6 +4016,7 @@ app.use(VueQueryPlugin, { queryClient })`
|
|
|
3999
4016
|
|
|
4000
4017
|
// src/plugins/i18n/vue-i18n.ts
|
|
4001
4018
|
import { join as join12 } from "path";
|
|
4019
|
+
var logger12 = getModuleLogger();
|
|
4002
4020
|
var vueI18nPlugin = {
|
|
4003
4021
|
name: "vue-i18n",
|
|
4004
4022
|
displayName: "Vue I18n",
|
|
@@ -4017,7 +4035,7 @@ var vueI18nPlugin = {
|
|
|
4017
4035
|
*/
|
|
4018
4036
|
async install(ctx) {
|
|
4019
4037
|
if (this.detect?.(ctx)) {
|
|
4020
|
-
|
|
4038
|
+
logger12.info("vue-i18n is already installed");
|
|
4021
4039
|
return {
|
|
4022
4040
|
packages: {},
|
|
4023
4041
|
success: true,
|
|
@@ -4033,7 +4051,7 @@ var vueI18nPlugin = {
|
|
|
4033
4051
|
exact: false,
|
|
4034
4052
|
silent: false
|
|
4035
4053
|
});
|
|
4036
|
-
|
|
4054
|
+
logger12.info("Successfully installed vue-i18n");
|
|
4037
4055
|
return {
|
|
4038
4056
|
packages: {
|
|
4039
4057
|
dependencies: packages
|
|
@@ -4042,7 +4060,7 @@ var vueI18nPlugin = {
|
|
|
4042
4060
|
message: `Installed vue-i18n: ${packages.join(", ")}`
|
|
4043
4061
|
};
|
|
4044
4062
|
} catch (error) {
|
|
4045
|
-
|
|
4063
|
+
logger12.error("Failed to install vue-i18n:", error);
|
|
4046
4064
|
return {
|
|
4047
4065
|
packages: {},
|
|
4048
4066
|
success: false,
|
|
@@ -4079,7 +4097,7 @@ var vueI18nPlugin = {
|
|
|
4079
4097
|
content: messagesContent,
|
|
4080
4098
|
backup: false
|
|
4081
4099
|
});
|
|
4082
|
-
|
|
4100
|
+
logger12.info(`Created i18n messages: ${messagesPath}`);
|
|
4083
4101
|
}
|
|
4084
4102
|
const i18nIndexPath = join12(i18nDir, `index.${extension}`);
|
|
4085
4103
|
const i18nIndexExists = await checkPathExists(
|
|
@@ -4095,7 +4113,7 @@ var vueI18nPlugin = {
|
|
|
4095
4113
|
content: i18nIndexContent,
|
|
4096
4114
|
backup: false
|
|
4097
4115
|
});
|
|
4098
|
-
|
|
4116
|
+
logger12.info(`Created i18n setup: ${i18nIndexPath}`);
|
|
4099
4117
|
}
|
|
4100
4118
|
const mainPath = join12(srcDir, `main.${extension}`);
|
|
4101
4119
|
const mainExists = await checkPathExists(mainPath, ctx.fsAdapter);
|
|
@@ -4114,10 +4132,10 @@ var vueI18nPlugin = {
|
|
|
4114
4132
|
content: updatedMain,
|
|
4115
4133
|
backup: true
|
|
4116
4134
|
});
|
|
4117
|
-
|
|
4135
|
+
logger12.info(`Updated main file with i18n: ${mainPath}`);
|
|
4118
4136
|
}
|
|
4119
4137
|
} else {
|
|
4120
|
-
|
|
4138
|
+
logger12.warn(`Main file not found: ${mainPath}`);
|
|
4121
4139
|
}
|
|
4122
4140
|
return {
|
|
4123
4141
|
files,
|
|
@@ -4125,7 +4143,7 @@ var vueI18nPlugin = {
|
|
|
4125
4143
|
message: "Vue I18n configured successfully"
|
|
4126
4144
|
};
|
|
4127
4145
|
} catch (error) {
|
|
4128
|
-
|
|
4146
|
+
logger12.error("Failed to configure Vue I18n:", error);
|
|
4129
4147
|
await backupManager.restoreAll();
|
|
4130
4148
|
return {
|
|
4131
4149
|
files,
|
|
@@ -4141,9 +4159,9 @@ var vueI18nPlugin = {
|
|
|
4141
4159
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4142
4160
|
try {
|
|
4143
4161
|
await backupManager.restoreAll();
|
|
4144
|
-
|
|
4162
|
+
logger12.info("Vue I18n configuration rolled back");
|
|
4145
4163
|
} catch (error) {
|
|
4146
|
-
|
|
4164
|
+
logger12.error("Failed to rollback Vue I18n configuration:", error);
|
|
4147
4165
|
throw error;
|
|
4148
4166
|
}
|
|
4149
4167
|
}
|
|
@@ -4217,6 +4235,7 @@ app.use(i18n)`
|
|
|
4217
4235
|
|
|
4218
4236
|
// src/plugins/nextjs/api-routes.ts
|
|
4219
4237
|
import { join as join13 } from "path";
|
|
4238
|
+
var logger13 = getModuleLogger();
|
|
4220
4239
|
var nextjsApiRoutesPlugin = {
|
|
4221
4240
|
name: "nextjs-api-routes",
|
|
4222
4241
|
displayName: "Next.js API Routes",
|
|
@@ -4234,7 +4253,7 @@ var nextjsApiRoutesPlugin = {
|
|
|
4234
4253
|
* Pas d'installation nécessaire
|
|
4235
4254
|
*/
|
|
4236
4255
|
install(_ctx) {
|
|
4237
|
-
|
|
4256
|
+
logger13.info("API routes are files, no installation needed");
|
|
4238
4257
|
return Promise.resolve({
|
|
4239
4258
|
packages: {},
|
|
4240
4259
|
success: true,
|
|
@@ -4264,7 +4283,7 @@ var nextjsApiRoutesPlugin = {
|
|
|
4264
4283
|
const appApiExists = await checkPathExists(appApiPath, ctx.fsAdapter);
|
|
4265
4284
|
const pagesApiExists = await checkPathExists(pagesApiPath, ctx.fsAdapter);
|
|
4266
4285
|
if (appApiExists || pagesApiExists) {
|
|
4267
|
-
|
|
4286
|
+
logger13.warn("API route already exists");
|
|
4268
4287
|
return {
|
|
4269
4288
|
files: [],
|
|
4270
4289
|
success: true,
|
|
@@ -4294,14 +4313,14 @@ var nextjsApiRoutesPlugin = {
|
|
|
4294
4313
|
content: apiContent,
|
|
4295
4314
|
backup: false
|
|
4296
4315
|
});
|
|
4297
|
-
|
|
4316
|
+
logger13.info(`Created API route: ${targetPath}`);
|
|
4298
4317
|
return {
|
|
4299
4318
|
files,
|
|
4300
4319
|
success: true,
|
|
4301
4320
|
message: "Next.js API route created successfully"
|
|
4302
4321
|
};
|
|
4303
4322
|
} catch (error) {
|
|
4304
|
-
|
|
4323
|
+
logger13.error("Failed to create API route:", error);
|
|
4305
4324
|
return {
|
|
4306
4325
|
files,
|
|
4307
4326
|
success: false,
|
|
@@ -4316,9 +4335,9 @@ var nextjsApiRoutesPlugin = {
|
|
|
4316
4335
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4317
4336
|
try {
|
|
4318
4337
|
await backupManager.restoreAll();
|
|
4319
|
-
|
|
4338
|
+
logger13.info("API route configuration rolled back");
|
|
4320
4339
|
} catch (error) {
|
|
4321
|
-
|
|
4340
|
+
logger13.error("Failed to rollback API route configuration:", error);
|
|
4322
4341
|
throw error;
|
|
4323
4342
|
}
|
|
4324
4343
|
}
|
|
@@ -4389,6 +4408,7 @@ export default function handler(
|
|
|
4389
4408
|
|
|
4390
4409
|
// src/plugins/nextjs/font-optimization.ts
|
|
4391
4410
|
import { join as join14 } from "path";
|
|
4411
|
+
var logger14 = getModuleLogger();
|
|
4392
4412
|
var nextjsFontOptimizationPlugin = {
|
|
4393
4413
|
name: "nextjs-font-optimization",
|
|
4394
4414
|
displayName: "Next.js Font Optimization",
|
|
@@ -4406,7 +4426,7 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4406
4426
|
* Pas d'installation nécessaire, next/font est inclus dans Next.js
|
|
4407
4427
|
*/
|
|
4408
4428
|
install(_ctx) {
|
|
4409
|
-
|
|
4429
|
+
logger14.info(
|
|
4410
4430
|
"Font optimization is built into Next.js, no installation needed"
|
|
4411
4431
|
);
|
|
4412
4432
|
return Promise.resolve({
|
|
@@ -4476,12 +4496,12 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4476
4496
|
content: updatedContent,
|
|
4477
4497
|
backup: true
|
|
4478
4498
|
});
|
|
4479
|
-
|
|
4499
|
+
logger14.info(`Added font optimization to ${targetPath}`);
|
|
4480
4500
|
} else {
|
|
4481
|
-
|
|
4501
|
+
logger14.warn("Font optimization already configured");
|
|
4482
4502
|
}
|
|
4483
4503
|
} else {
|
|
4484
|
-
|
|
4504
|
+
logger14.warn("Could not find layout or _app file to configure fonts");
|
|
4485
4505
|
}
|
|
4486
4506
|
return {
|
|
4487
4507
|
files,
|
|
@@ -4489,7 +4509,7 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4489
4509
|
message: "Next.js font optimization configured successfully"
|
|
4490
4510
|
};
|
|
4491
4511
|
} catch (error) {
|
|
4492
|
-
|
|
4512
|
+
logger14.error("Failed to configure font optimization:", error);
|
|
4493
4513
|
return {
|
|
4494
4514
|
files,
|
|
4495
4515
|
success: false,
|
|
@@ -4504,9 +4524,9 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4504
4524
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4505
4525
|
try {
|
|
4506
4526
|
await backupManager.restoreAll();
|
|
4507
|
-
|
|
4527
|
+
logger14.info("Font optimization configuration rolled back");
|
|
4508
4528
|
} catch (error) {
|
|
4509
|
-
|
|
4529
|
+
logger14.error("Failed to rollback font optimization configuration:", error);
|
|
4510
4530
|
throw error;
|
|
4511
4531
|
}
|
|
4512
4532
|
}
|
|
@@ -4569,6 +4589,7 @@ const inter = Inter({ subsets: ['latin'] })
|
|
|
4569
4589
|
|
|
4570
4590
|
// src/plugins/nextjs/image-optimization.ts
|
|
4571
4591
|
import { join as join15 } from "path";
|
|
4592
|
+
var logger15 = getModuleLogger();
|
|
4572
4593
|
var nextjsImageOptimizationPlugin = {
|
|
4573
4594
|
name: "nextjs-image-optimization",
|
|
4574
4595
|
displayName: "Next.js Image Optimization",
|
|
@@ -4586,7 +4607,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4586
4607
|
* Pas d'installation nécessaire, Next.js inclut déjà l'optimisation d'images
|
|
4587
4608
|
*/
|
|
4588
4609
|
install(_ctx) {
|
|
4589
|
-
|
|
4610
|
+
logger15.info(
|
|
4590
4611
|
"Image optimization is built into Next.js, no installation needed"
|
|
4591
4612
|
);
|
|
4592
4613
|
return Promise.resolve({
|
|
@@ -4627,7 +4648,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4627
4648
|
content: updatedContent,
|
|
4628
4649
|
backup: true
|
|
4629
4650
|
});
|
|
4630
|
-
|
|
4651
|
+
logger15.info(
|
|
4631
4652
|
`Updated next.config.${extension} with image optimization`
|
|
4632
4653
|
);
|
|
4633
4654
|
}
|
|
@@ -4640,7 +4661,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4640
4661
|
content: configContent,
|
|
4641
4662
|
backup: false
|
|
4642
4663
|
});
|
|
4643
|
-
|
|
4664
|
+
logger15.info(`Created next.config.${extension} with image optimization`);
|
|
4644
4665
|
}
|
|
4645
4666
|
return {
|
|
4646
4667
|
files,
|
|
@@ -4648,7 +4669,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4648
4669
|
message: "Next.js image optimization configured successfully"
|
|
4649
4670
|
};
|
|
4650
4671
|
} catch (error) {
|
|
4651
|
-
|
|
4672
|
+
logger15.error("Failed to configure image optimization:", error);
|
|
4652
4673
|
return {
|
|
4653
4674
|
files,
|
|
4654
4675
|
success: false,
|
|
@@ -4663,9 +4684,9 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4663
4684
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4664
4685
|
try {
|
|
4665
4686
|
await backupManager.restoreAll();
|
|
4666
|
-
|
|
4687
|
+
logger15.info("Image optimization configuration rolled back");
|
|
4667
4688
|
} catch (error) {
|
|
4668
|
-
|
|
4689
|
+
logger15.error(
|
|
4669
4690
|
"Failed to rollback image optimization configuration:",
|
|
4670
4691
|
error
|
|
4671
4692
|
);
|
|
@@ -4708,7 +4729,7 @@ module.exports = nextConfig
|
|
|
4708
4729
|
}
|
|
4709
4730
|
function injectImageConfig(content, _extension) {
|
|
4710
4731
|
if (content.includes("images:") && content.includes("remotePatterns")) {
|
|
4711
|
-
|
|
4732
|
+
logger15.warn("Image configuration already exists in next.config");
|
|
4712
4733
|
return content;
|
|
4713
4734
|
}
|
|
4714
4735
|
let modifiedContent = content;
|
|
@@ -4756,6 +4777,7 @@ ${match}`
|
|
|
4756
4777
|
|
|
4757
4778
|
// src/plugins/nextjs/middleware.ts
|
|
4758
4779
|
import { join as join16 } from "path";
|
|
4780
|
+
var logger16 = getModuleLogger();
|
|
4759
4781
|
var nextjsMiddlewarePlugin = {
|
|
4760
4782
|
name: "nextjs-middleware",
|
|
4761
4783
|
displayName: "Next.js Middleware",
|
|
@@ -4773,7 +4795,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4773
4795
|
* Pas d'installation nécessaire
|
|
4774
4796
|
*/
|
|
4775
4797
|
install(_ctx) {
|
|
4776
|
-
|
|
4798
|
+
logger16.info("Middleware is a file, no installation needed");
|
|
4777
4799
|
return Promise.resolve({
|
|
4778
4800
|
packages: {},
|
|
4779
4801
|
success: true,
|
|
@@ -4784,8 +4806,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4784
4806
|
* Crée le fichier middleware.ts/js à la racine du projet
|
|
4785
4807
|
*/
|
|
4786
4808
|
async configure(ctx) {
|
|
4787
|
-
const
|
|
4788
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
4809
|
+
const { writer } = getPluginServices(ctx);
|
|
4789
4810
|
const files = [];
|
|
4790
4811
|
const projectRoot = ctx.projectRoot;
|
|
4791
4812
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -4796,7 +4817,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4796
4817
|
ctx.fsAdapter
|
|
4797
4818
|
);
|
|
4798
4819
|
if (middlewareExists) {
|
|
4799
|
-
|
|
4820
|
+
logger16.warn("middleware.ts already exists, skipping creation");
|
|
4800
4821
|
} else {
|
|
4801
4822
|
const middlewareContent = getMiddlewareContent(extension);
|
|
4802
4823
|
await writer.createFile(middlewarePath, middlewareContent);
|
|
@@ -4806,7 +4827,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4806
4827
|
content: middlewareContent,
|
|
4807
4828
|
backup: false
|
|
4808
4829
|
});
|
|
4809
|
-
|
|
4830
|
+
logger16.info(`Created middleware.${extension}`);
|
|
4810
4831
|
}
|
|
4811
4832
|
return {
|
|
4812
4833
|
files,
|
|
@@ -4814,7 +4835,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4814
4835
|
message: "Next.js middleware created successfully"
|
|
4815
4836
|
};
|
|
4816
4837
|
} catch (error) {
|
|
4817
|
-
|
|
4838
|
+
logger16.error("Failed to create middleware:", error);
|
|
4818
4839
|
return {
|
|
4819
4840
|
files,
|
|
4820
4841
|
success: false,
|
|
@@ -4826,12 +4847,12 @@ var nextjsMiddlewarePlugin = {
|
|
|
4826
4847
|
* Rollback de la configuration
|
|
4827
4848
|
*/
|
|
4828
4849
|
async rollback(_ctx) {
|
|
4829
|
-
const backupManager =
|
|
4850
|
+
const backupManager = getRollbackManager(_ctx);
|
|
4830
4851
|
try {
|
|
4831
4852
|
await backupManager.restoreAll();
|
|
4832
|
-
|
|
4853
|
+
logger16.info("Middleware configuration rolled back");
|
|
4833
4854
|
} catch (error) {
|
|
4834
|
-
|
|
4855
|
+
logger16.error("Failed to rollback middleware configuration:", error);
|
|
4835
4856
|
throw error;
|
|
4836
4857
|
}
|
|
4837
4858
|
}
|
|
@@ -4890,6 +4911,7 @@ export const config = {
|
|
|
4890
4911
|
|
|
4891
4912
|
// src/plugins/routing/react-router.ts
|
|
4892
4913
|
import { resolve as resolve10, join as join17 } from "path";
|
|
4914
|
+
var logger17 = getModuleLogger();
|
|
4893
4915
|
var reactRouterPlugin = {
|
|
4894
4916
|
name: "react-router-dom",
|
|
4895
4917
|
displayName: "React Router",
|
|
@@ -4910,7 +4932,7 @@ var reactRouterPlugin = {
|
|
|
4910
4932
|
*/
|
|
4911
4933
|
async install(ctx) {
|
|
4912
4934
|
if (this.detect?.(ctx)) {
|
|
4913
|
-
|
|
4935
|
+
logger17.info("React Router is already installed");
|
|
4914
4936
|
return {
|
|
4915
4937
|
packages: {},
|
|
4916
4938
|
success: true,
|
|
@@ -4929,7 +4951,7 @@ var reactRouterPlugin = {
|
|
|
4929
4951
|
exact: false,
|
|
4930
4952
|
silent: false
|
|
4931
4953
|
});
|
|
4932
|
-
|
|
4954
|
+
logger17.info(`Successfully installed React Router v7`);
|
|
4933
4955
|
return {
|
|
4934
4956
|
packages: {
|
|
4935
4957
|
dependencies: packages
|
|
@@ -4938,7 +4960,7 @@ var reactRouterPlugin = {
|
|
|
4938
4960
|
message: `Installed ${packages.join(", ")}`
|
|
4939
4961
|
};
|
|
4940
4962
|
} catch (error) {
|
|
4941
|
-
|
|
4963
|
+
logger17.error("Failed to install React Router:", error);
|
|
4942
4964
|
return {
|
|
4943
4965
|
packages: {},
|
|
4944
4966
|
success: false,
|
|
@@ -4974,7 +4996,7 @@ var reactRouterPlugin = {
|
|
|
4974
4996
|
content: routerContent,
|
|
4975
4997
|
backup: false
|
|
4976
4998
|
});
|
|
4977
|
-
|
|
4999
|
+
logger17.info(`Created router configuration: ${routerPath}`);
|
|
4978
5000
|
const homeRoutePath = join17(routesDir, `Home.${extension}`);
|
|
4979
5001
|
const homeRouteContent = ctx.typescript ? getHomeRouteContentTS() : getHomeRouteContentJS();
|
|
4980
5002
|
await writer.createFile(homeRoutePath, homeRouteContent);
|
|
@@ -4984,7 +5006,7 @@ var reactRouterPlugin = {
|
|
|
4984
5006
|
content: homeRouteContent,
|
|
4985
5007
|
backup: false
|
|
4986
5008
|
});
|
|
4987
|
-
|
|
5009
|
+
logger17.info(`Created example route: ${homeRoutePath}`);
|
|
4988
5010
|
const appPath = join17(srcDir, `App.${extension}`);
|
|
4989
5011
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
4990
5012
|
if (appExists) {
|
|
@@ -5004,7 +5026,7 @@ var reactRouterPlugin = {
|
|
|
5004
5026
|
content: modifiedAppContent,
|
|
5005
5027
|
backup: true
|
|
5006
5028
|
});
|
|
5007
|
-
|
|
5029
|
+
logger17.info(`Updated App.${extension} with RouterProvider`);
|
|
5008
5030
|
} else {
|
|
5009
5031
|
const appContent = ctx.typescript ? getAppContentTS2() : getAppContentJS2();
|
|
5010
5032
|
await writer.createFile(appPath, appContent);
|
|
@@ -5014,7 +5036,7 @@ var reactRouterPlugin = {
|
|
|
5014
5036
|
content: appContent,
|
|
5015
5037
|
backup: false
|
|
5016
5038
|
});
|
|
5017
|
-
|
|
5039
|
+
logger17.info(`Created App.${extension} with RouterProvider`);
|
|
5018
5040
|
}
|
|
5019
5041
|
return {
|
|
5020
5042
|
files,
|
|
@@ -5022,7 +5044,7 @@ var reactRouterPlugin = {
|
|
|
5022
5044
|
message: "React Router configured successfully"
|
|
5023
5045
|
};
|
|
5024
5046
|
} catch (error) {
|
|
5025
|
-
|
|
5047
|
+
logger17.error("Failed to configure React Router:", error);
|
|
5026
5048
|
return {
|
|
5027
5049
|
files,
|
|
5028
5050
|
success: false,
|
|
@@ -5037,9 +5059,9 @@ var reactRouterPlugin = {
|
|
|
5037
5059
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
5038
5060
|
try {
|
|
5039
5061
|
await backupManager.restoreAll();
|
|
5040
|
-
|
|
5062
|
+
logger17.info("React Router configuration rolled back");
|
|
5041
5063
|
} catch (error) {
|
|
5042
|
-
|
|
5064
|
+
logger17.error("Failed to rollback React Router configuration:", error);
|
|
5043
5065
|
throw error;
|
|
5044
5066
|
}
|
|
5045
5067
|
}
|
|
@@ -5142,7 +5164,7 @@ export default App
|
|
|
5142
5164
|
}
|
|
5143
5165
|
function injectRouterProvider(content, isTypeScript) {
|
|
5144
5166
|
if (content.includes("RouterProvider")) {
|
|
5145
|
-
|
|
5167
|
+
logger17.warn("RouterProvider already present in App file");
|
|
5146
5168
|
return content;
|
|
5147
5169
|
}
|
|
5148
5170
|
const hasRouterImport = content.includes("from 'react-router-dom'") || content.includes('from "react-router-dom"');
|
|
@@ -5243,6 +5265,7 @@ export default App
|
|
|
5243
5265
|
|
|
5244
5266
|
// src/plugins/routing/tanstack-router.ts
|
|
5245
5267
|
import { resolve as resolve11, join as join18 } from "path";
|
|
5268
|
+
var logger18 = getModuleLogger();
|
|
5246
5269
|
var tanstackRouterPlugin = {
|
|
5247
5270
|
name: "@tanstack/react-router",
|
|
5248
5271
|
displayName: "TanStack Router",
|
|
@@ -5262,7 +5285,7 @@ var tanstackRouterPlugin = {
|
|
|
5262
5285
|
*/
|
|
5263
5286
|
async install(ctx) {
|
|
5264
5287
|
if (this.detect?.(ctx)) {
|
|
5265
|
-
|
|
5288
|
+
logger18.info("TanStack Router is already installed");
|
|
5266
5289
|
return {
|
|
5267
5290
|
packages: {},
|
|
5268
5291
|
success: true,
|
|
@@ -5278,7 +5301,7 @@ var tanstackRouterPlugin = {
|
|
|
5278
5301
|
exact: false,
|
|
5279
5302
|
silent: false
|
|
5280
5303
|
});
|
|
5281
|
-
|
|
5304
|
+
logger18.info("Successfully installed TanStack Router");
|
|
5282
5305
|
return {
|
|
5283
5306
|
packages: {
|
|
5284
5307
|
dependencies: packages
|
|
@@ -5287,7 +5310,7 @@ var tanstackRouterPlugin = {
|
|
|
5287
5310
|
message: `Installed ${packages.join(", ")}`
|
|
5288
5311
|
};
|
|
5289
5312
|
} catch (error) {
|
|
5290
|
-
|
|
5313
|
+
logger18.error("Failed to install TanStack Router:", error);
|
|
5291
5314
|
return {
|
|
5292
5315
|
packages: {},
|
|
5293
5316
|
success: false,
|
|
@@ -5327,7 +5350,7 @@ var tanstackRouterPlugin = {
|
|
|
5327
5350
|
content: rootRouteContent,
|
|
5328
5351
|
backup: false
|
|
5329
5352
|
});
|
|
5330
|
-
|
|
5353
|
+
logger18.info(`Created root route: ${rootRoutePath}`);
|
|
5331
5354
|
const indexRoutePath = join18(routesDir, `index.${extension}`);
|
|
5332
5355
|
const indexRouteContent = ctx.typescript ? getIndexRouteContentTS() : getIndexRouteContentJS();
|
|
5333
5356
|
await writer.createFile(indexRoutePath, indexRouteContent);
|
|
@@ -5337,7 +5360,7 @@ var tanstackRouterPlugin = {
|
|
|
5337
5360
|
content: indexRouteContent,
|
|
5338
5361
|
backup: false
|
|
5339
5362
|
});
|
|
5340
|
-
|
|
5363
|
+
logger18.info(`Created index route: ${indexRoutePath}`);
|
|
5341
5364
|
const aboutRoutePath = join18(routesDir, `about.${extension}`);
|
|
5342
5365
|
const aboutRouteContent = ctx.typescript ? getAboutRouteContentTS() : getAboutRouteContentJS();
|
|
5343
5366
|
await writer.createFile(aboutRoutePath, aboutRouteContent);
|
|
@@ -5347,7 +5370,7 @@ var tanstackRouterPlugin = {
|
|
|
5347
5370
|
content: aboutRouteContent,
|
|
5348
5371
|
backup: false
|
|
5349
5372
|
});
|
|
5350
|
-
|
|
5373
|
+
logger18.info(`Created about route: ${aboutRoutePath}`);
|
|
5351
5374
|
const routerPath = join18(srcDir, `router.${extension}`);
|
|
5352
5375
|
const routerContent = ctx.typescript ? getRouterContentTS2() : getRouterContentJS2();
|
|
5353
5376
|
await writer.createFile(routerPath, routerContent);
|
|
@@ -5357,7 +5380,7 @@ var tanstackRouterPlugin = {
|
|
|
5357
5380
|
content: routerContent,
|
|
5358
5381
|
backup: false
|
|
5359
5382
|
});
|
|
5360
|
-
|
|
5383
|
+
logger18.info(`Created router configuration: ${routerPath}`);
|
|
5361
5384
|
const appPath = join18(srcDir, `App.${extension}`);
|
|
5362
5385
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
5363
5386
|
if (appExists) {
|
|
@@ -5377,7 +5400,7 @@ var tanstackRouterPlugin = {
|
|
|
5377
5400
|
content: modifiedAppContent,
|
|
5378
5401
|
backup: true
|
|
5379
5402
|
});
|
|
5380
|
-
|
|
5403
|
+
logger18.info(`Updated App.${extension} with RouterProvider`);
|
|
5381
5404
|
} else {
|
|
5382
5405
|
const appContent = ctx.typescript ? getAppContentTS3() : getAppContentJS3();
|
|
5383
5406
|
await writer.createFile(appPath, appContent);
|
|
@@ -5387,7 +5410,7 @@ var tanstackRouterPlugin = {
|
|
|
5387
5410
|
content: appContent,
|
|
5388
5411
|
backup: false
|
|
5389
5412
|
});
|
|
5390
|
-
|
|
5413
|
+
logger18.info(`Created App.${extension} with RouterProvider`);
|
|
5391
5414
|
}
|
|
5392
5415
|
return {
|
|
5393
5416
|
files,
|
|
@@ -5395,7 +5418,7 @@ var tanstackRouterPlugin = {
|
|
|
5395
5418
|
message: "TanStack Router configured successfully"
|
|
5396
5419
|
};
|
|
5397
5420
|
} catch (error) {
|
|
5398
|
-
|
|
5421
|
+
logger18.error("Failed to configure TanStack Router:", error);
|
|
5399
5422
|
return {
|
|
5400
5423
|
files,
|
|
5401
5424
|
success: false,
|
|
@@ -5410,9 +5433,9 @@ var tanstackRouterPlugin = {
|
|
|
5410
5433
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
5411
5434
|
try {
|
|
5412
5435
|
await backupManager.restoreAll();
|
|
5413
|
-
|
|
5436
|
+
logger18.info("TanStack Router configuration rolled back");
|
|
5414
5437
|
} catch (error) {
|
|
5415
|
-
|
|
5438
|
+
logger18.error("Failed to rollback TanStack Router configuration:", error);
|
|
5416
5439
|
throw error;
|
|
5417
5440
|
}
|
|
5418
5441
|
}
|
|
@@ -5648,7 +5671,7 @@ export default App
|
|
|
5648
5671
|
}
|
|
5649
5672
|
function injectRouterProvider2(content, isTypeScript) {
|
|
5650
5673
|
if (content.includes("RouterProvider")) {
|
|
5651
|
-
|
|
5674
|
+
logger18.warn("RouterProvider already present in App file");
|
|
5652
5675
|
return content;
|
|
5653
5676
|
}
|
|
5654
5677
|
const hasRouterImport = content.includes("from '@tanstack/react-router'") || content.includes('from "@tanstack/react-router"');
|
|
@@ -5749,6 +5772,7 @@ export default App
|
|
|
5749
5772
|
|
|
5750
5773
|
// src/plugins/routing/vue-router.ts
|
|
5751
5774
|
import { resolve as resolve12, join as join19 } from "path";
|
|
5775
|
+
var logger19 = getModuleLogger();
|
|
5752
5776
|
var vueRouterPlugin = {
|
|
5753
5777
|
name: "vue-router",
|
|
5754
5778
|
displayName: "Vue Router",
|
|
@@ -5767,7 +5791,7 @@ var vueRouterPlugin = {
|
|
|
5767
5791
|
*/
|
|
5768
5792
|
async install(ctx) {
|
|
5769
5793
|
if (this.detect?.(ctx)) {
|
|
5770
|
-
|
|
5794
|
+
logger19.info("Vue Router is already installed");
|
|
5771
5795
|
return {
|
|
5772
5796
|
packages: {},
|
|
5773
5797
|
success: true,
|
|
@@ -5783,7 +5807,7 @@ var vueRouterPlugin = {
|
|
|
5783
5807
|
exact: false,
|
|
5784
5808
|
silent: false
|
|
5785
5809
|
});
|
|
5786
|
-
|
|
5810
|
+
logger19.info("Successfully installed Vue Router v4");
|
|
5787
5811
|
return {
|
|
5788
5812
|
packages: {
|
|
5789
5813
|
dependencies: packages
|
|
@@ -5792,7 +5816,7 @@ var vueRouterPlugin = {
|
|
|
5792
5816
|
message: `Installed ${packages.join(", ")}`
|
|
5793
5817
|
};
|
|
5794
5818
|
} catch (error) {
|
|
5795
|
-
|
|
5819
|
+
logger19.error("Failed to install Vue Router:", error);
|
|
5796
5820
|
return {
|
|
5797
5821
|
packages: {},
|
|
5798
5822
|
success: false,
|
|
@@ -5832,7 +5856,7 @@ var vueRouterPlugin = {
|
|
|
5832
5856
|
content: routerIndexContent,
|
|
5833
5857
|
backup: false
|
|
5834
5858
|
});
|
|
5835
|
-
|
|
5859
|
+
logger19.info(`Created router configuration: ${routerIndexPath}`);
|
|
5836
5860
|
const homeViewPath = join19(viewsDir, "HomeView.vue");
|
|
5837
5861
|
const vueApi = ctx.vueApi || "composition";
|
|
5838
5862
|
const homeViewContent = getHomeViewContent(vueApi);
|
|
@@ -5843,7 +5867,7 @@ var vueRouterPlugin = {
|
|
|
5843
5867
|
content: homeViewContent,
|
|
5844
5868
|
backup: false
|
|
5845
5869
|
});
|
|
5846
|
-
|
|
5870
|
+
logger19.info(`Created HomeView: ${homeViewPath}`);
|
|
5847
5871
|
const aboutViewPath = join19(viewsDir, "AboutView.vue");
|
|
5848
5872
|
const aboutViewContent = getAboutViewContent(vueApi);
|
|
5849
5873
|
await writer.createFile(aboutViewPath, aboutViewContent);
|
|
@@ -5853,7 +5877,7 @@ var vueRouterPlugin = {
|
|
|
5853
5877
|
content: aboutViewContent,
|
|
5854
5878
|
backup: false
|
|
5855
5879
|
});
|
|
5856
|
-
|
|
5880
|
+
logger19.info(`Created AboutView: ${aboutViewPath}`);
|
|
5857
5881
|
const mainPath = join19(srcDir, `main.${extension}`);
|
|
5858
5882
|
if (await checkPathExists(mainPath, ctx.fsAdapter)) {
|
|
5859
5883
|
const mainContent = await readFileContent(
|
|
@@ -5870,10 +5894,10 @@ var vueRouterPlugin = {
|
|
|
5870
5894
|
content: updatedMainContent,
|
|
5871
5895
|
backup: true
|
|
5872
5896
|
});
|
|
5873
|
-
|
|
5897
|
+
logger19.info(`Updated main file: ${mainPath}`);
|
|
5874
5898
|
}
|
|
5875
5899
|
} else {
|
|
5876
|
-
|
|
5900
|
+
logger19.warn(`Main file not found: ${mainPath}`);
|
|
5877
5901
|
}
|
|
5878
5902
|
const appPath = join19(srcDir, "App.vue");
|
|
5879
5903
|
if (await checkPathExists(appPath, ctx.fsAdapter)) {
|
|
@@ -5891,10 +5915,10 @@ var vueRouterPlugin = {
|
|
|
5891
5915
|
content: updatedAppContent,
|
|
5892
5916
|
backup: true
|
|
5893
5917
|
});
|
|
5894
|
-
|
|
5918
|
+
logger19.info(`Updated App.vue: ${appPath}`);
|
|
5895
5919
|
}
|
|
5896
5920
|
} else {
|
|
5897
|
-
|
|
5921
|
+
logger19.warn(`App.vue not found: ${appPath}`);
|
|
5898
5922
|
}
|
|
5899
5923
|
return {
|
|
5900
5924
|
files,
|
|
@@ -5902,7 +5926,7 @@ var vueRouterPlugin = {
|
|
|
5902
5926
|
message: "Vue Router configured successfully"
|
|
5903
5927
|
};
|
|
5904
5928
|
} catch (error) {
|
|
5905
|
-
|
|
5929
|
+
logger19.error("Failed to configure Vue Router:", error);
|
|
5906
5930
|
return {
|
|
5907
5931
|
files,
|
|
5908
5932
|
success: false,
|
|
@@ -5916,7 +5940,7 @@ var vueRouterPlugin = {
|
|
|
5916
5940
|
async rollback(_ctx) {
|
|
5917
5941
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
5918
5942
|
await backupManager.restoreAll();
|
|
5919
|
-
|
|
5943
|
+
logger19.info("Vue Router configuration rolled back");
|
|
5920
5944
|
}
|
|
5921
5945
|
};
|
|
5922
5946
|
function getRouterIndexContentTS() {
|
|
@@ -6062,7 +6086,7 @@ function updateMainFile(content, isTypeScript) {
|
|
|
6062
6086
|
const routerImport = isTypeScript ? "import router from './router'\n" : "import router from './router'\n";
|
|
6063
6087
|
const createAppMatch = content.match(/createApp\([^)]+\)/);
|
|
6064
6088
|
if (!createAppMatch) {
|
|
6065
|
-
|
|
6089
|
+
logger19.warn("Could not find createApp in main file");
|
|
6066
6090
|
return content;
|
|
6067
6091
|
}
|
|
6068
6092
|
const importRegex = /(import\s+.*?from\s+['"].*?['"];?\s*\n)/g;
|
|
@@ -6132,6 +6156,7 @@ function updateAppFile(content) {
|
|
|
6132
6156
|
|
|
6133
6157
|
// src/plugins/state/jotai.ts
|
|
6134
6158
|
import { resolve as resolve13, join as join20 } from "path";
|
|
6159
|
+
var logger20 = getModuleLogger();
|
|
6135
6160
|
var jotaiPlugin = {
|
|
6136
6161
|
name: "jotai",
|
|
6137
6162
|
displayName: "Jotai",
|
|
@@ -6151,7 +6176,7 @@ var jotaiPlugin = {
|
|
|
6151
6176
|
*/
|
|
6152
6177
|
async install(ctx) {
|
|
6153
6178
|
if (this.detect?.(ctx)) {
|
|
6154
|
-
|
|
6179
|
+
logger20.info("Jotai is already installed");
|
|
6155
6180
|
return {
|
|
6156
6181
|
packages: {},
|
|
6157
6182
|
success: true,
|
|
@@ -6167,7 +6192,7 @@ var jotaiPlugin = {
|
|
|
6167
6192
|
exact: false,
|
|
6168
6193
|
silent: false
|
|
6169
6194
|
});
|
|
6170
|
-
|
|
6195
|
+
logger20.info("Successfully installed Jotai");
|
|
6171
6196
|
return {
|
|
6172
6197
|
packages: {
|
|
6173
6198
|
dependencies: packages
|
|
@@ -6176,7 +6201,7 @@ var jotaiPlugin = {
|
|
|
6176
6201
|
message: `Installed ${packages.join(", ")}`
|
|
6177
6202
|
};
|
|
6178
6203
|
} catch (error) {
|
|
6179
|
-
|
|
6204
|
+
logger20.error("Failed to install Jotai:", error);
|
|
6180
6205
|
return {
|
|
6181
6206
|
packages: {},
|
|
6182
6207
|
success: false,
|
|
@@ -6197,8 +6222,7 @@ var jotaiPlugin = {
|
|
|
6197
6222
|
* Documentation : https://jotai.org/docs/core/atom
|
|
6198
6223
|
*/
|
|
6199
6224
|
async configure(ctx) {
|
|
6200
|
-
const
|
|
6201
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
6225
|
+
const { writer } = getPluginServices(ctx);
|
|
6202
6226
|
const files = [];
|
|
6203
6227
|
const srcDir = resolve13(ctx.projectRoot, ctx.srcDir);
|
|
6204
6228
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -6214,7 +6238,7 @@ var jotaiPlugin = {
|
|
|
6214
6238
|
content: atomsContent,
|
|
6215
6239
|
backup: false
|
|
6216
6240
|
});
|
|
6217
|
-
|
|
6241
|
+
logger20.info(`Created atoms file: ${atomsPath}`);
|
|
6218
6242
|
const indexPath = join20(storeDir, `index.${extension}`);
|
|
6219
6243
|
const indexContent = ctx.typescript ? getIndexContentTS5() : getIndexContentJS5();
|
|
6220
6244
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -6224,7 +6248,7 @@ var jotaiPlugin = {
|
|
|
6224
6248
|
content: indexContent,
|
|
6225
6249
|
backup: false
|
|
6226
6250
|
});
|
|
6227
|
-
|
|
6251
|
+
logger20.info(`Created store index: ${indexPath}`);
|
|
6228
6252
|
const appPath = join20(srcDir, `App.${ctx.typescript ? "tsx" : "jsx"}`);
|
|
6229
6253
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
6230
6254
|
if (appExists) {
|
|
@@ -6241,7 +6265,7 @@ var jotaiPlugin = {
|
|
|
6241
6265
|
content: modifiedAppContent,
|
|
6242
6266
|
backup: true
|
|
6243
6267
|
});
|
|
6244
|
-
|
|
6268
|
+
logger20.info(
|
|
6245
6269
|
`Updated App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6246
6270
|
);
|
|
6247
6271
|
} else {
|
|
@@ -6253,7 +6277,7 @@ var jotaiPlugin = {
|
|
|
6253
6277
|
content: appContent,
|
|
6254
6278
|
backup: false
|
|
6255
6279
|
});
|
|
6256
|
-
|
|
6280
|
+
logger20.info(
|
|
6257
6281
|
`Created App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6258
6282
|
);
|
|
6259
6283
|
}
|
|
@@ -6263,7 +6287,7 @@ var jotaiPlugin = {
|
|
|
6263
6287
|
message: "Jotai configured successfully"
|
|
6264
6288
|
};
|
|
6265
6289
|
} catch (error) {
|
|
6266
|
-
|
|
6290
|
+
logger20.error("Failed to configure Jotai:", error);
|
|
6267
6291
|
return {
|
|
6268
6292
|
files,
|
|
6269
6293
|
success: false,
|
|
@@ -6275,12 +6299,12 @@ var jotaiPlugin = {
|
|
|
6275
6299
|
* Rollback de la configuration Jotai
|
|
6276
6300
|
*/
|
|
6277
6301
|
async rollback(_ctx) {
|
|
6278
|
-
const backupManager =
|
|
6302
|
+
const backupManager = getRollbackManager(_ctx);
|
|
6279
6303
|
try {
|
|
6280
6304
|
await backupManager.restoreAll();
|
|
6281
|
-
|
|
6305
|
+
logger20.info("Jotai configuration rolled back");
|
|
6282
6306
|
} catch (error) {
|
|
6283
|
-
|
|
6307
|
+
logger20.error("Failed to rollback Jotai configuration:", error);
|
|
6284
6308
|
throw error;
|
|
6285
6309
|
}
|
|
6286
6310
|
}
|
|
@@ -6409,7 +6433,7 @@ export default App
|
|
|
6409
6433
|
}
|
|
6410
6434
|
function injectProvider(content, isTypeScript) {
|
|
6411
6435
|
if (content.includes("Provider") && content.includes("jotai")) {
|
|
6412
|
-
|
|
6436
|
+
logger20.warn("Jotai Provider already present in App file");
|
|
6413
6437
|
return content;
|
|
6414
6438
|
}
|
|
6415
6439
|
const hasProviderImport = content.includes("from 'jotai'") || content.includes('from "jotai"');
|
|
@@ -6481,6 +6505,7 @@ export default App
|
|
|
6481
6505
|
|
|
6482
6506
|
// src/plugins/state/pinia.ts
|
|
6483
6507
|
import { resolve as resolve14, join as join21 } from "path";
|
|
6508
|
+
var logger21 = getModuleLogger();
|
|
6484
6509
|
var piniaPlugin = {
|
|
6485
6510
|
name: "pinia",
|
|
6486
6511
|
displayName: "Pinia",
|
|
@@ -6499,7 +6524,7 @@ var piniaPlugin = {
|
|
|
6499
6524
|
*/
|
|
6500
6525
|
async install(ctx) {
|
|
6501
6526
|
if (this.detect?.(ctx)) {
|
|
6502
|
-
|
|
6527
|
+
logger21.info("Pinia is already installed");
|
|
6503
6528
|
return {
|
|
6504
6529
|
packages: {},
|
|
6505
6530
|
success: true,
|
|
@@ -6507,7 +6532,7 @@ var piniaPlugin = {
|
|
|
6507
6532
|
};
|
|
6508
6533
|
}
|
|
6509
6534
|
if (ctx.vueVersion !== "3") {
|
|
6510
|
-
|
|
6535
|
+
logger21.error("Pinia requires Vue 3");
|
|
6511
6536
|
return {
|
|
6512
6537
|
packages: {},
|
|
6513
6538
|
success: false,
|
|
@@ -6523,7 +6548,7 @@ var piniaPlugin = {
|
|
|
6523
6548
|
exact: false,
|
|
6524
6549
|
silent: false
|
|
6525
6550
|
});
|
|
6526
|
-
|
|
6551
|
+
logger21.info("Successfully installed Pinia");
|
|
6527
6552
|
return {
|
|
6528
6553
|
packages: {
|
|
6529
6554
|
dependencies: packages
|
|
@@ -6532,7 +6557,7 @@ var piniaPlugin = {
|
|
|
6532
6557
|
message: `Installed ${packages.join(", ")}`
|
|
6533
6558
|
};
|
|
6534
6559
|
} catch (error) {
|
|
6535
|
-
|
|
6560
|
+
logger21.error("Failed to install Pinia:", error);
|
|
6536
6561
|
return {
|
|
6537
6562
|
packages: {},
|
|
6538
6563
|
success: false,
|
|
@@ -6551,8 +6576,7 @@ var piniaPlugin = {
|
|
|
6551
6576
|
* - src/main.ts (ou main.js) : Intègre Pinia
|
|
6552
6577
|
*/
|
|
6553
6578
|
async configure(ctx) {
|
|
6554
|
-
const
|
|
6555
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
6579
|
+
const { writer } = getPluginServices(ctx);
|
|
6556
6580
|
const files = [];
|
|
6557
6581
|
const srcDir = resolve14(ctx.projectRoot, ctx.srcDir);
|
|
6558
6582
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -6568,7 +6592,7 @@ var piniaPlugin = {
|
|
|
6568
6592
|
content: storesIndexContent,
|
|
6569
6593
|
backup: false
|
|
6570
6594
|
});
|
|
6571
|
-
|
|
6595
|
+
logger21.info(`Created Pinia stores index: ${storesIndexPath}`);
|
|
6572
6596
|
const counterStorePath = join21(storesDir, `counter.${extension}`);
|
|
6573
6597
|
const counterStoreContent = ctx.typescript ? getCounterStoreContentTS(ctx.vueApi) : getCounterStoreContentJS(ctx.vueApi);
|
|
6574
6598
|
await writer.createFile(counterStorePath, counterStoreContent);
|
|
@@ -6578,7 +6602,7 @@ var piniaPlugin = {
|
|
|
6578
6602
|
content: counterStoreContent,
|
|
6579
6603
|
backup: false
|
|
6580
6604
|
});
|
|
6581
|
-
|
|
6605
|
+
logger21.info(`Created counter store: ${counterStorePath}`);
|
|
6582
6606
|
const mainPath = join21(srcDir, `main.${extension}`);
|
|
6583
6607
|
if (await checkPathExists(mainPath, ctx.fsAdapter)) {
|
|
6584
6608
|
const mainContent = await readFileContent(
|
|
@@ -6595,10 +6619,10 @@ var piniaPlugin = {
|
|
|
6595
6619
|
content: updatedMainContent,
|
|
6596
6620
|
backup: true
|
|
6597
6621
|
});
|
|
6598
|
-
|
|
6622
|
+
logger21.info(`Updated main file: ${mainPath}`);
|
|
6599
6623
|
}
|
|
6600
6624
|
} else {
|
|
6601
|
-
|
|
6625
|
+
logger21.warn(`Main file not found: ${mainPath}`);
|
|
6602
6626
|
}
|
|
6603
6627
|
return {
|
|
6604
6628
|
files,
|
|
@@ -6606,7 +6630,7 @@ var piniaPlugin = {
|
|
|
6606
6630
|
message: "Pinia configured successfully"
|
|
6607
6631
|
};
|
|
6608
6632
|
} catch (error) {
|
|
6609
|
-
|
|
6633
|
+
logger21.error("Failed to configure Pinia:", error);
|
|
6610
6634
|
return {
|
|
6611
6635
|
files,
|
|
6612
6636
|
success: false,
|
|
@@ -6618,9 +6642,9 @@ var piniaPlugin = {
|
|
|
6618
6642
|
* Rollback de la configuration Pinia
|
|
6619
6643
|
*/
|
|
6620
6644
|
async rollback(_ctx) {
|
|
6621
|
-
const backupManager =
|
|
6645
|
+
const backupManager = getRollbackManager(_ctx);
|
|
6622
6646
|
await backupManager.restoreAll();
|
|
6623
|
-
|
|
6647
|
+
logger21.info("Pinia configuration rolled back");
|
|
6624
6648
|
}
|
|
6625
6649
|
};
|
|
6626
6650
|
function getStoresIndexContentTS() {
|
|
@@ -6736,7 +6760,7 @@ function updateMainFile2(content, isTypeScript) {
|
|
|
6736
6760
|
const piniaImport = isTypeScript ? "import pinia from './stores'\n" : "import pinia from './stores'\n";
|
|
6737
6761
|
const createAppMatch = content.match(/createApp\([^)]+\)/);
|
|
6738
6762
|
if (!createAppMatch) {
|
|
6739
|
-
|
|
6763
|
+
logger21.warn("Could not find createApp in main file");
|
|
6740
6764
|
return content;
|
|
6741
6765
|
}
|
|
6742
6766
|
const importRegex = /(import\s+.*?from\s+['"].*?['"];?\s*\n)/g;
|
|
@@ -6758,6 +6782,7 @@ app.use(pinia)`
|
|
|
6758
6782
|
|
|
6759
6783
|
// src/plugins/state/redux-toolkit.ts
|
|
6760
6784
|
import { resolve as resolve15, join as join22 } from "path";
|
|
6785
|
+
var logger22 = getModuleLogger();
|
|
6761
6786
|
var reduxToolkitPlugin = {
|
|
6762
6787
|
name: "@reduxjs/toolkit",
|
|
6763
6788
|
displayName: "Redux Toolkit",
|
|
@@ -6777,7 +6802,7 @@ var reduxToolkitPlugin = {
|
|
|
6777
6802
|
*/
|
|
6778
6803
|
async install(ctx) {
|
|
6779
6804
|
if (this.detect?.(ctx)) {
|
|
6780
|
-
|
|
6805
|
+
logger22.info("Redux Toolkit is already installed");
|
|
6781
6806
|
return {
|
|
6782
6807
|
packages: {},
|
|
6783
6808
|
success: true,
|
|
@@ -6796,7 +6821,7 @@ var reduxToolkitPlugin = {
|
|
|
6796
6821
|
exact: false,
|
|
6797
6822
|
silent: false
|
|
6798
6823
|
});
|
|
6799
|
-
|
|
6824
|
+
logger22.info("Successfully installed Redux Toolkit");
|
|
6800
6825
|
return {
|
|
6801
6826
|
packages: {
|
|
6802
6827
|
dependencies: packages
|
|
@@ -6805,7 +6830,7 @@ var reduxToolkitPlugin = {
|
|
|
6805
6830
|
message: `Installed ${packages.join(", ")}`
|
|
6806
6831
|
};
|
|
6807
6832
|
} catch (error) {
|
|
6808
|
-
|
|
6833
|
+
logger22.error("Failed to install Redux Toolkit:", error);
|
|
6809
6834
|
return {
|
|
6810
6835
|
packages: {},
|
|
6811
6836
|
success: false,
|
|
@@ -6826,8 +6851,7 @@ var reduxToolkitPlugin = {
|
|
|
6826
6851
|
* Documentation : https://redux-toolkit.js.org/introduction/getting-started
|
|
6827
6852
|
*/
|
|
6828
6853
|
async configure(ctx) {
|
|
6829
|
-
const
|
|
6830
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
6854
|
+
const { writer } = getPluginServices(ctx);
|
|
6831
6855
|
const files = [];
|
|
6832
6856
|
const srcDir = resolve15(ctx.projectRoot, ctx.srcDir);
|
|
6833
6857
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -6845,7 +6869,7 @@ var reduxToolkitPlugin = {
|
|
|
6845
6869
|
content: sliceContent,
|
|
6846
6870
|
backup: false
|
|
6847
6871
|
});
|
|
6848
|
-
|
|
6872
|
+
logger22.info(`Created counter slice: ${slicePath}`);
|
|
6849
6873
|
const storePath = join22(storeDir, `index.${extension}`);
|
|
6850
6874
|
const storeContent = ctx.typescript ? getStoreContentTS() : getStoreContentJS();
|
|
6851
6875
|
await writer.createFile(storePath, storeContent);
|
|
@@ -6855,7 +6879,7 @@ var reduxToolkitPlugin = {
|
|
|
6855
6879
|
content: storeContent,
|
|
6856
6880
|
backup: false
|
|
6857
6881
|
});
|
|
6858
|
-
|
|
6882
|
+
logger22.info(`Created Redux store: ${storePath}`);
|
|
6859
6883
|
if (ctx.typescript) {
|
|
6860
6884
|
const hooksPath = join22(storeDir, "hooks.ts");
|
|
6861
6885
|
const hooksContent = getTypedHooksContentTS();
|
|
@@ -6866,7 +6890,7 @@ var reduxToolkitPlugin = {
|
|
|
6866
6890
|
content: hooksContent,
|
|
6867
6891
|
backup: false
|
|
6868
6892
|
});
|
|
6869
|
-
|
|
6893
|
+
logger22.info(`Created typed hooks: ${hooksPath}`);
|
|
6870
6894
|
}
|
|
6871
6895
|
const appPath = join22(srcDir, `App.${ctx.typescript ? "tsx" : "jsx"}`);
|
|
6872
6896
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
@@ -6884,7 +6908,7 @@ var reduxToolkitPlugin = {
|
|
|
6884
6908
|
content: modifiedAppContent,
|
|
6885
6909
|
backup: true
|
|
6886
6910
|
});
|
|
6887
|
-
|
|
6911
|
+
logger22.info(
|
|
6888
6912
|
`Updated App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6889
6913
|
);
|
|
6890
6914
|
} else {
|
|
@@ -6896,7 +6920,7 @@ var reduxToolkitPlugin = {
|
|
|
6896
6920
|
content: appContent,
|
|
6897
6921
|
backup: false
|
|
6898
6922
|
});
|
|
6899
|
-
|
|
6923
|
+
logger22.info(
|
|
6900
6924
|
`Created App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6901
6925
|
);
|
|
6902
6926
|
}
|
|
@@ -6906,7 +6930,7 @@ var reduxToolkitPlugin = {
|
|
|
6906
6930
|
message: "Redux Toolkit configured successfully"
|
|
6907
6931
|
};
|
|
6908
6932
|
} catch (error) {
|
|
6909
|
-
|
|
6933
|
+
logger22.error("Failed to configure Redux Toolkit:", error);
|
|
6910
6934
|
return {
|
|
6911
6935
|
files,
|
|
6912
6936
|
success: false,
|
|
@@ -6918,12 +6942,12 @@ var reduxToolkitPlugin = {
|
|
|
6918
6942
|
* Rollback de la configuration Redux Toolkit
|
|
6919
6943
|
*/
|
|
6920
6944
|
async rollback(_ctx) {
|
|
6921
|
-
const backupManager =
|
|
6945
|
+
const backupManager = getRollbackManager(_ctx);
|
|
6922
6946
|
try {
|
|
6923
6947
|
await backupManager.restoreAll();
|
|
6924
|
-
|
|
6948
|
+
logger22.info("Redux Toolkit configuration rolled back");
|
|
6925
6949
|
} catch (error) {
|
|
6926
|
-
|
|
6950
|
+
logger22.error("Failed to rollback Redux Toolkit configuration:", error);
|
|
6927
6951
|
throw error;
|
|
6928
6952
|
}
|
|
6929
6953
|
}
|
|
@@ -7133,7 +7157,7 @@ export default App
|
|
|
7133
7157
|
}
|
|
7134
7158
|
function injectProvider2(content, isTypeScript) {
|
|
7135
7159
|
if (content.includes("<Provider")) {
|
|
7136
|
-
|
|
7160
|
+
logger22.warn("Provider already present in App file");
|
|
7137
7161
|
return content;
|
|
7138
7162
|
}
|
|
7139
7163
|
const hasReactReduxImport = content.includes("from 'react-redux'") || content.includes('from "react-redux"');
|
|
@@ -7228,6 +7252,7 @@ export default App
|
|
|
7228
7252
|
|
|
7229
7253
|
// src/plugins/state/zustand.ts
|
|
7230
7254
|
import { resolve as resolve16, join as join23 } from "path";
|
|
7255
|
+
var logger23 = getModuleLogger();
|
|
7231
7256
|
var zustandPlugin = {
|
|
7232
7257
|
name: "zustand",
|
|
7233
7258
|
displayName: "Zustand",
|
|
@@ -7247,7 +7272,7 @@ var zustandPlugin = {
|
|
|
7247
7272
|
*/
|
|
7248
7273
|
async install(ctx) {
|
|
7249
7274
|
if (this.detect?.(ctx)) {
|
|
7250
|
-
|
|
7275
|
+
logger23.info("Zustand is already installed");
|
|
7251
7276
|
return {
|
|
7252
7277
|
packages: {},
|
|
7253
7278
|
success: true,
|
|
@@ -7263,7 +7288,7 @@ var zustandPlugin = {
|
|
|
7263
7288
|
exact: false,
|
|
7264
7289
|
silent: false
|
|
7265
7290
|
});
|
|
7266
|
-
|
|
7291
|
+
logger23.info("Successfully installed Zustand");
|
|
7267
7292
|
return {
|
|
7268
7293
|
packages: {
|
|
7269
7294
|
dependencies: packages
|
|
@@ -7272,7 +7297,7 @@ var zustandPlugin = {
|
|
|
7272
7297
|
message: `Installed ${packages.join(", ")}`
|
|
7273
7298
|
};
|
|
7274
7299
|
} catch (error) {
|
|
7275
|
-
|
|
7300
|
+
logger23.error("Failed to install Zustand:", error);
|
|
7276
7301
|
return {
|
|
7277
7302
|
packages: {},
|
|
7278
7303
|
success: false,
|
|
@@ -7290,8 +7315,7 @@ var zustandPlugin = {
|
|
|
7290
7315
|
* Documentation : https://zustand.docs.pmnd.rs/getting-started/introduction
|
|
7291
7316
|
*/
|
|
7292
7317
|
async configure(ctx) {
|
|
7293
|
-
const
|
|
7294
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
7318
|
+
const { writer } = getPluginServices(ctx);
|
|
7295
7319
|
const files = [];
|
|
7296
7320
|
const srcDir = resolve16(ctx.projectRoot, ctx.srcDir);
|
|
7297
7321
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -7307,7 +7331,7 @@ var zustandPlugin = {
|
|
|
7307
7331
|
content: storeContent,
|
|
7308
7332
|
backup: false
|
|
7309
7333
|
});
|
|
7310
|
-
|
|
7334
|
+
logger23.info(`Created Zustand store: ${storePath}`);
|
|
7311
7335
|
if (ctx.typescript) {
|
|
7312
7336
|
const hookPath = join23(storeDir, "useStore.ts");
|
|
7313
7337
|
const hookContent = getTypedHookContentTS();
|
|
@@ -7318,7 +7342,7 @@ var zustandPlugin = {
|
|
|
7318
7342
|
content: hookContent,
|
|
7319
7343
|
backup: false
|
|
7320
7344
|
});
|
|
7321
|
-
|
|
7345
|
+
logger23.info(`Created typed hook example: ${hookPath}`);
|
|
7322
7346
|
}
|
|
7323
7347
|
return {
|
|
7324
7348
|
files,
|
|
@@ -7326,7 +7350,7 @@ var zustandPlugin = {
|
|
|
7326
7350
|
message: "Zustand configured successfully"
|
|
7327
7351
|
};
|
|
7328
7352
|
} catch (error) {
|
|
7329
|
-
|
|
7353
|
+
logger23.error("Failed to configure Zustand:", error);
|
|
7330
7354
|
return {
|
|
7331
7355
|
files,
|
|
7332
7356
|
success: false,
|
|
@@ -7338,12 +7362,12 @@ var zustandPlugin = {
|
|
|
7338
7362
|
* Rollback de la configuration Zustand
|
|
7339
7363
|
*/
|
|
7340
7364
|
async rollback(_ctx) {
|
|
7341
|
-
const backupManager =
|
|
7365
|
+
const backupManager = getRollbackManager(_ctx);
|
|
7342
7366
|
try {
|
|
7343
7367
|
await backupManager.restoreAll();
|
|
7344
|
-
|
|
7368
|
+
logger23.info("Zustand configuration rolled back");
|
|
7345
7369
|
} catch (error) {
|
|
7346
|
-
|
|
7370
|
+
logger23.error("Failed to rollback Zustand configuration:", error);
|
|
7347
7371
|
throw error;
|
|
7348
7372
|
}
|
|
7349
7373
|
}
|
|
@@ -7438,6 +7462,7 @@ export const useRemoveAllBears = () =>
|
|
|
7438
7462
|
|
|
7439
7463
|
// src/plugins/testing/react-testing-library.ts
|
|
7440
7464
|
import { join as join24 } from "path";
|
|
7465
|
+
var logger24 = getModuleLogger();
|
|
7441
7466
|
var reactTestingLibraryPlugin = {
|
|
7442
7467
|
name: "react-testing-library",
|
|
7443
7468
|
displayName: "React Testing Library",
|
|
@@ -7456,7 +7481,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7456
7481
|
*/
|
|
7457
7482
|
async install(ctx) {
|
|
7458
7483
|
if (this.detect?.(ctx)) {
|
|
7459
|
-
|
|
7484
|
+
logger24.info("React Testing Library is already installed");
|
|
7460
7485
|
return {
|
|
7461
7486
|
packages: {},
|
|
7462
7487
|
success: true,
|
|
@@ -7476,7 +7501,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7476
7501
|
exact: false,
|
|
7477
7502
|
silent: false
|
|
7478
7503
|
});
|
|
7479
|
-
|
|
7504
|
+
logger24.info("Successfully installed React Testing Library");
|
|
7480
7505
|
return {
|
|
7481
7506
|
packages: {
|
|
7482
7507
|
devDependencies: packages
|
|
@@ -7485,7 +7510,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7485
7510
|
message: `Installed React Testing Library: ${packages.join(", ")}`
|
|
7486
7511
|
};
|
|
7487
7512
|
} catch (error) {
|
|
7488
|
-
|
|
7513
|
+
logger24.error("Failed to install React Testing Library:", error);
|
|
7489
7514
|
return {
|
|
7490
7515
|
packages: {},
|
|
7491
7516
|
success: false,
|
|
@@ -7526,7 +7551,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7526
7551
|
content: setupTestsContent,
|
|
7527
7552
|
backup: false
|
|
7528
7553
|
});
|
|
7529
|
-
|
|
7554
|
+
logger24.info(`Created setupTests file: ${setupTestsPath}`);
|
|
7530
7555
|
}
|
|
7531
7556
|
const testDir = join24(srcDir, "components", "__tests__");
|
|
7532
7557
|
await ensureDirectory(testDir, ctx.fsAdapter);
|
|
@@ -7547,7 +7572,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7547
7572
|
content: exampleTestContent,
|
|
7548
7573
|
backup: false
|
|
7549
7574
|
});
|
|
7550
|
-
|
|
7575
|
+
logger24.info(`Created example test: ${exampleTestPath}`);
|
|
7551
7576
|
}
|
|
7552
7577
|
const vitestConfigPath = join24(projectRoot, "vitest.config.ts");
|
|
7553
7578
|
const vitestConfigExists = await checkPathExists(
|
|
@@ -7555,7 +7580,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7555
7580
|
ctx.fsAdapter
|
|
7556
7581
|
);
|
|
7557
7582
|
if (vitestConfigExists) {
|
|
7558
|
-
|
|
7583
|
+
logger24.info(
|
|
7559
7584
|
"vitest.config.ts found. Make sure to add setupFiles if needed."
|
|
7560
7585
|
);
|
|
7561
7586
|
}
|
|
@@ -7565,7 +7590,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7565
7590
|
message: "React Testing Library configured successfully"
|
|
7566
7591
|
};
|
|
7567
7592
|
} catch (error) {
|
|
7568
|
-
|
|
7593
|
+
logger24.error("Failed to configure React Testing Library:", error);
|
|
7569
7594
|
await backupManager.restoreAll();
|
|
7570
7595
|
return {
|
|
7571
7596
|
files,
|
|
@@ -7581,9 +7606,9 @@ var reactTestingLibraryPlugin = {
|
|
|
7581
7606
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
7582
7607
|
try {
|
|
7583
7608
|
await backupManager.restoreAll();
|
|
7584
|
-
|
|
7609
|
+
logger24.info("React Testing Library configuration rolled back");
|
|
7585
7610
|
} catch (error) {
|
|
7586
|
-
|
|
7611
|
+
logger24.error(
|
|
7587
7612
|
"Failed to rollback React Testing Library configuration:",
|
|
7588
7613
|
error
|
|
7589
7614
|
);
|
|
@@ -7672,6 +7697,7 @@ describe('Example Component', () => {
|
|
|
7672
7697
|
|
|
7673
7698
|
// src/plugins/testing/vue-testing-library.ts
|
|
7674
7699
|
import { join as join25 } from "path";
|
|
7700
|
+
var logger25 = getModuleLogger();
|
|
7675
7701
|
var vueTestingLibraryPlugin = {
|
|
7676
7702
|
name: "@testing-library/vue",
|
|
7677
7703
|
displayName: "Testing Library (Vue)",
|
|
@@ -7690,7 +7716,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7690
7716
|
*/
|
|
7691
7717
|
async install(ctx) {
|
|
7692
7718
|
if (this.detect?.(ctx)) {
|
|
7693
|
-
|
|
7719
|
+
logger25.info("Testing Library (Vue) is already installed");
|
|
7694
7720
|
return {
|
|
7695
7721
|
packages: {},
|
|
7696
7722
|
success: true,
|
|
@@ -7710,7 +7736,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7710
7736
|
exact: false,
|
|
7711
7737
|
silent: false
|
|
7712
7738
|
});
|
|
7713
|
-
|
|
7739
|
+
logger25.info("Successfully installed Testing Library (Vue)");
|
|
7714
7740
|
return {
|
|
7715
7741
|
packages: {
|
|
7716
7742
|
devDependencies: packages
|
|
@@ -7719,7 +7745,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7719
7745
|
message: `Installed Testing Library (Vue): ${packages.join(", ")}`
|
|
7720
7746
|
};
|
|
7721
7747
|
} catch (error) {
|
|
7722
|
-
|
|
7748
|
+
logger25.error("Failed to install Testing Library (Vue):", error);
|
|
7723
7749
|
return {
|
|
7724
7750
|
packages: {},
|
|
7725
7751
|
success: false,
|
|
@@ -7754,7 +7780,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7754
7780
|
content: setupContent,
|
|
7755
7781
|
backup: false
|
|
7756
7782
|
});
|
|
7757
|
-
|
|
7783
|
+
logger25.info(`Created test setup: ${setupPath}`);
|
|
7758
7784
|
}
|
|
7759
7785
|
const testDir = join25(srcDir, "components", "__tests__");
|
|
7760
7786
|
await ensureDirectory(testDir, ctx.fsAdapter);
|
|
@@ -7772,7 +7798,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7772
7798
|
content: testContent,
|
|
7773
7799
|
backup: false
|
|
7774
7800
|
});
|
|
7775
|
-
|
|
7801
|
+
logger25.info(`Created example test: ${testPath}`);
|
|
7776
7802
|
}
|
|
7777
7803
|
const vitestConfigPath = join25(projectRoot, "vitest.config.ts");
|
|
7778
7804
|
const vitestConfigExists = await checkPathExists(
|
|
@@ -7780,7 +7806,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7780
7806
|
ctx.fsAdapter
|
|
7781
7807
|
);
|
|
7782
7808
|
if (vitestConfigExists) {
|
|
7783
|
-
|
|
7809
|
+
logger25.info(
|
|
7784
7810
|
"vitest.config.ts found. Make sure to add setupFiles if needed."
|
|
7785
7811
|
);
|
|
7786
7812
|
}
|
|
@@ -7790,7 +7816,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7790
7816
|
message: "Testing Library (Vue) configured successfully"
|
|
7791
7817
|
};
|
|
7792
7818
|
} catch (error) {
|
|
7793
|
-
|
|
7819
|
+
logger25.error("Failed to configure Testing Library (Vue):", error);
|
|
7794
7820
|
await backupManager.restoreAll();
|
|
7795
7821
|
return {
|
|
7796
7822
|
files,
|
|
@@ -7806,9 +7832,9 @@ var vueTestingLibraryPlugin = {
|
|
|
7806
7832
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
7807
7833
|
try {
|
|
7808
7834
|
await backupManager.restoreAll();
|
|
7809
|
-
|
|
7835
|
+
logger25.info("Testing Library (Vue) configuration rolled back");
|
|
7810
7836
|
} catch (error) {
|
|
7811
|
-
|
|
7837
|
+
logger25.error("Failed to rollback Testing Library (Vue):", error);
|
|
7812
7838
|
throw error;
|
|
7813
7839
|
}
|
|
7814
7840
|
}
|
|
@@ -7854,6 +7880,7 @@ describe('Example component', () => {
|
|
|
7854
7880
|
|
|
7855
7881
|
// src/plugins/testing/vue-test-utils.ts
|
|
7856
7882
|
import { join as join26 } from "path";
|
|
7883
|
+
var logger26 = getModuleLogger();
|
|
7857
7884
|
var vueTestUtilsPlugin = {
|
|
7858
7885
|
name: "@vue/test-utils",
|
|
7859
7886
|
displayName: "Vue Test Utils",
|
|
@@ -7872,7 +7899,7 @@ var vueTestUtilsPlugin = {
|
|
|
7872
7899
|
*/
|
|
7873
7900
|
async install(ctx) {
|
|
7874
7901
|
if (this.detect?.(ctx)) {
|
|
7875
|
-
|
|
7902
|
+
logger26.info("Vue Test Utils is already installed");
|
|
7876
7903
|
return {
|
|
7877
7904
|
packages: {},
|
|
7878
7905
|
success: true,
|
|
@@ -7896,7 +7923,7 @@ var vueTestUtilsPlugin = {
|
|
|
7896
7923
|
exact: false,
|
|
7897
7924
|
silent: false
|
|
7898
7925
|
});
|
|
7899
|
-
|
|
7926
|
+
logger26.info("Successfully installed Vue Test Utils");
|
|
7900
7927
|
return {
|
|
7901
7928
|
packages: {
|
|
7902
7929
|
devDependencies: packages
|
|
@@ -7905,7 +7932,7 @@ var vueTestUtilsPlugin = {
|
|
|
7905
7932
|
message: `Installed ${packages.join(", ")}`
|
|
7906
7933
|
};
|
|
7907
7934
|
} catch (error) {
|
|
7908
|
-
|
|
7935
|
+
logger26.error("Failed to install Vue Test Utils:", error);
|
|
7909
7936
|
return {
|
|
7910
7937
|
packages: {},
|
|
7911
7938
|
success: false,
|
|
@@ -7921,8 +7948,7 @@ var vueTestUtilsPlugin = {
|
|
|
7921
7948
|
* - src/components/__tests__/Example.spec.ts : Exemple de test
|
|
7922
7949
|
*/
|
|
7923
7950
|
async configure(ctx) {
|
|
7924
|
-
const
|
|
7925
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
7951
|
+
const { writer } = getPluginServices(ctx);
|
|
7926
7952
|
const files = [];
|
|
7927
7953
|
const extension = ctx.typescript ? "ts" : "js";
|
|
7928
7954
|
try {
|
|
@@ -7938,7 +7964,7 @@ var vueTestUtilsPlugin = {
|
|
|
7938
7964
|
content: vitestConfigContent,
|
|
7939
7965
|
backup: false
|
|
7940
7966
|
});
|
|
7941
|
-
|
|
7967
|
+
logger26.info(`Created Vitest config: ${vitestConfigPath}`);
|
|
7942
7968
|
const testsDir = join26(
|
|
7943
7969
|
ctx.projectRoot,
|
|
7944
7970
|
ctx.srcDir,
|
|
@@ -7955,7 +7981,7 @@ var vueTestUtilsPlugin = {
|
|
|
7955
7981
|
content: testContent,
|
|
7956
7982
|
backup: false
|
|
7957
7983
|
});
|
|
7958
|
-
|
|
7984
|
+
logger26.info(`Created example test: ${testFilePath}`);
|
|
7959
7985
|
const packageJsonPath = join26(ctx.projectRoot, "package.json");
|
|
7960
7986
|
await writer.modifyPackageJson(ctx.projectRoot, (pkg) => {
|
|
7961
7987
|
pkg.scripts = pkg.scripts || {};
|
|
@@ -7969,14 +7995,14 @@ var vueTestUtilsPlugin = {
|
|
|
7969
7995
|
path: normalizePath(packageJsonPath),
|
|
7970
7996
|
backup: true
|
|
7971
7997
|
});
|
|
7972
|
-
|
|
7998
|
+
logger26.info("Updated package.json with test scripts");
|
|
7973
7999
|
return {
|
|
7974
8000
|
files,
|
|
7975
8001
|
success: true,
|
|
7976
8002
|
message: "Vue Test Utils configured successfully"
|
|
7977
8003
|
};
|
|
7978
8004
|
} catch (error) {
|
|
7979
|
-
|
|
8005
|
+
logger26.error("Failed to configure Vue Test Utils:", error);
|
|
7980
8006
|
return {
|
|
7981
8007
|
files,
|
|
7982
8008
|
success: false,
|
|
@@ -7988,9 +8014,9 @@ var vueTestUtilsPlugin = {
|
|
|
7988
8014
|
* Rollback de la configuration Vue Test Utils
|
|
7989
8015
|
*/
|
|
7990
8016
|
async rollback(_ctx) {
|
|
7991
|
-
const backupManager =
|
|
8017
|
+
const backupManager = getRollbackManager(_ctx);
|
|
7992
8018
|
await backupManager.restoreAll();
|
|
7993
|
-
|
|
8019
|
+
logger26.info("Vue Test Utils configuration rolled back");
|
|
7994
8020
|
}
|
|
7995
8021
|
};
|
|
7996
8022
|
function getVitestConfig(typescript) {
|
|
@@ -8172,6 +8198,7 @@ describe('HelloWorld', () => {
|
|
|
8172
8198
|
|
|
8173
8199
|
// src/plugins/tooling/eslint.ts
|
|
8174
8200
|
import { join as join27 } from "path";
|
|
8201
|
+
var logger27 = getModuleLogger();
|
|
8175
8202
|
var eslintPlugin = {
|
|
8176
8203
|
name: "eslint",
|
|
8177
8204
|
displayName: "ESLint",
|
|
@@ -8190,7 +8217,7 @@ var eslintPlugin = {
|
|
|
8190
8217
|
*/
|
|
8191
8218
|
async install(ctx) {
|
|
8192
8219
|
if (this.detect?.(ctx)) {
|
|
8193
|
-
|
|
8220
|
+
logger27.info("ESLint is already installed");
|
|
8194
8221
|
return {
|
|
8195
8222
|
packages: {},
|
|
8196
8223
|
success: true,
|
|
@@ -8216,7 +8243,7 @@ var eslintPlugin = {
|
|
|
8216
8243
|
exact: false,
|
|
8217
8244
|
silent: false
|
|
8218
8245
|
});
|
|
8219
|
-
|
|
8246
|
+
logger27.info("Successfully installed ESLint");
|
|
8220
8247
|
return {
|
|
8221
8248
|
packages: {
|
|
8222
8249
|
devDependencies: packages
|
|
@@ -8225,7 +8252,7 @@ var eslintPlugin = {
|
|
|
8225
8252
|
message: `Installed ${packages.join(", ")}`
|
|
8226
8253
|
};
|
|
8227
8254
|
} catch (error) {
|
|
8228
|
-
|
|
8255
|
+
logger27.error("Failed to install ESLint:", error);
|
|
8229
8256
|
return {
|
|
8230
8257
|
packages: {},
|
|
8231
8258
|
success: false,
|
|
@@ -8253,7 +8280,7 @@ var eslintPlugin = {
|
|
|
8253
8280
|
ctx.fsAdapter
|
|
8254
8281
|
);
|
|
8255
8282
|
if (eslintConfigExists) {
|
|
8256
|
-
|
|
8283
|
+
logger27.warn("eslint.config.js already exists, skipping creation");
|
|
8257
8284
|
} else {
|
|
8258
8285
|
const eslintConfigContent = getESLintConfigContent(ctx);
|
|
8259
8286
|
await writer.createFile(eslintConfigPath, eslintConfigContent);
|
|
@@ -8263,7 +8290,7 @@ var eslintPlugin = {
|
|
|
8263
8290
|
content: eslintConfigContent,
|
|
8264
8291
|
backup: false
|
|
8265
8292
|
});
|
|
8266
|
-
|
|
8293
|
+
logger27.info(`Created ESLint config: ${eslintConfigPath}`);
|
|
8267
8294
|
}
|
|
8268
8295
|
const packageJsonPath = join27(projectRoot, "package.json");
|
|
8269
8296
|
const packageJsonExists = await checkPathExists(
|
|
@@ -8302,7 +8329,7 @@ var eslintPlugin = {
|
|
|
8302
8329
|
content: updatedContent,
|
|
8303
8330
|
backup: true
|
|
8304
8331
|
});
|
|
8305
|
-
|
|
8332
|
+
logger27.info("Updated package.json with ESLint scripts");
|
|
8306
8333
|
}
|
|
8307
8334
|
}
|
|
8308
8335
|
return {
|
|
@@ -8311,7 +8338,7 @@ var eslintPlugin = {
|
|
|
8311
8338
|
message: "ESLint configured successfully"
|
|
8312
8339
|
};
|
|
8313
8340
|
} catch (error) {
|
|
8314
|
-
|
|
8341
|
+
logger27.error("Failed to configure ESLint:", error);
|
|
8315
8342
|
await backupManager.restoreAll();
|
|
8316
8343
|
return {
|
|
8317
8344
|
files,
|
|
@@ -8327,9 +8354,9 @@ var eslintPlugin = {
|
|
|
8327
8354
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
8328
8355
|
try {
|
|
8329
8356
|
await backupManager.restoreAll();
|
|
8330
|
-
|
|
8357
|
+
logger27.info("ESLint configuration rolled back");
|
|
8331
8358
|
} catch (error) {
|
|
8332
|
-
|
|
8359
|
+
logger27.error("Failed to rollback ESLint configuration:", error);
|
|
8333
8360
|
throw error;
|
|
8334
8361
|
}
|
|
8335
8362
|
}
|
|
@@ -8432,6 +8459,7 @@ export default [
|
|
|
8432
8459
|
|
|
8433
8460
|
// src/plugins/tooling/eslint-vue.ts
|
|
8434
8461
|
import { join as join28 } from "path";
|
|
8462
|
+
var logger28 = getModuleLogger();
|
|
8435
8463
|
var eslintVuePlugin = {
|
|
8436
8464
|
name: "eslint-plugin-vue",
|
|
8437
8465
|
displayName: "ESLint Vue",
|
|
@@ -8450,7 +8478,7 @@ var eslintVuePlugin = {
|
|
|
8450
8478
|
*/
|
|
8451
8479
|
async install(ctx) {
|
|
8452
8480
|
if (this.detect?.(ctx)) {
|
|
8453
|
-
|
|
8481
|
+
logger28.info("ESLint Vue is already installed");
|
|
8454
8482
|
return {
|
|
8455
8483
|
packages: {},
|
|
8456
8484
|
success: true,
|
|
@@ -8473,7 +8501,7 @@ var eslintVuePlugin = {
|
|
|
8473
8501
|
exact: false,
|
|
8474
8502
|
silent: false
|
|
8475
8503
|
});
|
|
8476
|
-
|
|
8504
|
+
logger28.info("Successfully installed ESLint Vue");
|
|
8477
8505
|
return {
|
|
8478
8506
|
packages: {
|
|
8479
8507
|
devDependencies: packages
|
|
@@ -8482,7 +8510,7 @@ var eslintVuePlugin = {
|
|
|
8482
8510
|
message: `Installed ${packages.join(", ")}`
|
|
8483
8511
|
};
|
|
8484
8512
|
} catch (error) {
|
|
8485
|
-
|
|
8513
|
+
logger28.error("Failed to install ESLint Vue:", error);
|
|
8486
8514
|
return {
|
|
8487
8515
|
packages: {},
|
|
8488
8516
|
success: false,
|
|
@@ -8524,7 +8552,7 @@ var eslintVuePlugin = {
|
|
|
8524
8552
|
content: updatedContent,
|
|
8525
8553
|
backup: true
|
|
8526
8554
|
});
|
|
8527
|
-
|
|
8555
|
+
logger28.info(`Updated ESLint config: ${eslintConfigPath}`);
|
|
8528
8556
|
}
|
|
8529
8557
|
} else {
|
|
8530
8558
|
const eslintConfigContent = getESLintVueConfigContent(ctx);
|
|
@@ -8535,7 +8563,7 @@ var eslintVuePlugin = {
|
|
|
8535
8563
|
content: eslintConfigContent,
|
|
8536
8564
|
backup: false
|
|
8537
8565
|
});
|
|
8538
|
-
|
|
8566
|
+
logger28.info(`Created ESLint Vue config: ${eslintConfigPath}`);
|
|
8539
8567
|
}
|
|
8540
8568
|
return {
|
|
8541
8569
|
files,
|
|
@@ -8543,7 +8571,7 @@ var eslintVuePlugin = {
|
|
|
8543
8571
|
message: "ESLint Vue configured successfully"
|
|
8544
8572
|
};
|
|
8545
8573
|
} catch (error) {
|
|
8546
|
-
|
|
8574
|
+
logger28.error("Failed to configure ESLint Vue:", error);
|
|
8547
8575
|
return {
|
|
8548
8576
|
files,
|
|
8549
8577
|
success: false,
|
|
@@ -8557,7 +8585,7 @@ var eslintVuePlugin = {
|
|
|
8557
8585
|
async rollback(_ctx) {
|
|
8558
8586
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
8559
8587
|
await backupManager.restoreAll();
|
|
8560
|
-
|
|
8588
|
+
logger28.info("ESLint Vue configuration rolled back");
|
|
8561
8589
|
}
|
|
8562
8590
|
};
|
|
8563
8591
|
function getESLintVueConfigContent(ctx) {
|
|
@@ -8645,6 +8673,7 @@ function updateESLintConfig(existingContent, ctx) {
|
|
|
8645
8673
|
// src/plugins/tooling/husky.ts
|
|
8646
8674
|
import { join as join29 } from "path";
|
|
8647
8675
|
import { execa } from "execa";
|
|
8676
|
+
var logger29 = getModuleLogger();
|
|
8648
8677
|
var huskyPlugin = {
|
|
8649
8678
|
name: "husky",
|
|
8650
8679
|
displayName: "Husky",
|
|
@@ -8663,7 +8692,7 @@ var huskyPlugin = {
|
|
|
8663
8692
|
*/
|
|
8664
8693
|
async install(ctx) {
|
|
8665
8694
|
if (this.detect?.(ctx)) {
|
|
8666
|
-
|
|
8695
|
+
logger29.info("Husky is already installed");
|
|
8667
8696
|
return {
|
|
8668
8697
|
packages: {},
|
|
8669
8698
|
success: true,
|
|
@@ -8678,7 +8707,7 @@ var huskyPlugin = {
|
|
|
8678
8707
|
exact: false,
|
|
8679
8708
|
silent: false
|
|
8680
8709
|
});
|
|
8681
|
-
|
|
8710
|
+
logger29.info("Successfully installed Husky");
|
|
8682
8711
|
return {
|
|
8683
8712
|
packages: {
|
|
8684
8713
|
devDependencies: ["husky"]
|
|
@@ -8687,7 +8716,7 @@ var huskyPlugin = {
|
|
|
8687
8716
|
message: "Installed husky"
|
|
8688
8717
|
};
|
|
8689
8718
|
} catch (error) {
|
|
8690
|
-
|
|
8719
|
+
logger29.error("Failed to install Husky:", error);
|
|
8691
8720
|
return {
|
|
8692
8721
|
packages: {},
|
|
8693
8722
|
success: false,
|
|
@@ -8714,7 +8743,7 @@ var huskyPlugin = {
|
|
|
8714
8743
|
const gitDir = join29(projectRoot, ".git");
|
|
8715
8744
|
const gitExists = await checkPathExists(gitDir, ctx.fsAdapter);
|
|
8716
8745
|
if (!gitExists) {
|
|
8717
|
-
|
|
8746
|
+
logger29.warn(
|
|
8718
8747
|
".git directory not found. Husky hooks will be skipped. Initialize Git and run npm run prepare to set up Husky."
|
|
8719
8748
|
);
|
|
8720
8749
|
return {
|
|
@@ -8739,7 +8768,7 @@ var huskyPlugin = {
|
|
|
8739
8768
|
content: preCommitContent,
|
|
8740
8769
|
backup: false
|
|
8741
8770
|
});
|
|
8742
|
-
|
|
8771
|
+
logger29.info(`Created pre-commit hook: ${preCommitPath}`);
|
|
8743
8772
|
}
|
|
8744
8773
|
const prePushPath = join29(huskyDir, "pre-push");
|
|
8745
8774
|
const prePushExists = await checkPathExists(prePushPath, ctx.fsAdapter);
|
|
@@ -8752,7 +8781,7 @@ var huskyPlugin = {
|
|
|
8752
8781
|
content: prePushContent,
|
|
8753
8782
|
backup: false
|
|
8754
8783
|
});
|
|
8755
|
-
|
|
8784
|
+
logger29.info(`Created pre-push hook: ${prePushPath}`);
|
|
8756
8785
|
}
|
|
8757
8786
|
const packageJsonPath = join29(projectRoot, "package.json");
|
|
8758
8787
|
const packageJsonExists = await checkPathExists(
|
|
@@ -8781,7 +8810,7 @@ var huskyPlugin = {
|
|
|
8781
8810
|
content: updatedContent,
|
|
8782
8811
|
backup: true
|
|
8783
8812
|
});
|
|
8784
|
-
|
|
8813
|
+
logger29.info("Updated package.json with Husky prepare script");
|
|
8785
8814
|
}
|
|
8786
8815
|
}
|
|
8787
8816
|
try {
|
|
@@ -8789,9 +8818,9 @@ var huskyPlugin = {
|
|
|
8789
8818
|
cwd: projectRoot,
|
|
8790
8819
|
stdio: "inherit"
|
|
8791
8820
|
});
|
|
8792
|
-
|
|
8821
|
+
logger29.info("Husky initialized successfully");
|
|
8793
8822
|
} catch {
|
|
8794
|
-
|
|
8823
|
+
logger29.warn(
|
|
8795
8824
|
"Failed to run husky init automatically. You may need to run it manually: npx husky init"
|
|
8796
8825
|
);
|
|
8797
8826
|
}
|
|
@@ -8801,7 +8830,7 @@ var huskyPlugin = {
|
|
|
8801
8830
|
message: "Husky configured successfully"
|
|
8802
8831
|
};
|
|
8803
8832
|
} catch (error) {
|
|
8804
|
-
|
|
8833
|
+
logger29.error("Failed to configure Husky:", error);
|
|
8805
8834
|
await backupManager.restoreAll();
|
|
8806
8835
|
return {
|
|
8807
8836
|
files,
|
|
@@ -8817,9 +8846,9 @@ var huskyPlugin = {
|
|
|
8817
8846
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
8818
8847
|
try {
|
|
8819
8848
|
await backupManager.restoreAll();
|
|
8820
|
-
|
|
8849
|
+
logger29.info("Husky configuration rolled back");
|
|
8821
8850
|
} catch (error) {
|
|
8822
|
-
|
|
8851
|
+
logger29.error("Failed to rollback Husky configuration:", error);
|
|
8823
8852
|
throw error;
|
|
8824
8853
|
}
|
|
8825
8854
|
}
|
|
@@ -8842,6 +8871,7 @@ npm run test:unit
|
|
|
8842
8871
|
|
|
8843
8872
|
// src/plugins/tooling/commitlint.ts
|
|
8844
8873
|
import { join as join30 } from "path";
|
|
8874
|
+
var logger30 = getModuleLogger();
|
|
8845
8875
|
var commitlintPlugin = {
|
|
8846
8876
|
name: "@commitlint/cli",
|
|
8847
8877
|
displayName: "Commitlint",
|
|
@@ -8860,7 +8890,7 @@ var commitlintPlugin = {
|
|
|
8860
8890
|
*/
|
|
8861
8891
|
async install(ctx) {
|
|
8862
8892
|
if (this.detect?.(ctx)) {
|
|
8863
|
-
|
|
8893
|
+
logger30.info("Commitlint is already installed");
|
|
8864
8894
|
return {
|
|
8865
8895
|
packages: {},
|
|
8866
8896
|
success: true,
|
|
@@ -8879,7 +8909,7 @@ var commitlintPlugin = {
|
|
|
8879
8909
|
exact: false,
|
|
8880
8910
|
silent: false
|
|
8881
8911
|
});
|
|
8882
|
-
|
|
8912
|
+
logger30.info("Successfully installed Commitlint");
|
|
8883
8913
|
return {
|
|
8884
8914
|
packages: {
|
|
8885
8915
|
devDependencies: packages
|
|
@@ -8888,7 +8918,7 @@ var commitlintPlugin = {
|
|
|
8888
8918
|
message: `Installed Commitlint: ${packages.join(", ")}`
|
|
8889
8919
|
};
|
|
8890
8920
|
} catch (error) {
|
|
8891
|
-
|
|
8921
|
+
logger30.error("Failed to install Commitlint:", error);
|
|
8892
8922
|
return {
|
|
8893
8923
|
packages: {},
|
|
8894
8924
|
success: false,
|
|
@@ -8923,7 +8953,7 @@ var commitlintPlugin = {
|
|
|
8923
8953
|
content: configContent,
|
|
8924
8954
|
backup: false
|
|
8925
8955
|
});
|
|
8926
|
-
|
|
8956
|
+
logger30.info(`Created commitlint config: ${configPath}`);
|
|
8927
8957
|
}
|
|
8928
8958
|
await writer.modifyPackageJson(projectRoot, (pkg) => {
|
|
8929
8959
|
pkg.scripts = pkg.scripts || {};
|
|
@@ -8955,7 +8985,7 @@ var commitlintPlugin = {
|
|
|
8955
8985
|
content: commitMsgContent,
|
|
8956
8986
|
backup: false
|
|
8957
8987
|
});
|
|
8958
|
-
|
|
8988
|
+
logger30.info(`Created commit-msg hook: ${commitMsgPath}`);
|
|
8959
8989
|
} else {
|
|
8960
8990
|
const existingContent = await readFileContent(
|
|
8961
8991
|
commitMsgPath,
|
|
@@ -8973,11 +9003,11 @@ var commitlintPlugin = {
|
|
|
8973
9003
|
content: updatedContent,
|
|
8974
9004
|
backup: true
|
|
8975
9005
|
});
|
|
8976
|
-
|
|
9006
|
+
logger30.info(`Updated commit-msg hook: ${commitMsgPath}`);
|
|
8977
9007
|
}
|
|
8978
9008
|
}
|
|
8979
9009
|
} else {
|
|
8980
|
-
|
|
9010
|
+
logger30.warn(
|
|
8981
9011
|
".husky directory not found. Commit-msg hook not created. Install Husky first."
|
|
8982
9012
|
);
|
|
8983
9013
|
}
|
|
@@ -8987,7 +9017,7 @@ var commitlintPlugin = {
|
|
|
8987
9017
|
message: "Commitlint configured successfully"
|
|
8988
9018
|
};
|
|
8989
9019
|
} catch (error) {
|
|
8990
|
-
|
|
9020
|
+
logger30.error("Failed to configure Commitlint:", error);
|
|
8991
9021
|
await backupManager.restoreAll();
|
|
8992
9022
|
return {
|
|
8993
9023
|
files,
|
|
@@ -9003,9 +9033,9 @@ var commitlintPlugin = {
|
|
|
9003
9033
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9004
9034
|
try {
|
|
9005
9035
|
await backupManager.restoreAll();
|
|
9006
|
-
|
|
9036
|
+
logger30.info("Commitlint configuration rolled back");
|
|
9007
9037
|
} catch (error) {
|
|
9008
|
-
|
|
9038
|
+
logger30.error("Failed to rollback Commitlint configuration:", error);
|
|
9009
9039
|
throw error;
|
|
9010
9040
|
}
|
|
9011
9041
|
}
|
|
@@ -9029,6 +9059,7 @@ ${getCommitMsgCommand()}
|
|
|
9029
9059
|
|
|
9030
9060
|
// src/plugins/tooling/lint-staged.ts
|
|
9031
9061
|
import { join as join31 } from "path";
|
|
9062
|
+
var logger31 = getModuleLogger();
|
|
9032
9063
|
var lintStagedPlugin = {
|
|
9033
9064
|
name: "lint-staged",
|
|
9034
9065
|
displayName: "lint-staged",
|
|
@@ -9047,7 +9078,7 @@ var lintStagedPlugin = {
|
|
|
9047
9078
|
*/
|
|
9048
9079
|
async install(ctx) {
|
|
9049
9080
|
if (this.detect?.(ctx)) {
|
|
9050
|
-
|
|
9081
|
+
logger31.info("lint-staged is already installed");
|
|
9051
9082
|
return {
|
|
9052
9083
|
packages: {},
|
|
9053
9084
|
success: true,
|
|
@@ -9062,7 +9093,7 @@ var lintStagedPlugin = {
|
|
|
9062
9093
|
exact: false,
|
|
9063
9094
|
silent: false
|
|
9064
9095
|
});
|
|
9065
|
-
|
|
9096
|
+
logger31.info("Successfully installed lint-staged");
|
|
9066
9097
|
return {
|
|
9067
9098
|
packages: {
|
|
9068
9099
|
devDependencies: ["lint-staged"]
|
|
@@ -9071,7 +9102,7 @@ var lintStagedPlugin = {
|
|
|
9071
9102
|
message: "Installed lint-staged"
|
|
9072
9103
|
};
|
|
9073
9104
|
} catch (error) {
|
|
9074
|
-
|
|
9105
|
+
logger31.error("Failed to install lint-staged:", error);
|
|
9075
9106
|
return {
|
|
9076
9107
|
packages: {},
|
|
9077
9108
|
success: false,
|
|
@@ -9088,8 +9119,7 @@ var lintStagedPlugin = {
|
|
|
9088
9119
|
* - package.json (script lint-staged)
|
|
9089
9120
|
*/
|
|
9090
9121
|
async configure(ctx) {
|
|
9091
|
-
const backupManager =
|
|
9092
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
9122
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
9093
9123
|
const files = [];
|
|
9094
9124
|
const projectRoot = ctx.projectRoot;
|
|
9095
9125
|
const configPath = join31(projectRoot, "lint-staged.config.cjs");
|
|
@@ -9105,7 +9135,7 @@ var lintStagedPlugin = {
|
|
|
9105
9135
|
content: configContent,
|
|
9106
9136
|
backup: false
|
|
9107
9137
|
});
|
|
9108
|
-
|
|
9138
|
+
logger31.info(`Created lint-staged config: ${configPath}`);
|
|
9109
9139
|
}
|
|
9110
9140
|
await writer.modifyPackageJson(projectRoot, (pkg) => {
|
|
9111
9141
|
pkg.scripts = pkg.scripts || {};
|
|
@@ -9119,14 +9149,14 @@ var lintStagedPlugin = {
|
|
|
9119
9149
|
path: normalizePath(packageJsonPath),
|
|
9120
9150
|
backup: true
|
|
9121
9151
|
});
|
|
9122
|
-
|
|
9152
|
+
logger31.info("Updated package.json with lint-staged script");
|
|
9123
9153
|
return {
|
|
9124
9154
|
files,
|
|
9125
9155
|
success: true,
|
|
9126
9156
|
message: "lint-staged configured successfully"
|
|
9127
9157
|
};
|
|
9128
9158
|
} catch (error) {
|
|
9129
|
-
|
|
9159
|
+
logger31.error("Failed to configure lint-staged:", error);
|
|
9130
9160
|
await backupManager.restoreAll();
|
|
9131
9161
|
return {
|
|
9132
9162
|
files,
|
|
@@ -9139,12 +9169,12 @@ var lintStagedPlugin = {
|
|
|
9139
9169
|
* Rollback de la configuration lint-staged
|
|
9140
9170
|
*/
|
|
9141
9171
|
async rollback(_ctx) {
|
|
9142
|
-
const backupManager =
|
|
9172
|
+
const backupManager = getRollbackManager(_ctx);
|
|
9143
9173
|
try {
|
|
9144
9174
|
await backupManager.restoreAll();
|
|
9145
|
-
|
|
9175
|
+
logger31.info("lint-staged configuration rolled back");
|
|
9146
9176
|
} catch (error) {
|
|
9147
|
-
|
|
9177
|
+
logger31.error("Failed to rollback lint-staged configuration:", error);
|
|
9148
9178
|
throw error;
|
|
9149
9179
|
}
|
|
9150
9180
|
}
|
|
@@ -9159,6 +9189,7 @@ function getLintStagedConfig() {
|
|
|
9159
9189
|
|
|
9160
9190
|
// src/plugins/tooling/prettier.ts
|
|
9161
9191
|
import { join as join32 } from "path";
|
|
9192
|
+
var logger32 = getModuleLogger();
|
|
9162
9193
|
var prettierPlugin = {
|
|
9163
9194
|
name: "prettier",
|
|
9164
9195
|
displayName: "Prettier",
|
|
@@ -9177,7 +9208,7 @@ var prettierPlugin = {
|
|
|
9177
9208
|
*/
|
|
9178
9209
|
async install(ctx) {
|
|
9179
9210
|
if (this.detect?.(ctx)) {
|
|
9180
|
-
|
|
9211
|
+
logger32.info("Prettier is already installed");
|
|
9181
9212
|
return {
|
|
9182
9213
|
packages: {},
|
|
9183
9214
|
success: true,
|
|
@@ -9192,7 +9223,7 @@ var prettierPlugin = {
|
|
|
9192
9223
|
exact: false,
|
|
9193
9224
|
silent: false
|
|
9194
9225
|
});
|
|
9195
|
-
|
|
9226
|
+
logger32.info("Successfully installed Prettier");
|
|
9196
9227
|
return {
|
|
9197
9228
|
packages: {
|
|
9198
9229
|
devDependencies: ["prettier"]
|
|
@@ -9201,7 +9232,7 @@ var prettierPlugin = {
|
|
|
9201
9232
|
message: "Installed prettier"
|
|
9202
9233
|
};
|
|
9203
9234
|
} catch (error) {
|
|
9204
|
-
|
|
9235
|
+
logger32.error("Failed to install Prettier:", error);
|
|
9205
9236
|
return {
|
|
9206
9237
|
packages: {},
|
|
9207
9238
|
success: false,
|
|
@@ -9230,7 +9261,7 @@ var prettierPlugin = {
|
|
|
9230
9261
|
ctx.fsAdapter
|
|
9231
9262
|
);
|
|
9232
9263
|
if (prettierrcExists) {
|
|
9233
|
-
|
|
9264
|
+
logger32.warn(".prettierrc.json already exists, skipping creation");
|
|
9234
9265
|
} else {
|
|
9235
9266
|
const prettierrcContent = getPrettierConfigContent();
|
|
9236
9267
|
await writer.createFile(prettierrcPath, prettierrcContent);
|
|
@@ -9240,7 +9271,7 @@ var prettierPlugin = {
|
|
|
9240
9271
|
content: prettierrcContent,
|
|
9241
9272
|
backup: false
|
|
9242
9273
|
});
|
|
9243
|
-
|
|
9274
|
+
logger32.info(`Created Prettier config: ${prettierrcPath}`);
|
|
9244
9275
|
}
|
|
9245
9276
|
const prettierignorePath = join32(projectRoot, ".prettierignore");
|
|
9246
9277
|
const prettierignoreExists = await checkPathExists(
|
|
@@ -9248,7 +9279,7 @@ var prettierPlugin = {
|
|
|
9248
9279
|
ctx.fsAdapter
|
|
9249
9280
|
);
|
|
9250
9281
|
if (prettierignoreExists) {
|
|
9251
|
-
|
|
9282
|
+
logger32.warn(".prettierignore already exists, skipping creation");
|
|
9252
9283
|
} else {
|
|
9253
9284
|
const prettierignoreContent = getPrettierIgnoreContent();
|
|
9254
9285
|
await writer.createFile(prettierignorePath, prettierignoreContent);
|
|
@@ -9258,7 +9289,7 @@ var prettierPlugin = {
|
|
|
9258
9289
|
content: prettierignoreContent,
|
|
9259
9290
|
backup: false
|
|
9260
9291
|
});
|
|
9261
|
-
|
|
9292
|
+
logger32.info(`Created .prettierignore: ${prettierignorePath}`);
|
|
9262
9293
|
}
|
|
9263
9294
|
const packageJsonPath = join32(projectRoot, "package.json");
|
|
9264
9295
|
const packageJsonExists = await checkPathExists(
|
|
@@ -9297,7 +9328,7 @@ var prettierPlugin = {
|
|
|
9297
9328
|
content: updatedContent,
|
|
9298
9329
|
backup: true
|
|
9299
9330
|
});
|
|
9300
|
-
|
|
9331
|
+
logger32.info("Updated package.json with Prettier scripts");
|
|
9301
9332
|
}
|
|
9302
9333
|
}
|
|
9303
9334
|
return {
|
|
@@ -9306,7 +9337,7 @@ var prettierPlugin = {
|
|
|
9306
9337
|
message: "Prettier configured successfully"
|
|
9307
9338
|
};
|
|
9308
9339
|
} catch (error) {
|
|
9309
|
-
|
|
9340
|
+
logger32.error("Failed to configure Prettier:", error);
|
|
9310
9341
|
await backupManager.restoreAll();
|
|
9311
9342
|
return {
|
|
9312
9343
|
files,
|
|
@@ -9322,9 +9353,9 @@ var prettierPlugin = {
|
|
|
9322
9353
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9323
9354
|
try {
|
|
9324
9355
|
await backupManager.restoreAll();
|
|
9325
|
-
|
|
9356
|
+
logger32.info("Prettier configuration rolled back");
|
|
9326
9357
|
} catch (error) {
|
|
9327
|
-
|
|
9358
|
+
logger32.error("Failed to rollback Prettier configuration:", error);
|
|
9328
9359
|
throw error;
|
|
9329
9360
|
}
|
|
9330
9361
|
}
|
|
@@ -9362,6 +9393,7 @@ pnpm-lock.yaml
|
|
|
9362
9393
|
|
|
9363
9394
|
// src/plugins/tooling/unplugin-auto-import.ts
|
|
9364
9395
|
import { join as join33 } from "path";
|
|
9396
|
+
var logger33 = getModuleLogger();
|
|
9365
9397
|
var unpluginAutoImportPlugin = {
|
|
9366
9398
|
name: "unplugin-auto-import",
|
|
9367
9399
|
displayName: "Auto Import (Vue)",
|
|
@@ -9381,7 +9413,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9381
9413
|
*/
|
|
9382
9414
|
async install(ctx) {
|
|
9383
9415
|
if (this.detect?.(ctx)) {
|
|
9384
|
-
|
|
9416
|
+
logger33.info("unplugin-auto-import is already installed");
|
|
9385
9417
|
return {
|
|
9386
9418
|
packages: {},
|
|
9387
9419
|
success: true,
|
|
@@ -9397,7 +9429,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9397
9429
|
exact: false,
|
|
9398
9430
|
silent: false
|
|
9399
9431
|
});
|
|
9400
|
-
|
|
9432
|
+
logger33.info("Successfully installed unplugin-auto-import");
|
|
9401
9433
|
return {
|
|
9402
9434
|
packages: {
|
|
9403
9435
|
devDependencies: packages
|
|
@@ -9406,7 +9438,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9406
9438
|
message: `Installed unplugin-auto-import: ${packages.join(", ")}`
|
|
9407
9439
|
};
|
|
9408
9440
|
} catch (error) {
|
|
9409
|
-
|
|
9441
|
+
logger33.error("Failed to install unplugin-auto-import:", error);
|
|
9410
9442
|
return {
|
|
9411
9443
|
packages: {},
|
|
9412
9444
|
success: false,
|
|
@@ -9449,7 +9481,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9449
9481
|
content: updatedContent,
|
|
9450
9482
|
backup: true
|
|
9451
9483
|
});
|
|
9452
|
-
|
|
9484
|
+
logger33.info(`Updated ${viteConfigPath} with Auto Import plugin`);
|
|
9453
9485
|
}
|
|
9454
9486
|
} else {
|
|
9455
9487
|
const viteConfigContent = getViteConfigContent();
|
|
@@ -9460,7 +9492,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9460
9492
|
content: viteConfigContent,
|
|
9461
9493
|
backup: false
|
|
9462
9494
|
});
|
|
9463
|
-
|
|
9495
|
+
logger33.info(`Created ${viteConfigPath} with Auto Import plugin`);
|
|
9464
9496
|
}
|
|
9465
9497
|
return {
|
|
9466
9498
|
files,
|
|
@@ -9468,7 +9500,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9468
9500
|
message: "unplugin-auto-import configured successfully"
|
|
9469
9501
|
};
|
|
9470
9502
|
} catch (error) {
|
|
9471
|
-
|
|
9503
|
+
logger33.error("Failed to configure unplugin-auto-import:", error);
|
|
9472
9504
|
await backupManager.restoreAll();
|
|
9473
9505
|
return {
|
|
9474
9506
|
files,
|
|
@@ -9484,9 +9516,9 @@ var unpluginAutoImportPlugin = {
|
|
|
9484
9516
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9485
9517
|
try {
|
|
9486
9518
|
await backupManager.restoreAll();
|
|
9487
|
-
|
|
9519
|
+
logger33.info("unplugin-auto-import configuration rolled back");
|
|
9488
9520
|
} catch (error) {
|
|
9489
|
-
|
|
9521
|
+
logger33.error(
|
|
9490
9522
|
"Failed to rollback unplugin-auto-import configuration:",
|
|
9491
9523
|
error
|
|
9492
9524
|
);
|
|
@@ -9548,6 +9580,7 @@ function injectAutoImportPlugin(content) {
|
|
|
9548
9580
|
|
|
9549
9581
|
// src/plugins/tooling/unplugin-vue-components.ts
|
|
9550
9582
|
import { join as join34 } from "path";
|
|
9583
|
+
var logger34 = getModuleLogger();
|
|
9551
9584
|
var unpluginVueComponentsPlugin = {
|
|
9552
9585
|
name: "unplugin-vue-components",
|
|
9553
9586
|
displayName: "Auto Components (Vue)",
|
|
@@ -9567,7 +9600,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9567
9600
|
*/
|
|
9568
9601
|
async install(ctx) {
|
|
9569
9602
|
if (this.detect?.(ctx)) {
|
|
9570
|
-
|
|
9603
|
+
logger34.info("unplugin-vue-components is already installed");
|
|
9571
9604
|
return {
|
|
9572
9605
|
packages: {},
|
|
9573
9606
|
success: true,
|
|
@@ -9583,7 +9616,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9583
9616
|
exact: false,
|
|
9584
9617
|
silent: false
|
|
9585
9618
|
});
|
|
9586
|
-
|
|
9619
|
+
logger34.info("Successfully installed unplugin-vue-components");
|
|
9587
9620
|
return {
|
|
9588
9621
|
packages: {
|
|
9589
9622
|
devDependencies: packages
|
|
@@ -9592,7 +9625,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9592
9625
|
message: `Installed unplugin-vue-components: ${packages.join(", ")}`
|
|
9593
9626
|
};
|
|
9594
9627
|
} catch (error) {
|
|
9595
|
-
|
|
9628
|
+
logger34.error("Failed to install unplugin-vue-components:", error);
|
|
9596
9629
|
return {
|
|
9597
9630
|
packages: {},
|
|
9598
9631
|
success: false,
|
|
@@ -9635,7 +9668,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9635
9668
|
content: updatedContent,
|
|
9636
9669
|
backup: true
|
|
9637
9670
|
});
|
|
9638
|
-
|
|
9671
|
+
logger34.info(`Updated ${viteConfigPath} with Vue Components plugin`);
|
|
9639
9672
|
}
|
|
9640
9673
|
} else {
|
|
9641
9674
|
const viteConfigContent = getViteConfigContent2();
|
|
@@ -9646,7 +9679,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9646
9679
|
content: viteConfigContent,
|
|
9647
9680
|
backup: false
|
|
9648
9681
|
});
|
|
9649
|
-
|
|
9682
|
+
logger34.info(`Created ${viteConfigPath} with Vue Components plugin`);
|
|
9650
9683
|
}
|
|
9651
9684
|
return {
|
|
9652
9685
|
files,
|
|
@@ -9654,7 +9687,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9654
9687
|
message: "unplugin-vue-components configured successfully"
|
|
9655
9688
|
};
|
|
9656
9689
|
} catch (error) {
|
|
9657
|
-
|
|
9690
|
+
logger34.error("Failed to configure unplugin-vue-components:", error);
|
|
9658
9691
|
await backupManager.restoreAll();
|
|
9659
9692
|
return {
|
|
9660
9693
|
files,
|
|
@@ -9670,9 +9703,9 @@ var unpluginVueComponentsPlugin = {
|
|
|
9670
9703
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9671
9704
|
try {
|
|
9672
9705
|
await backupManager.restoreAll();
|
|
9673
|
-
|
|
9706
|
+
logger34.info("unplugin-vue-components configuration rolled back");
|
|
9674
9707
|
} catch (error) {
|
|
9675
|
-
|
|
9708
|
+
logger34.error(
|
|
9676
9709
|
"Failed to rollback unplugin-vue-components configuration:",
|
|
9677
9710
|
error
|
|
9678
9711
|
);
|
|
@@ -9732,6 +9765,7 @@ function injectComponentsPlugin(content) {
|
|
|
9732
9765
|
|
|
9733
9766
|
// src/plugins/tooling/vue-tsc.ts
|
|
9734
9767
|
import { join as join35 } from "path";
|
|
9768
|
+
var logger35 = getModuleLogger();
|
|
9735
9769
|
var vueTscPlugin = {
|
|
9736
9770
|
name: "vue-tsc",
|
|
9737
9771
|
displayName: "vue-tsc",
|
|
@@ -9751,7 +9785,7 @@ var vueTscPlugin = {
|
|
|
9751
9785
|
*/
|
|
9752
9786
|
async install(ctx) {
|
|
9753
9787
|
if (this.detect?.(ctx)) {
|
|
9754
|
-
|
|
9788
|
+
logger35.info("vue-tsc is already installed");
|
|
9755
9789
|
return {
|
|
9756
9790
|
packages: {},
|
|
9757
9791
|
success: true,
|
|
@@ -9767,7 +9801,7 @@ var vueTscPlugin = {
|
|
|
9767
9801
|
exact: false,
|
|
9768
9802
|
silent: false
|
|
9769
9803
|
});
|
|
9770
|
-
|
|
9804
|
+
logger35.info("Successfully installed vue-tsc");
|
|
9771
9805
|
return {
|
|
9772
9806
|
packages: {
|
|
9773
9807
|
devDependencies: packages
|
|
@@ -9776,7 +9810,7 @@ var vueTscPlugin = {
|
|
|
9776
9810
|
message: `Installed vue-tsc: ${packages.join(", ")}`
|
|
9777
9811
|
};
|
|
9778
9812
|
} catch (error) {
|
|
9779
|
-
|
|
9813
|
+
logger35.error("Failed to install vue-tsc:", error);
|
|
9780
9814
|
return {
|
|
9781
9815
|
packages: {},
|
|
9782
9816
|
success: false,
|
|
@@ -9790,8 +9824,7 @@ var vueTscPlugin = {
|
|
|
9790
9824
|
* Ajoute le script typecheck si absent
|
|
9791
9825
|
*/
|
|
9792
9826
|
async configure(ctx) {
|
|
9793
|
-
const
|
|
9794
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
9827
|
+
const { writer } = getPluginServices(ctx);
|
|
9795
9828
|
const files = [];
|
|
9796
9829
|
const packageJsonPath = join35(ctx.projectRoot, "package.json");
|
|
9797
9830
|
try {
|
|
@@ -9807,14 +9840,14 @@ var vueTscPlugin = {
|
|
|
9807
9840
|
path: normalizePath(packageJsonPath),
|
|
9808
9841
|
backup: true
|
|
9809
9842
|
});
|
|
9810
|
-
|
|
9843
|
+
logger35.info("Updated package.json with vue-tsc typecheck script");
|
|
9811
9844
|
return {
|
|
9812
9845
|
files,
|
|
9813
9846
|
success: true,
|
|
9814
9847
|
message: "vue-tsc configured successfully"
|
|
9815
9848
|
};
|
|
9816
9849
|
} catch (error) {
|
|
9817
|
-
|
|
9850
|
+
logger35.error("Failed to configure vue-tsc:", error);
|
|
9818
9851
|
return {
|
|
9819
9852
|
files,
|
|
9820
9853
|
success: false,
|
|
@@ -9826,14 +9859,15 @@ var vueTscPlugin = {
|
|
|
9826
9859
|
* Rollback de la configuration vue-tsc
|
|
9827
9860
|
*/
|
|
9828
9861
|
async rollback(_ctx) {
|
|
9829
|
-
const backupManager =
|
|
9862
|
+
const backupManager = getRollbackManager(_ctx);
|
|
9830
9863
|
await backupManager.restoreAll();
|
|
9831
|
-
|
|
9864
|
+
logger35.info("vue-tsc configuration rolled back");
|
|
9832
9865
|
}
|
|
9833
9866
|
};
|
|
9834
9867
|
|
|
9835
9868
|
// src/plugins/ui/radix-ui.ts
|
|
9836
9869
|
import { join as join36 } from "path";
|
|
9870
|
+
var logger36 = getModuleLogger();
|
|
9837
9871
|
var radixUiPlugin = {
|
|
9838
9872
|
name: "radix-ui",
|
|
9839
9873
|
displayName: "Radix UI",
|
|
@@ -9852,7 +9886,7 @@ var radixUiPlugin = {
|
|
|
9852
9886
|
*/
|
|
9853
9887
|
async install(ctx) {
|
|
9854
9888
|
if (this.detect?.(ctx)) {
|
|
9855
|
-
|
|
9889
|
+
logger36.info("Radix UI is already installed");
|
|
9856
9890
|
return {
|
|
9857
9891
|
packages: {},
|
|
9858
9892
|
success: true,
|
|
@@ -9879,7 +9913,7 @@ var radixUiPlugin = {
|
|
|
9879
9913
|
exact: false,
|
|
9880
9914
|
silent: false
|
|
9881
9915
|
});
|
|
9882
|
-
|
|
9916
|
+
logger36.info("Successfully installed Radix UI primitives");
|
|
9883
9917
|
return {
|
|
9884
9918
|
packages: {
|
|
9885
9919
|
dependencies: packages
|
|
@@ -9888,7 +9922,7 @@ var radixUiPlugin = {
|
|
|
9888
9922
|
message: `Installed Radix UI primitives: ${packages.length} packages`
|
|
9889
9923
|
};
|
|
9890
9924
|
} catch (error) {
|
|
9891
|
-
|
|
9925
|
+
logger36.error("Failed to install Radix UI:", error);
|
|
9892
9926
|
return {
|
|
9893
9927
|
packages: {},
|
|
9894
9928
|
success: false,
|
|
@@ -9907,8 +9941,7 @@ var radixUiPlugin = {
|
|
|
9907
9941
|
* Documentation : https://www.radix-ui.com/primitives/docs
|
|
9908
9942
|
*/
|
|
9909
9943
|
async configure(ctx) {
|
|
9910
|
-
const backupManager =
|
|
9911
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
9944
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
9912
9945
|
const files = [];
|
|
9913
9946
|
const srcDir = join36(ctx.projectRoot, ctx.srcDir);
|
|
9914
9947
|
const extension = ctx.typescript ? "tsx" : "jsx";
|
|
@@ -9924,7 +9957,7 @@ var radixUiPlugin = {
|
|
|
9924
9957
|
content: dialogContent,
|
|
9925
9958
|
backup: false
|
|
9926
9959
|
});
|
|
9927
|
-
|
|
9960
|
+
logger36.info(`Created Dialog component: ${dialogPath}`);
|
|
9928
9961
|
const dropdownMenuPath = join36(radixDir, `DropdownMenu.${extension}`);
|
|
9929
9962
|
const dropdownMenuContent = ctx.typescript ? getDropdownMenuContentTS() : getDropdownMenuContentJS();
|
|
9930
9963
|
await writer.createFile(dropdownMenuPath, dropdownMenuContent);
|
|
@@ -9934,7 +9967,7 @@ var radixUiPlugin = {
|
|
|
9934
9967
|
content: dropdownMenuContent,
|
|
9935
9968
|
backup: false
|
|
9936
9969
|
});
|
|
9937
|
-
|
|
9970
|
+
logger36.info(`Created DropdownMenu component: ${dropdownMenuPath}`);
|
|
9938
9971
|
const indexPath = join36(radixDir, `index.${ctx.typescript ? "ts" : "js"}`);
|
|
9939
9972
|
const indexContent = ctx.typescript ? getIndexContentTS6() : getIndexContentJS6();
|
|
9940
9973
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -9944,14 +9977,14 @@ var radixUiPlugin = {
|
|
|
9944
9977
|
content: indexContent,
|
|
9945
9978
|
backup: false
|
|
9946
9979
|
});
|
|
9947
|
-
|
|
9980
|
+
logger36.info(`Created Radix UI components index: ${indexPath}`);
|
|
9948
9981
|
return {
|
|
9949
9982
|
files,
|
|
9950
9983
|
success: true,
|
|
9951
9984
|
message: "Radix UI configured successfully"
|
|
9952
9985
|
};
|
|
9953
9986
|
} catch (error) {
|
|
9954
|
-
|
|
9987
|
+
logger36.error("Failed to configure Radix UI:", error);
|
|
9955
9988
|
await backupManager.restoreAll();
|
|
9956
9989
|
return {
|
|
9957
9990
|
files,
|
|
@@ -9964,12 +9997,12 @@ var radixUiPlugin = {
|
|
|
9964
9997
|
* Rollback de la configuration Radix UI
|
|
9965
9998
|
*/
|
|
9966
9999
|
async rollback(_ctx) {
|
|
9967
|
-
const backupManager =
|
|
10000
|
+
const backupManager = getRollbackManager(_ctx);
|
|
9968
10001
|
try {
|
|
9969
10002
|
await backupManager.restoreAll();
|
|
9970
|
-
|
|
10003
|
+
logger36.info("Radix UI configuration rolled back");
|
|
9971
10004
|
} catch (error) {
|
|
9972
|
-
|
|
10005
|
+
logger36.error("Failed to rollback Radix UI configuration:", error);
|
|
9973
10006
|
throw error;
|
|
9974
10007
|
}
|
|
9975
10008
|
}
|
|
@@ -10564,6 +10597,7 @@ export {
|
|
|
10564
10597
|
|
|
10565
10598
|
// src/plugins/ui/react-hot-toast.ts
|
|
10566
10599
|
import { join as join37 } from "path";
|
|
10600
|
+
var logger37 = getModuleLogger();
|
|
10567
10601
|
var reactHotToastPlugin = {
|
|
10568
10602
|
name: "react-hot-toast",
|
|
10569
10603
|
displayName: "React Hot Toast",
|
|
@@ -10582,7 +10616,7 @@ var reactHotToastPlugin = {
|
|
|
10582
10616
|
*/
|
|
10583
10617
|
async install(ctx) {
|
|
10584
10618
|
if (this.detect?.(ctx)) {
|
|
10585
|
-
|
|
10619
|
+
logger37.info("React Hot Toast is already installed");
|
|
10586
10620
|
return {
|
|
10587
10621
|
packages: {},
|
|
10588
10622
|
success: true,
|
|
@@ -10598,7 +10632,7 @@ var reactHotToastPlugin = {
|
|
|
10598
10632
|
exact: false,
|
|
10599
10633
|
silent: false
|
|
10600
10634
|
});
|
|
10601
|
-
|
|
10635
|
+
logger37.info("Successfully installed React Hot Toast");
|
|
10602
10636
|
return {
|
|
10603
10637
|
packages: {
|
|
10604
10638
|
dependencies: packages
|
|
@@ -10607,7 +10641,7 @@ var reactHotToastPlugin = {
|
|
|
10607
10641
|
message: `Installed React Hot Toast: ${packages.join(", ")}`
|
|
10608
10642
|
};
|
|
10609
10643
|
} catch (error) {
|
|
10610
|
-
|
|
10644
|
+
logger37.error("Failed to install React Hot Toast:", error);
|
|
10611
10645
|
return {
|
|
10612
10646
|
packages: {},
|
|
10613
10647
|
success: false,
|
|
@@ -10657,9 +10691,9 @@ var reactHotToastPlugin = {
|
|
|
10657
10691
|
content: updatedContent,
|
|
10658
10692
|
backup: true
|
|
10659
10693
|
});
|
|
10660
|
-
|
|
10694
|
+
logger37.info(`Added Toaster to ${targetPath}`);
|
|
10661
10695
|
} else {
|
|
10662
|
-
|
|
10696
|
+
logger37.warn("Toaster already configured in the app");
|
|
10663
10697
|
}
|
|
10664
10698
|
} else {
|
|
10665
10699
|
const newAppPath = join37(srcDir, `App.${extension}`);
|
|
@@ -10671,7 +10705,7 @@ var reactHotToastPlugin = {
|
|
|
10671
10705
|
content: newAppContent,
|
|
10672
10706
|
backup: false
|
|
10673
10707
|
});
|
|
10674
|
-
|
|
10708
|
+
logger37.info(`Created App.${extension} with Toaster`);
|
|
10675
10709
|
}
|
|
10676
10710
|
return {
|
|
10677
10711
|
files,
|
|
@@ -10679,7 +10713,7 @@ var reactHotToastPlugin = {
|
|
|
10679
10713
|
message: "React Hot Toast configured successfully"
|
|
10680
10714
|
};
|
|
10681
10715
|
} catch (error) {
|
|
10682
|
-
|
|
10716
|
+
logger37.error("Failed to configure React Hot Toast:", error);
|
|
10683
10717
|
await backupManager.restoreAll();
|
|
10684
10718
|
return {
|
|
10685
10719
|
files,
|
|
@@ -10695,9 +10729,9 @@ var reactHotToastPlugin = {
|
|
|
10695
10729
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
10696
10730
|
try {
|
|
10697
10731
|
await backupManager.restoreAll();
|
|
10698
|
-
|
|
10732
|
+
logger37.info("React Hot Toast configuration rolled back");
|
|
10699
10733
|
} catch (error) {
|
|
10700
|
-
|
|
10734
|
+
logger37.error("Failed to rollback React Hot Toast configuration:", error);
|
|
10701
10735
|
throw error;
|
|
10702
10736
|
}
|
|
10703
10737
|
}
|
|
@@ -10760,6 +10794,7 @@ export default App
|
|
|
10760
10794
|
|
|
10761
10795
|
// src/plugins/ui/react-hot-toast-nextjs.ts
|
|
10762
10796
|
import { join as join38 } from "path";
|
|
10797
|
+
var logger38 = getModuleLogger();
|
|
10763
10798
|
var reactHotToastNextjsPlugin = {
|
|
10764
10799
|
name: "react-hot-toast-nextjs",
|
|
10765
10800
|
displayName: "React Hot Toast (Next.js)",
|
|
@@ -10778,7 +10813,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10778
10813
|
*/
|
|
10779
10814
|
async install(ctx) {
|
|
10780
10815
|
if (this.detect?.(ctx)) {
|
|
10781
|
-
|
|
10816
|
+
logger38.info("React Hot Toast is already installed");
|
|
10782
10817
|
return {
|
|
10783
10818
|
packages: {},
|
|
10784
10819
|
success: true,
|
|
@@ -10794,7 +10829,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10794
10829
|
exact: false,
|
|
10795
10830
|
silent: false
|
|
10796
10831
|
});
|
|
10797
|
-
|
|
10832
|
+
logger38.info("Successfully installed React Hot Toast");
|
|
10798
10833
|
return {
|
|
10799
10834
|
packages: {
|
|
10800
10835
|
dependencies: packages
|
|
@@ -10803,7 +10838,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10803
10838
|
message: `Installed React Hot Toast: ${packages.join(", ")}`
|
|
10804
10839
|
};
|
|
10805
10840
|
} catch (error) {
|
|
10806
|
-
|
|
10841
|
+
logger38.error("Failed to install React Hot Toast:", error);
|
|
10807
10842
|
return {
|
|
10808
10843
|
packages: {},
|
|
10809
10844
|
success: false,
|
|
@@ -10881,9 +10916,9 @@ var reactHotToastNextjsPlugin = {
|
|
|
10881
10916
|
content: updatedContent,
|
|
10882
10917
|
backup: targetContent ? true : false
|
|
10883
10918
|
});
|
|
10884
|
-
|
|
10919
|
+
logger38.info(`Added Toaster to ${targetPath}`);
|
|
10885
10920
|
} else {
|
|
10886
|
-
|
|
10921
|
+
logger38.warn("Toaster already configured");
|
|
10887
10922
|
}
|
|
10888
10923
|
}
|
|
10889
10924
|
return {
|
|
@@ -10892,7 +10927,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10892
10927
|
message: "React Hot Toast configured successfully for Next.js"
|
|
10893
10928
|
};
|
|
10894
10929
|
} catch (error) {
|
|
10895
|
-
|
|
10930
|
+
logger38.error("Failed to configure React Hot Toast:", error);
|
|
10896
10931
|
await backupManager.restoreAll();
|
|
10897
10932
|
return {
|
|
10898
10933
|
files,
|
|
@@ -10908,9 +10943,9 @@ var reactHotToastNextjsPlugin = {
|
|
|
10908
10943
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
10909
10944
|
try {
|
|
10910
10945
|
await backupManager.restoreAll();
|
|
10911
|
-
|
|
10946
|
+
logger38.info("React Hot Toast configuration rolled back");
|
|
10912
10947
|
} catch (error) {
|
|
10913
|
-
|
|
10948
|
+
logger38.error("Failed to rollback React Hot Toast configuration:", error);
|
|
10914
10949
|
throw error;
|
|
10915
10950
|
}
|
|
10916
10951
|
}
|
|
@@ -11058,6 +11093,7 @@ export default function App({ Component, pageProps }) {
|
|
|
11058
11093
|
|
|
11059
11094
|
// src/plugins/ui/react-icons.ts
|
|
11060
11095
|
import { join as join39 } from "path";
|
|
11096
|
+
var logger39 = getModuleLogger();
|
|
11061
11097
|
var reactIconsPlugin = {
|
|
11062
11098
|
name: "react-icons",
|
|
11063
11099
|
displayName: "React Icons",
|
|
@@ -11076,7 +11112,7 @@ var reactIconsPlugin = {
|
|
|
11076
11112
|
*/
|
|
11077
11113
|
async install(ctx) {
|
|
11078
11114
|
if (this.detect?.(ctx)) {
|
|
11079
|
-
|
|
11115
|
+
logger39.info("React Icons is already installed");
|
|
11080
11116
|
return {
|
|
11081
11117
|
packages: {},
|
|
11082
11118
|
success: true,
|
|
@@ -11092,7 +11128,7 @@ var reactIconsPlugin = {
|
|
|
11092
11128
|
exact: false,
|
|
11093
11129
|
silent: false
|
|
11094
11130
|
});
|
|
11095
|
-
|
|
11131
|
+
logger39.info("Successfully installed React Icons");
|
|
11096
11132
|
return {
|
|
11097
11133
|
packages: {
|
|
11098
11134
|
dependencies: packages
|
|
@@ -11101,7 +11137,7 @@ var reactIconsPlugin = {
|
|
|
11101
11137
|
message: `Installed React Icons: ${packages.join(", ")}`
|
|
11102
11138
|
};
|
|
11103
11139
|
} catch (error) {
|
|
11104
|
-
|
|
11140
|
+
logger39.error("Failed to install React Icons:", error);
|
|
11105
11141
|
return {
|
|
11106
11142
|
packages: {},
|
|
11107
11143
|
success: false,
|
|
@@ -11119,8 +11155,7 @@ var reactIconsPlugin = {
|
|
|
11119
11155
|
* Documentation : https://react-icons.github.io/react-icons
|
|
11120
11156
|
*/
|
|
11121
11157
|
async configure(ctx) {
|
|
11122
|
-
const backupManager =
|
|
11123
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
11158
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
11124
11159
|
const files = [];
|
|
11125
11160
|
const srcDir = join39(ctx.projectRoot, ctx.srcDir);
|
|
11126
11161
|
try {
|
|
@@ -11138,7 +11173,7 @@ var reactIconsPlugin = {
|
|
|
11138
11173
|
content: iconExampleContent,
|
|
11139
11174
|
backup: false
|
|
11140
11175
|
});
|
|
11141
|
-
|
|
11176
|
+
logger39.info(`Created icon example: ${iconExamplePath}`);
|
|
11142
11177
|
const indexPath = join39(iconsDir, `index.${ctx.typescript ? "ts" : "js"}`);
|
|
11143
11178
|
const indexContent = ctx.typescript ? getIndexContentTS7() : getIndexContentJS7();
|
|
11144
11179
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -11148,14 +11183,14 @@ var reactIconsPlugin = {
|
|
|
11148
11183
|
content: indexContent,
|
|
11149
11184
|
backup: false
|
|
11150
11185
|
});
|
|
11151
|
-
|
|
11186
|
+
logger39.info(`Created icons index: ${indexPath}`);
|
|
11152
11187
|
return {
|
|
11153
11188
|
files,
|
|
11154
11189
|
success: true,
|
|
11155
11190
|
message: "React Icons configured successfully"
|
|
11156
11191
|
};
|
|
11157
11192
|
} catch (error) {
|
|
11158
|
-
|
|
11193
|
+
logger39.error("Failed to configure React Icons:", error);
|
|
11159
11194
|
await backupManager.restoreAll();
|
|
11160
11195
|
return {
|
|
11161
11196
|
files,
|
|
@@ -11168,12 +11203,12 @@ var reactIconsPlugin = {
|
|
|
11168
11203
|
* Rollback de la configuration React Icons
|
|
11169
11204
|
*/
|
|
11170
11205
|
async rollback(_ctx) {
|
|
11171
|
-
const backupManager =
|
|
11206
|
+
const backupManager = getRollbackManager(_ctx);
|
|
11172
11207
|
try {
|
|
11173
11208
|
await backupManager.restoreAll();
|
|
11174
|
-
|
|
11209
|
+
logger39.info("React Icons configuration rolled back");
|
|
11175
11210
|
} catch (error) {
|
|
11176
|
-
|
|
11211
|
+
logger39.error("Failed to rollback React Icons configuration:", error);
|
|
11177
11212
|
throw error;
|
|
11178
11213
|
}
|
|
11179
11214
|
}
|
|
@@ -11256,6 +11291,7 @@ export { MdHome, MdSettings, MdSearch } from 'react-icons/md'
|
|
|
11256
11291
|
|
|
11257
11292
|
// src/plugins/ui/shadcn-ui.ts
|
|
11258
11293
|
import { join as join40 } from "path";
|
|
11294
|
+
var logger40 = getModuleLogger();
|
|
11259
11295
|
var shadcnUiPlugin = {
|
|
11260
11296
|
name: "shadcn-ui",
|
|
11261
11297
|
displayName: "Shadcn/ui",
|
|
@@ -11280,7 +11316,7 @@ var shadcnUiPlugin = {
|
|
|
11280
11316
|
*/
|
|
11281
11317
|
async install(ctx) {
|
|
11282
11318
|
if (this.detect?.(ctx)) {
|
|
11283
|
-
|
|
11319
|
+
logger40.info("Shadcn/ui dependencies are already installed");
|
|
11284
11320
|
return {
|
|
11285
11321
|
packages: {},
|
|
11286
11322
|
success: true,
|
|
@@ -11310,7 +11346,7 @@ var shadcnUiPlugin = {
|
|
|
11310
11346
|
exact: false,
|
|
11311
11347
|
silent: false
|
|
11312
11348
|
});
|
|
11313
|
-
|
|
11349
|
+
logger40.info("Successfully installed Shadcn/ui dependencies");
|
|
11314
11350
|
return {
|
|
11315
11351
|
packages: {
|
|
11316
11352
|
dependencies: packages
|
|
@@ -11319,7 +11355,7 @@ var shadcnUiPlugin = {
|
|
|
11319
11355
|
message: `Installed Shadcn/ui dependencies: ${packages.join(", ")}`
|
|
11320
11356
|
};
|
|
11321
11357
|
} catch (error) {
|
|
11322
|
-
|
|
11358
|
+
logger40.error("Failed to install Shadcn/ui dependencies:", error);
|
|
11323
11359
|
return {
|
|
11324
11360
|
packages: {},
|
|
11325
11361
|
success: false,
|
|
@@ -11350,7 +11386,7 @@ var shadcnUiPlugin = {
|
|
|
11350
11386
|
ctx.fsAdapter
|
|
11351
11387
|
);
|
|
11352
11388
|
if (componentsJsonExists) {
|
|
11353
|
-
|
|
11389
|
+
logger40.warn("components.json already exists, skipping creation");
|
|
11354
11390
|
} else {
|
|
11355
11391
|
const componentsJsonContent = getComponentsJsonContent(ctx);
|
|
11356
11392
|
await writer.createFile(componentsJsonPath, componentsJsonContent);
|
|
@@ -11360,14 +11396,14 @@ var shadcnUiPlugin = {
|
|
|
11360
11396
|
content: componentsJsonContent,
|
|
11361
11397
|
backup: false
|
|
11362
11398
|
});
|
|
11363
|
-
|
|
11399
|
+
logger40.info(`Created components.json: ${componentsJsonPath}`);
|
|
11364
11400
|
}
|
|
11365
11401
|
const libDir = join40(srcDir, "lib");
|
|
11366
11402
|
await ensureDirectory(libDir, ctx.fsAdapter);
|
|
11367
11403
|
const utilsPath = join40(libDir, `utils.${ctx.typescript ? "ts" : "js"}`);
|
|
11368
11404
|
const utilsExists = await checkPathExists(utilsPath, ctx.fsAdapter);
|
|
11369
11405
|
if (utilsExists) {
|
|
11370
|
-
|
|
11406
|
+
logger40.warn(
|
|
11371
11407
|
"utils.ts already exists, checking if cn function is present"
|
|
11372
11408
|
);
|
|
11373
11409
|
const existingContent = await readFileContent(
|
|
@@ -11385,7 +11421,7 @@ var shadcnUiPlugin = {
|
|
|
11385
11421
|
content: updatedContent,
|
|
11386
11422
|
backup: true
|
|
11387
11423
|
});
|
|
11388
|
-
|
|
11424
|
+
logger40.info("Added cn function to utils.ts");
|
|
11389
11425
|
}
|
|
11390
11426
|
} else {
|
|
11391
11427
|
const utilsContent = ctx.typescript ? getUtilsContentTS() : getUtilsContentJS();
|
|
@@ -11396,7 +11432,7 @@ var shadcnUiPlugin = {
|
|
|
11396
11432
|
content: utilsContent,
|
|
11397
11433
|
backup: false
|
|
11398
11434
|
});
|
|
11399
|
-
|
|
11435
|
+
logger40.info(`Created utils file: ${utilsPath}`);
|
|
11400
11436
|
}
|
|
11401
11437
|
const uiDir = join40(srcDir, "components", "ui");
|
|
11402
11438
|
await ensureDirectory(uiDir, ctx.fsAdapter);
|
|
@@ -11411,7 +11447,7 @@ var shadcnUiPlugin = {
|
|
|
11411
11447
|
content: buttonContent,
|
|
11412
11448
|
backup: false
|
|
11413
11449
|
});
|
|
11414
|
-
|
|
11450
|
+
logger40.info(`Created Button component: ${buttonPath}`);
|
|
11415
11451
|
}
|
|
11416
11452
|
const cssPath = join40(srcDir, "index.css");
|
|
11417
11453
|
const cssExists = await checkPathExists(cssPath, ctx.fsAdapter);
|
|
@@ -11431,7 +11467,7 @@ var shadcnUiPlugin = {
|
|
|
11431
11467
|
content: updatedCss,
|
|
11432
11468
|
backup: true
|
|
11433
11469
|
});
|
|
11434
|
-
|
|
11470
|
+
logger40.info("Added Shadcn/ui CSS variables to index.css");
|
|
11435
11471
|
}
|
|
11436
11472
|
}
|
|
11437
11473
|
return {
|
|
@@ -11440,7 +11476,7 @@ var shadcnUiPlugin = {
|
|
|
11440
11476
|
message: "Shadcn/ui configured successfully"
|
|
11441
11477
|
};
|
|
11442
11478
|
} catch (error) {
|
|
11443
|
-
|
|
11479
|
+
logger40.error("Failed to configure Shadcn/ui:", error);
|
|
11444
11480
|
await backupManager.restoreAll();
|
|
11445
11481
|
return {
|
|
11446
11482
|
files,
|
|
@@ -11456,9 +11492,9 @@ var shadcnUiPlugin = {
|
|
|
11456
11492
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
11457
11493
|
try {
|
|
11458
11494
|
await backupManager.restoreAll();
|
|
11459
|
-
|
|
11495
|
+
logger40.info("Shadcn/ui configuration rolled back");
|
|
11460
11496
|
} catch (error) {
|
|
11461
|
-
|
|
11497
|
+
logger40.error("Failed to rollback Shadcn/ui configuration:", error);
|
|
11462
11498
|
throw error;
|
|
11463
11499
|
}
|
|
11464
11500
|
}
|
|
@@ -11728,6 +11764,7 @@ function getShadcnCSSVariables() {
|
|
|
11728
11764
|
|
|
11729
11765
|
// src/plugins/ui/shadcn-ui-nextjs.ts
|
|
11730
11766
|
import { join as join41 } from "path";
|
|
11767
|
+
var logger41 = getModuleLogger();
|
|
11731
11768
|
var shadcnUiNextjsPlugin = {
|
|
11732
11769
|
name: "shadcn-ui-nextjs",
|
|
11733
11770
|
displayName: "Shadcn/ui (Next.js)",
|
|
@@ -11747,7 +11784,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11747
11784
|
*/
|
|
11748
11785
|
async install(ctx) {
|
|
11749
11786
|
if (this.detect?.(ctx)) {
|
|
11750
|
-
|
|
11787
|
+
logger41.info("Shadcn/ui dependencies are already installed");
|
|
11751
11788
|
return {
|
|
11752
11789
|
packages: {},
|
|
11753
11790
|
success: true,
|
|
@@ -11777,7 +11814,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11777
11814
|
exact: false,
|
|
11778
11815
|
silent: false
|
|
11779
11816
|
});
|
|
11780
|
-
|
|
11817
|
+
logger41.info("Successfully installed Shadcn/ui dependencies");
|
|
11781
11818
|
return {
|
|
11782
11819
|
packages: {
|
|
11783
11820
|
dependencies: packages
|
|
@@ -11786,7 +11823,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11786
11823
|
message: `Installed Shadcn/ui dependencies: ${packages.join(", ")}`
|
|
11787
11824
|
};
|
|
11788
11825
|
} catch (error) {
|
|
11789
|
-
|
|
11826
|
+
logger41.error("Failed to install Shadcn/ui dependencies:", error);
|
|
11790
11827
|
return {
|
|
11791
11828
|
packages: {},
|
|
11792
11829
|
success: false,
|
|
@@ -11816,7 +11853,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11816
11853
|
ctx.fsAdapter
|
|
11817
11854
|
);
|
|
11818
11855
|
if (componentsJsonExists) {
|
|
11819
|
-
|
|
11856
|
+
logger41.warn("components.json already exists, skipping creation");
|
|
11820
11857
|
} else {
|
|
11821
11858
|
const componentsJsonContent = getComponentsJsonContentNextjs(ctx);
|
|
11822
11859
|
await writer.createFile(componentsJsonPath, componentsJsonContent);
|
|
@@ -11826,14 +11863,14 @@ var shadcnUiNextjsPlugin = {
|
|
|
11826
11863
|
content: componentsJsonContent,
|
|
11827
11864
|
backup: false
|
|
11828
11865
|
});
|
|
11829
|
-
|
|
11866
|
+
logger41.info(`Created components.json: ${componentsJsonPath}`);
|
|
11830
11867
|
}
|
|
11831
11868
|
const libDir = join41(baseDir, "lib");
|
|
11832
11869
|
await ensureDirectory(libDir, ctx.fsAdapter);
|
|
11833
11870
|
const utilsPath = join41(libDir, `utils.${ctx.typescript ? "ts" : "js"}`);
|
|
11834
11871
|
const utilsExists = await checkPathExists(utilsPath, ctx.fsAdapter);
|
|
11835
11872
|
if (utilsExists) {
|
|
11836
|
-
|
|
11873
|
+
logger41.warn(
|
|
11837
11874
|
"utils.ts already exists, checking if cn function is present"
|
|
11838
11875
|
);
|
|
11839
11876
|
const existingContent = await readFileContent(
|
|
@@ -11851,7 +11888,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11851
11888
|
content: updatedContent,
|
|
11852
11889
|
backup: true
|
|
11853
11890
|
});
|
|
11854
|
-
|
|
11891
|
+
logger41.info("Added cn function to utils.ts");
|
|
11855
11892
|
}
|
|
11856
11893
|
} else {
|
|
11857
11894
|
const utilsContent = ctx.typescript ? getUtilsContentTS2() : getUtilsContentJS2();
|
|
@@ -11862,7 +11899,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11862
11899
|
content: utilsContent,
|
|
11863
11900
|
backup: false
|
|
11864
11901
|
});
|
|
11865
|
-
|
|
11902
|
+
logger41.info(`Created utils file: ${utilsPath}`);
|
|
11866
11903
|
}
|
|
11867
11904
|
const uiDir = join41(baseDir, "components", "ui");
|
|
11868
11905
|
await ensureDirectory(uiDir, ctx.fsAdapter);
|
|
@@ -11877,7 +11914,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11877
11914
|
content: buttonContent,
|
|
11878
11915
|
backup: false
|
|
11879
11916
|
});
|
|
11880
|
-
|
|
11917
|
+
logger41.info(`Created Button component: ${buttonPath}`);
|
|
11881
11918
|
}
|
|
11882
11919
|
const cssFiles = [
|
|
11883
11920
|
join41(projectRoot, "app", "globals.css"),
|
|
@@ -11903,7 +11940,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11903
11940
|
content: updatedCss,
|
|
11904
11941
|
backup: true
|
|
11905
11942
|
});
|
|
11906
|
-
|
|
11943
|
+
logger41.info(`Added Shadcn/ui CSS variables to ${cssPath}`);
|
|
11907
11944
|
}
|
|
11908
11945
|
break;
|
|
11909
11946
|
}
|
|
@@ -11914,7 +11951,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11914
11951
|
message: "Shadcn/ui configured successfully for Next.js"
|
|
11915
11952
|
};
|
|
11916
11953
|
} catch (error) {
|
|
11917
|
-
|
|
11954
|
+
logger41.error("Failed to configure Shadcn/ui:", error);
|
|
11918
11955
|
return {
|
|
11919
11956
|
files,
|
|
11920
11957
|
success: false,
|
|
@@ -11929,9 +11966,9 @@ var shadcnUiNextjsPlugin = {
|
|
|
11929
11966
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
11930
11967
|
try {
|
|
11931
11968
|
await backupManager.restoreAll();
|
|
11932
|
-
|
|
11969
|
+
logger41.info("Shadcn/ui configuration rolled back");
|
|
11933
11970
|
} catch (error) {
|
|
11934
|
-
|
|
11971
|
+
logger41.error("Failed to rollback Shadcn/ui configuration:", error);
|
|
11935
11972
|
throw error;
|
|
11936
11973
|
}
|
|
11937
11974
|
}
|
|
@@ -12203,6 +12240,7 @@ function getShadcnCSSVariables2() {
|
|
|
12203
12240
|
|
|
12204
12241
|
// src/plugins/ui/vuetify.ts
|
|
12205
12242
|
import { join as join42 } from "path";
|
|
12243
|
+
var logger42 = getModuleLogger();
|
|
12206
12244
|
var vuetifyPlugin = {
|
|
12207
12245
|
name: "vuetify",
|
|
12208
12246
|
displayName: "Vuetify",
|
|
@@ -12221,7 +12259,7 @@ var vuetifyPlugin = {
|
|
|
12221
12259
|
*/
|
|
12222
12260
|
async install(ctx) {
|
|
12223
12261
|
if (this.detect?.(ctx)) {
|
|
12224
|
-
|
|
12262
|
+
logger42.info("Vuetify is already installed");
|
|
12225
12263
|
return {
|
|
12226
12264
|
packages: {},
|
|
12227
12265
|
success: true,
|
|
@@ -12262,7 +12300,7 @@ var vuetifyPlugin = {
|
|
|
12262
12300
|
silent: false
|
|
12263
12301
|
});
|
|
12264
12302
|
}
|
|
12265
|
-
|
|
12303
|
+
logger42.info("Successfully installed Vuetify");
|
|
12266
12304
|
return {
|
|
12267
12305
|
packages: {
|
|
12268
12306
|
dependencies: packages,
|
|
@@ -12272,7 +12310,7 @@ var vuetifyPlugin = {
|
|
|
12272
12310
|
message: `Installed ${packages.concat(devPackages).join(", ")}`
|
|
12273
12311
|
};
|
|
12274
12312
|
} catch (error) {
|
|
12275
|
-
|
|
12313
|
+
logger42.error("Failed to install Vuetify:", error);
|
|
12276
12314
|
return {
|
|
12277
12315
|
packages: {},
|
|
12278
12316
|
success: false,
|
|
@@ -12306,7 +12344,7 @@ var vuetifyPlugin = {
|
|
|
12306
12344
|
content: vuetifyConfigContent,
|
|
12307
12345
|
backup: false
|
|
12308
12346
|
});
|
|
12309
|
-
|
|
12347
|
+
logger42.info(`Created Vuetify config: ${vuetifyConfigPath}`);
|
|
12310
12348
|
const componentsDir = join42(ctx.projectRoot, ctx.srcDir, "components");
|
|
12311
12349
|
await ensureDirectory(componentsDir, ctx.fsAdapter);
|
|
12312
12350
|
const componentPath = join42(componentsDir, "HelloVuetify.vue");
|
|
@@ -12318,7 +12356,7 @@ var vuetifyPlugin = {
|
|
|
12318
12356
|
content: componentContent,
|
|
12319
12357
|
backup: false
|
|
12320
12358
|
});
|
|
12321
|
-
|
|
12359
|
+
logger42.info(`Created example component: ${componentPath}`);
|
|
12322
12360
|
const mainPath = join42(ctx.projectRoot, ctx.srcDir, `main.${extension}`);
|
|
12323
12361
|
const mainExists = await checkPathExists(mainPath, ctx.fsAdapter);
|
|
12324
12362
|
if (mainExists) {
|
|
@@ -12334,7 +12372,7 @@ var vuetifyPlugin = {
|
|
|
12334
12372
|
path: normalizePath(mainPath),
|
|
12335
12373
|
backup: true
|
|
12336
12374
|
});
|
|
12337
|
-
|
|
12375
|
+
logger42.info(`Updated ${mainPath} to import Vuetify`);
|
|
12338
12376
|
}
|
|
12339
12377
|
const viteConfigPath = join42(ctx.projectRoot, `vite.config.${extension}`);
|
|
12340
12378
|
const viteConfigExists = await checkPathExists(
|
|
@@ -12356,7 +12394,7 @@ var vuetifyPlugin = {
|
|
|
12356
12394
|
path: normalizePath(viteConfigPath),
|
|
12357
12395
|
backup: true
|
|
12358
12396
|
});
|
|
12359
|
-
|
|
12397
|
+
logger42.info(`Updated ${viteConfigPath} to include Vuetify plugin`);
|
|
12360
12398
|
}
|
|
12361
12399
|
return {
|
|
12362
12400
|
files,
|
|
@@ -12364,7 +12402,7 @@ var vuetifyPlugin = {
|
|
|
12364
12402
|
message: "Vuetify configured successfully"
|
|
12365
12403
|
};
|
|
12366
12404
|
} catch (error) {
|
|
12367
|
-
|
|
12405
|
+
logger42.error("Failed to configure Vuetify:", error);
|
|
12368
12406
|
return {
|
|
12369
12407
|
files,
|
|
12370
12408
|
success: false,
|
|
@@ -12378,7 +12416,7 @@ var vuetifyPlugin = {
|
|
|
12378
12416
|
async rollback(_ctx) {
|
|
12379
12417
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
12380
12418
|
await backupManager.restoreAll();
|
|
12381
|
-
|
|
12419
|
+
logger42.info("Vuetify configuration rolled back");
|
|
12382
12420
|
}
|
|
12383
12421
|
};
|
|
12384
12422
|
function getVuetifyConfig(typescript) {
|
|
@@ -12554,6 +12592,7 @@ function updateViteConfig(content) {
|
|
|
12554
12592
|
|
|
12555
12593
|
// src/plugins/utils/date-fns.ts
|
|
12556
12594
|
import { join as join43 } from "path";
|
|
12595
|
+
var logger43 = getModuleLogger();
|
|
12557
12596
|
var dateFnsPlugin = {
|
|
12558
12597
|
name: "date-fns",
|
|
12559
12598
|
displayName: "date-fns",
|
|
@@ -12572,7 +12611,7 @@ var dateFnsPlugin = {
|
|
|
12572
12611
|
*/
|
|
12573
12612
|
async install(ctx) {
|
|
12574
12613
|
if (this.detect?.(ctx)) {
|
|
12575
|
-
|
|
12614
|
+
logger43.info("date-fns is already installed");
|
|
12576
12615
|
return {
|
|
12577
12616
|
packages: {},
|
|
12578
12617
|
success: true,
|
|
@@ -12588,7 +12627,7 @@ var dateFnsPlugin = {
|
|
|
12588
12627
|
exact: false,
|
|
12589
12628
|
silent: false
|
|
12590
12629
|
});
|
|
12591
|
-
|
|
12630
|
+
logger43.info("Successfully installed date-fns");
|
|
12592
12631
|
return {
|
|
12593
12632
|
packages: {
|
|
12594
12633
|
dependencies: packages
|
|
@@ -12597,7 +12636,7 @@ var dateFnsPlugin = {
|
|
|
12597
12636
|
message: `Installed date-fns: ${packages.join(", ")}`
|
|
12598
12637
|
};
|
|
12599
12638
|
} catch (error) {
|
|
12600
|
-
|
|
12639
|
+
logger43.error("Failed to install date-fns:", error);
|
|
12601
12640
|
return {
|
|
12602
12641
|
packages: {},
|
|
12603
12642
|
success: false,
|
|
@@ -12614,8 +12653,7 @@ var dateFnsPlugin = {
|
|
|
12614
12653
|
* Documentation : https://date-fns.org
|
|
12615
12654
|
*/
|
|
12616
12655
|
async configure(ctx) {
|
|
12617
|
-
const backupManager =
|
|
12618
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
12656
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
12619
12657
|
const files = [];
|
|
12620
12658
|
const srcDir = join43(ctx.projectRoot, ctx.srcDir);
|
|
12621
12659
|
try {
|
|
@@ -12633,14 +12671,14 @@ var dateFnsPlugin = {
|
|
|
12633
12671
|
content: dateUtilsContent,
|
|
12634
12672
|
backup: false
|
|
12635
12673
|
});
|
|
12636
|
-
|
|
12674
|
+
logger43.info(`Created date utilities: ${dateUtilsPath}`);
|
|
12637
12675
|
return {
|
|
12638
12676
|
files,
|
|
12639
12677
|
success: true,
|
|
12640
12678
|
message: "date-fns configured successfully"
|
|
12641
12679
|
};
|
|
12642
12680
|
} catch (error) {
|
|
12643
|
-
|
|
12681
|
+
logger43.error("Failed to configure date-fns:", error);
|
|
12644
12682
|
await backupManager.restoreAll();
|
|
12645
12683
|
return {
|
|
12646
12684
|
files,
|
|
@@ -12653,12 +12691,12 @@ var dateFnsPlugin = {
|
|
|
12653
12691
|
* Rollback de la configuration date-fns
|
|
12654
12692
|
*/
|
|
12655
12693
|
async rollback(_ctx) {
|
|
12656
|
-
const backupManager =
|
|
12694
|
+
const backupManager = getRollbackManager(_ctx);
|
|
12657
12695
|
try {
|
|
12658
12696
|
await backupManager.restoreAll();
|
|
12659
|
-
|
|
12697
|
+
logger43.info("date-fns configuration rolled back");
|
|
12660
12698
|
} catch (error) {
|
|
12661
|
-
|
|
12699
|
+
logger43.error("Failed to rollback date-fns configuration:", error);
|
|
12662
12700
|
throw error;
|
|
12663
12701
|
}
|
|
12664
12702
|
}
|
|
@@ -12769,6 +12807,8 @@ function getDateUtilsContentJS() {
|
|
|
12769
12807
|
} from 'date-fns'
|
|
12770
12808
|
import { fr } from 'date-fns/locale'
|
|
12771
12809
|
|
|
12810
|
+
const logger = getModuleLogger()
|
|
12811
|
+
|
|
12772
12812
|
/**
|
|
12773
12813
|
* Utilitaires de manipulation de dates avec date-fns
|
|
12774
12814
|
*
|
|
@@ -12838,6 +12878,7 @@ export function getMinutesDifference(date1, date2) {
|
|
|
12838
12878
|
|
|
12839
12879
|
// src/plugins/utils/vueuse.ts
|
|
12840
12880
|
import { resolve as resolve17, join as join44 } from "path";
|
|
12881
|
+
var logger44 = getModuleLogger();
|
|
12841
12882
|
var vueusePlugin = {
|
|
12842
12883
|
name: "@vueuse/core",
|
|
12843
12884
|
displayName: "VueUse",
|
|
@@ -12856,7 +12897,7 @@ var vueusePlugin = {
|
|
|
12856
12897
|
*/
|
|
12857
12898
|
async install(ctx) {
|
|
12858
12899
|
if (this.detect?.(ctx)) {
|
|
12859
|
-
|
|
12900
|
+
logger44.info("VueUse is already installed");
|
|
12860
12901
|
return {
|
|
12861
12902
|
packages: {},
|
|
12862
12903
|
success: true,
|
|
@@ -12872,7 +12913,7 @@ var vueusePlugin = {
|
|
|
12872
12913
|
exact: false,
|
|
12873
12914
|
silent: false
|
|
12874
12915
|
});
|
|
12875
|
-
|
|
12916
|
+
logger44.info("Successfully installed VueUse");
|
|
12876
12917
|
return {
|
|
12877
12918
|
packages: {
|
|
12878
12919
|
dependencies: packages
|
|
@@ -12881,7 +12922,7 @@ var vueusePlugin = {
|
|
|
12881
12922
|
message: `Installed ${packages.join(", ")}`
|
|
12882
12923
|
};
|
|
12883
12924
|
} catch (error) {
|
|
12884
|
-
|
|
12925
|
+
logger44.error("Failed to install VueUse:", error);
|
|
12885
12926
|
return {
|
|
12886
12927
|
packages: {},
|
|
12887
12928
|
success: false,
|
|
@@ -12896,8 +12937,7 @@ var vueusePlugin = {
|
|
|
12896
12937
|
* - src/composables/useExample.ts (ou .js) : Exemple d'utilisation
|
|
12897
12938
|
*/
|
|
12898
12939
|
async configure(ctx) {
|
|
12899
|
-
const
|
|
12900
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
12940
|
+
const { writer } = getPluginServices(ctx);
|
|
12901
12941
|
const files = [];
|
|
12902
12942
|
const srcDir = resolve17(ctx.projectRoot, ctx.srcDir);
|
|
12903
12943
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -12913,14 +12953,14 @@ var vueusePlugin = {
|
|
|
12913
12953
|
content: exampleContent,
|
|
12914
12954
|
backup: false
|
|
12915
12955
|
});
|
|
12916
|
-
|
|
12956
|
+
logger44.info(`Created VueUse example: ${examplePath}`);
|
|
12917
12957
|
return {
|
|
12918
12958
|
files,
|
|
12919
12959
|
success: true,
|
|
12920
12960
|
message: "VueUse configured successfully"
|
|
12921
12961
|
};
|
|
12922
12962
|
} catch (error) {
|
|
12923
|
-
|
|
12963
|
+
logger44.error("Failed to configure VueUse:", error);
|
|
12924
12964
|
return {
|
|
12925
12965
|
files,
|
|
12926
12966
|
success: false,
|
|
@@ -12932,9 +12972,9 @@ var vueusePlugin = {
|
|
|
12932
12972
|
* Rollback de la configuration VueUse
|
|
12933
12973
|
*/
|
|
12934
12974
|
async rollback(_ctx) {
|
|
12935
|
-
const backupManager =
|
|
12975
|
+
const backupManager = getRollbackManager(_ctx);
|
|
12936
12976
|
await backupManager.restoreAll();
|
|
12937
|
-
|
|
12977
|
+
logger44.info("VueUse configuration rolled back");
|
|
12938
12978
|
}
|
|
12939
12979
|
};
|
|
12940
12980
|
function getExampleContentTS2() {
|
|
@@ -12969,6 +13009,8 @@ function getExampleContentJS2() {
|
|
|
12969
13009
|
return `import { computed } from 'vue'
|
|
12970
13010
|
import { useMouse, useCounter } from '@vueuse/core'
|
|
12971
13011
|
|
|
13012
|
+
const logger = getModuleLogger()
|
|
13013
|
+
|
|
12972
13014
|
/**
|
|
12973
13015
|
* Exemple de composable utilisant VueUse
|
|
12974
13016
|
*/
|
|
@@ -12995,6 +13037,7 @@ export function useExample() {
|
|
|
12995
13037
|
}
|
|
12996
13038
|
|
|
12997
13039
|
// src/plugins/registry.ts
|
|
13040
|
+
var logger45 = getModuleLogger();
|
|
12998
13041
|
var pluginRegistry = [
|
|
12999
13042
|
// ANIMATION
|
|
13000
13043
|
framerMotionPlugin,
|
|
@@ -13064,14 +13107,14 @@ function validatePlugin(plugin) {
|
|
|
13064
13107
|
];
|
|
13065
13108
|
for (const field of requiredFields) {
|
|
13066
13109
|
if (!(field in plugin) || plugin[field] === void 0) {
|
|
13067
|
-
|
|
13110
|
+
logger45.error(`Plugin validation failed: missing field '${field}'`, {
|
|
13068
13111
|
plugin: plugin.name
|
|
13069
13112
|
});
|
|
13070
13113
|
return false;
|
|
13071
13114
|
}
|
|
13072
13115
|
}
|
|
13073
13116
|
if (!Object.values(Category).includes(plugin.category)) {
|
|
13074
|
-
|
|
13117
|
+
logger45.error(
|
|
13075
13118
|
`Plugin validation failed: invalid category '${plugin.category}'`,
|
|
13076
13119
|
{
|
|
13077
13120
|
plugin: plugin.name
|
|
@@ -13080,7 +13123,7 @@ function validatePlugin(plugin) {
|
|
|
13080
13123
|
return false;
|
|
13081
13124
|
}
|
|
13082
13125
|
if (!Array.isArray(plugin.frameworks) || plugin.frameworks.length === 0) {
|
|
13083
|
-
|
|
13126
|
+
logger45.error(
|
|
13084
13127
|
`Plugin validation failed: 'frameworks' must be a non-empty array`,
|
|
13085
13128
|
{
|
|
13086
13129
|
plugin: plugin.name
|
|
@@ -13089,13 +13132,13 @@ function validatePlugin(plugin) {
|
|
|
13089
13132
|
return false;
|
|
13090
13133
|
}
|
|
13091
13134
|
if (typeof plugin.install !== "function") {
|
|
13092
|
-
|
|
13135
|
+
logger45.error(`Plugin validation failed: 'install' must be a function`, {
|
|
13093
13136
|
plugin: plugin.name
|
|
13094
13137
|
});
|
|
13095
13138
|
return false;
|
|
13096
13139
|
}
|
|
13097
13140
|
if (typeof plugin.configure !== "function") {
|
|
13098
|
-
|
|
13141
|
+
logger45.error(`Plugin validation failed: 'configure' must be a function`, {
|
|
13099
13142
|
plugin: plugin.name
|
|
13100
13143
|
});
|
|
13101
13144
|
return false;
|
|
@@ -13113,7 +13156,7 @@ function validateRegistry(plugins) {
|
|
|
13113
13156
|
}
|
|
13114
13157
|
}
|
|
13115
13158
|
if (invalidPlugins.length > 0) {
|
|
13116
|
-
|
|
13159
|
+
logger45.warn(`Some plugins failed validation and were excluded:`, {
|
|
13117
13160
|
invalidPlugins,
|
|
13118
13161
|
total: plugins.length,
|
|
13119
13162
|
valid: validPlugins.length
|
|
@@ -13127,10 +13170,38 @@ function getValidatedRegistry() {
|
|
|
13127
13170
|
function getPluginsByCategory(category) {
|
|
13128
13171
|
return getValidatedRegistry().filter((p) => p.category === category);
|
|
13129
13172
|
}
|
|
13173
|
+
function getCompatiblePlugins(ctx) {
|
|
13174
|
+
return getValidatedRegistry().filter((plugin) => {
|
|
13175
|
+
if (!plugin.frameworks.includes(ctx.framework)) {
|
|
13176
|
+
return false;
|
|
13177
|
+
}
|
|
13178
|
+
if (plugin.requiresTypeScript === true && !ctx.typescript) {
|
|
13179
|
+
return false;
|
|
13180
|
+
}
|
|
13181
|
+
if (plugin.bundlers && plugin.bundlers.length > 0) {
|
|
13182
|
+
if (ctx.bundler === null || !plugin.bundlers.includes(ctx.bundler)) {
|
|
13183
|
+
return false;
|
|
13184
|
+
}
|
|
13185
|
+
}
|
|
13186
|
+
return true;
|
|
13187
|
+
});
|
|
13188
|
+
}
|
|
13189
|
+
function getRecommendedPlugins(ctx) {
|
|
13190
|
+
const compatible = getCompatiblePlugins(ctx);
|
|
13191
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
13192
|
+
for (const plugin of compatible) {
|
|
13193
|
+
const category = plugin.category;
|
|
13194
|
+
if (!categoryMap.has(category)) {
|
|
13195
|
+
categoryMap.set(category, plugin);
|
|
13196
|
+
}
|
|
13197
|
+
}
|
|
13198
|
+
return Array.from(categoryMap.values());
|
|
13199
|
+
}
|
|
13130
13200
|
|
|
13131
13201
|
export {
|
|
13132
|
-
ConfigWriter,
|
|
13133
13202
|
BackupManager,
|
|
13203
|
+
ConfigWriter,
|
|
13134
13204
|
pluginRegistry,
|
|
13135
|
-
getPluginsByCategory
|
|
13205
|
+
getPluginsByCategory,
|
|
13206
|
+
getRecommendedPlugins
|
|
13136
13207
|
};
|