@configjs/cli 1.1.8 → 1.1.10
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 +37 -10
- package/README.md +43 -10
- package/dist/{check-KHMCB7NK.js → check-PEWUERVP.js} +5 -4
- package/dist/{remove-JBICRDXX.js → chunk-2HZGGA67.js} +81 -60
- package/dist/{chunk-QBMH2K7B.js → chunk-3WLFBAII.js} +57 -0
- package/dist/{chunk-MQV3WNMH.js → chunk-6GV4NKUX.js} +11 -3
- package/dist/{chunk-HM2JWJOO.js → chunk-FIB2J36N.js} +4 -81
- package/dist/{chunk-YQVYFXOD.js → chunk-O2IJKLMT.js} +7 -5
- package/dist/chunk-QPEUT7QG.js +157 -0
- package/dist/{chunk-TVZWTKJU.js → chunk-WHV4KF4U.js} +28 -18
- package/dist/{chunk-AMBG3TCE.js → chunk-YGVZUNHO.js} +161 -135
- package/dist/{chunk-4N3JFZLA.js → chunk-ZAGZRB7Y.js} +1091 -728
- package/dist/cli.js +24 -8
- package/dist/{installed-WA6I2IFD.js → installed-LZE6LH7A.js} +4 -3
- package/dist/{list-ICEIQD7X.js → list-3M2L5RYT.js} +4 -3
- package/dist/{nextjs-command-SGU7KCFM.js → nextjs-command-2ORBUDBG.js} +8 -7
- package/dist/{nextjs-installer-5C3VBCZE.js → nextjs-installer-TQTRTWTQ.js} +5 -3
- package/dist/{nextjs-setup-YYXNONJ6.js → nextjs-setup-I5JJ43KS.js} +1 -1
- package/dist/{react-command-AXYWRMBH.js → react-command-O76RU4RP.js} +8 -7
- package/dist/remove-JCK32XHZ.js +75 -0
- package/dist/svelte-command-VR5P46UM.js +72 -0
- package/dist/svelte-installer-HWNNV2YK.js +65 -0
- package/dist/svelte-setup-2IJCXART.js +38 -0
- package/dist/{vite-installer-OPE53M3C.js → vite-installer-PPES2JQY.js} +5 -3
- package/dist/{vite-setup-B5TXMX72.js → vite-setup-GOJ73AYC.js} +1 -1
- package/dist/{vue-command-SLT6ILZT.js → vue-command-6LUSYL5X.js} +8 -7
- package/dist/{vue-installer-LWQQCYOP.js → vue-installer-XTKXJNTQ.js} +5 -3
- package/dist/{vue-setup-JLZVVRSJ.js → vue-setup-3QAOL6JM.js} +1 -1
- 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",
|
|
@@ -555,9 +570,8 @@ var framerMotionPlugin = {
|
|
|
555
570
|
*
|
|
556
571
|
* Documentation : https://www.framer.com/motion
|
|
557
572
|
*/
|
|
558
|
-
async configure(ctx) {
|
|
559
|
-
const backupManager =
|
|
560
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
573
|
+
async configure(ctx) {
|
|
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
|
*/
|
|
@@ -2921,8 +2938,78 @@ function getIndexContentJS4() {
|
|
|
2921
2938
|
`;
|
|
2922
2939
|
}
|
|
2923
2940
|
|
|
2941
|
+
// src/plugins/forms/svelte-superforms.ts
|
|
2942
|
+
var logger9 = getModuleLogger();
|
|
2943
|
+
var svelteFormsPlugin = {
|
|
2944
|
+
name: "sveltekit-superforms",
|
|
2945
|
+
displayName: "SvelteKit Superforms",
|
|
2946
|
+
description: "Gestion des formulaires avec validation c\xF4t\xE9 serveur et client",
|
|
2947
|
+
category: "forms" /* FORMS */,
|
|
2948
|
+
version: "^2.17.0",
|
|
2949
|
+
frameworks: ["svelte"],
|
|
2950
|
+
detect: (ctx) => {
|
|
2951
|
+
return ctx.dependencies["sveltekit-superforms"] !== void 0;
|
|
2952
|
+
},
|
|
2953
|
+
async install(ctx) {
|
|
2954
|
+
if (this.detect?.(ctx)) {
|
|
2955
|
+
logger9.info("SvelteKit Superforms is already installed");
|
|
2956
|
+
return {
|
|
2957
|
+
packages: {},
|
|
2958
|
+
success: true,
|
|
2959
|
+
message: "SvelteKit Superforms already installed"
|
|
2960
|
+
};
|
|
2961
|
+
}
|
|
2962
|
+
try {
|
|
2963
|
+
const packages = ["sveltekit-superforms"];
|
|
2964
|
+
await installPackages(packages, {
|
|
2965
|
+
dev: false,
|
|
2966
|
+
packageManager: ctx.packageManager,
|
|
2967
|
+
projectRoot: ctx.projectRoot,
|
|
2968
|
+
exact: false,
|
|
2969
|
+
silent: false
|
|
2970
|
+
});
|
|
2971
|
+
logger9.info(`Installed ${packages.length} package(s)`);
|
|
2972
|
+
return {
|
|
2973
|
+
packages: {
|
|
2974
|
+
dependencies: packages
|
|
2975
|
+
},
|
|
2976
|
+
success: true,
|
|
2977
|
+
message: "SvelteKit Superforms installed successfully"
|
|
2978
|
+
};
|
|
2979
|
+
} catch (error) {
|
|
2980
|
+
logger9.error(`Failed to install SvelteKit Superforms: ${String(error)}`);
|
|
2981
|
+
return {
|
|
2982
|
+
packages: {},
|
|
2983
|
+
success: false,
|
|
2984
|
+
message: `Installation failed: ${String(error)}`
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
},
|
|
2988
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2989
|
+
async configure(_ctx) {
|
|
2990
|
+
try {
|
|
2991
|
+
logger9.info(
|
|
2992
|
+
"SvelteKit Superforms is ready to use, import from sveltekit-superforms"
|
|
2993
|
+
);
|
|
2994
|
+
return {
|
|
2995
|
+
success: true,
|
|
2996
|
+
message: "SvelteKit Superforms configured successfully",
|
|
2997
|
+
files: []
|
|
2998
|
+
};
|
|
2999
|
+
} catch (error) {
|
|
3000
|
+
logger9.error(`Configuration failed: ${String(error)}`);
|
|
3001
|
+
return {
|
|
3002
|
+
success: false,
|
|
3003
|
+
message: `Configuration failed: ${String(error)}`,
|
|
3004
|
+
files: []
|
|
3005
|
+
};
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
};
|
|
3009
|
+
|
|
2924
3010
|
// src/plugins/http/axios.ts
|
|
2925
3011
|
import { resolve as resolve8, join as join9 } from "path";
|
|
3012
|
+
var logger10 = getModuleLogger();
|
|
2926
3013
|
var axiosPlugin = {
|
|
2927
3014
|
name: "axios",
|
|
2928
3015
|
displayName: "Axios",
|
|
@@ -2941,7 +3028,7 @@ var axiosPlugin = {
|
|
|
2941
3028
|
*/
|
|
2942
3029
|
async install(ctx) {
|
|
2943
3030
|
if (this.detect?.(ctx)) {
|
|
2944
|
-
|
|
3031
|
+
logger10.info("Axios is already installed");
|
|
2945
3032
|
return {
|
|
2946
3033
|
packages: {},
|
|
2947
3034
|
success: true,
|
|
@@ -2957,7 +3044,7 @@ var axiosPlugin = {
|
|
|
2957
3044
|
exact: false,
|
|
2958
3045
|
silent: false
|
|
2959
3046
|
});
|
|
2960
|
-
|
|
3047
|
+
logger10.info("Successfully installed Axios");
|
|
2961
3048
|
return {
|
|
2962
3049
|
packages: {
|
|
2963
3050
|
dependencies: packages
|
|
@@ -2966,7 +3053,7 @@ var axiosPlugin = {
|
|
|
2966
3053
|
message: `Installed ${packages.join(", ")}`
|
|
2967
3054
|
};
|
|
2968
3055
|
} catch (error) {
|
|
2969
|
-
|
|
3056
|
+
logger10.error("Failed to install Axios:", error);
|
|
2970
3057
|
return {
|
|
2971
3058
|
packages: {},
|
|
2972
3059
|
success: false,
|
|
@@ -2984,8 +3071,7 @@ var axiosPlugin = {
|
|
|
2984
3071
|
* Documentation : https://axios-http.com
|
|
2985
3072
|
*/
|
|
2986
3073
|
async configure(ctx) {
|
|
2987
|
-
const
|
|
2988
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
3074
|
+
const { writer } = getPluginServices(ctx);
|
|
2989
3075
|
const files = [];
|
|
2990
3076
|
const srcDir = resolve8(ctx.projectRoot, ctx.srcDir);
|
|
2991
3077
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -3001,7 +3087,7 @@ var axiosPlugin = {
|
|
|
3001
3087
|
content: apiContent,
|
|
3002
3088
|
backup: false
|
|
3003
3089
|
});
|
|
3004
|
-
|
|
3090
|
+
logger10.info(`Created Axios instance: ${apiPath}`);
|
|
3005
3091
|
if (ctx.typescript) {
|
|
3006
3092
|
const typesPath = join9(libDir, "api-types.ts");
|
|
3007
3093
|
const typesContent = getApiTypesContentTS();
|
|
@@ -3012,7 +3098,7 @@ var axiosPlugin = {
|
|
|
3012
3098
|
content: typesContent,
|
|
3013
3099
|
backup: false
|
|
3014
3100
|
});
|
|
3015
|
-
|
|
3101
|
+
logger10.info(`Created API types: ${typesPath}`);
|
|
3016
3102
|
}
|
|
3017
3103
|
return {
|
|
3018
3104
|
files,
|
|
@@ -3020,7 +3106,7 @@ var axiosPlugin = {
|
|
|
3020
3106
|
message: "Axios configured successfully"
|
|
3021
3107
|
};
|
|
3022
3108
|
} catch (error) {
|
|
3023
|
-
|
|
3109
|
+
logger10.error("Failed to configure Axios:", error);
|
|
3024
3110
|
return {
|
|
3025
3111
|
files,
|
|
3026
3112
|
success: false,
|
|
@@ -3032,12 +3118,12 @@ var axiosPlugin = {
|
|
|
3032
3118
|
* Rollback de la configuration Axios
|
|
3033
3119
|
*/
|
|
3034
3120
|
async rollback(_ctx) {
|
|
3035
|
-
const backupManager =
|
|
3121
|
+
const backupManager = getRollbackManager(_ctx);
|
|
3036
3122
|
try {
|
|
3037
3123
|
await backupManager.restoreAll();
|
|
3038
|
-
|
|
3124
|
+
logger10.info("Axios configuration rolled back");
|
|
3039
3125
|
} catch (error) {
|
|
3040
|
-
|
|
3126
|
+
logger10.error("Failed to rollback Axios configuration:", error);
|
|
3041
3127
|
throw error;
|
|
3042
3128
|
}
|
|
3043
3129
|
}
|
|
@@ -3097,27 +3183,27 @@ api.interceptors.response.use(
|
|
|
3097
3183
|
switch (error.response.status) {
|
|
3098
3184
|
case 401:
|
|
3099
3185
|
// Non autoris\xE9 - rediriger vers la page de connexion
|
|
3100
|
-
|
|
3186
|
+
logger.error('Unauthorized - redirecting to login')
|
|
3101
3187
|
// window.location.href = '/login'
|
|
3102
3188
|
break
|
|
3103
3189
|
case 403:
|
|
3104
|
-
|
|
3190
|
+
logger.error('Forbidden')
|
|
3105
3191
|
break
|
|
3106
3192
|
case 404:
|
|
3107
|
-
|
|
3193
|
+
logger.error('Not found')
|
|
3108
3194
|
break
|
|
3109
3195
|
case 500:
|
|
3110
|
-
|
|
3196
|
+
logger.error('Server error')
|
|
3111
3197
|
break
|
|
3112
3198
|
default:
|
|
3113
|
-
|
|
3199
|
+
logger.error('Request failed:', error.response.status)
|
|
3114
3200
|
}
|
|
3115
3201
|
} else if (error.request) {
|
|
3116
3202
|
// La requ\xEAte a \xE9t\xE9 faite mais aucune r\xE9ponse n'a \xE9t\xE9 re\xE7ue
|
|
3117
|
-
|
|
3203
|
+
logger.error('No response received:', error.request)
|
|
3118
3204
|
} else {
|
|
3119
3205
|
// Une erreur s'est produite lors de la configuration de la requ\xEAte
|
|
3120
|
-
|
|
3206
|
+
logger.error('Error setting up request:', error.message)
|
|
3121
3207
|
}
|
|
3122
3208
|
return Promise.reject(error)
|
|
3123
3209
|
}
|
|
@@ -3181,27 +3267,27 @@ api.interceptors.response.use(
|
|
|
3181
3267
|
switch (error.response.status) {
|
|
3182
3268
|
case 401:
|
|
3183
3269
|
// Non autoris\xE9 - rediriger vers la page de connexion
|
|
3184
|
-
|
|
3270
|
+
logger.error('Unauthorized - redirecting to login')
|
|
3185
3271
|
// window.location.href = '/login'
|
|
3186
3272
|
break
|
|
3187
3273
|
case 403:
|
|
3188
|
-
|
|
3274
|
+
logger.error('Forbidden')
|
|
3189
3275
|
break
|
|
3190
3276
|
case 404:
|
|
3191
|
-
|
|
3277
|
+
logger.error('Not found')
|
|
3192
3278
|
break
|
|
3193
3279
|
case 500:
|
|
3194
|
-
|
|
3280
|
+
logger.error('Server error')
|
|
3195
3281
|
break
|
|
3196
3282
|
default:
|
|
3197
|
-
|
|
3283
|
+
logger.error('Request failed:', error.response.status)
|
|
3198
3284
|
}
|
|
3199
3285
|
} else if (error.request) {
|
|
3200
3286
|
// La requ\xEAte a \xE9t\xE9 faite mais aucune r\xE9ponse n'a \xE9t\xE9 re\xE7ue
|
|
3201
|
-
|
|
3287
|
+
logger.error('No response received:', error.request)
|
|
3202
3288
|
} else {
|
|
3203
3289
|
// Une erreur s'est produite lors de la configuration de la requ\xEAte
|
|
3204
|
-
|
|
3290
|
+
logger.error('Error setting up request:', error.message)
|
|
3205
3291
|
}
|
|
3206
3292
|
return Promise.reject(error)
|
|
3207
3293
|
}
|
|
@@ -3258,6 +3344,7 @@ export interface ApiError {
|
|
|
3258
3344
|
|
|
3259
3345
|
// src/plugins/http/tanstack-query.ts
|
|
3260
3346
|
import { resolve as resolve9, join as join10 } from "path";
|
|
3347
|
+
var logger11 = getModuleLogger();
|
|
3261
3348
|
var tanstackQueryPlugin = {
|
|
3262
3349
|
name: "@tanstack/react-query",
|
|
3263
3350
|
displayName: "TanStack Query",
|
|
@@ -3276,7 +3363,7 @@ var tanstackQueryPlugin = {
|
|
|
3276
3363
|
*/
|
|
3277
3364
|
async install(ctx) {
|
|
3278
3365
|
if (this.detect?.(ctx)) {
|
|
3279
|
-
|
|
3366
|
+
logger11.info("TanStack Query is already installed");
|
|
3280
3367
|
return {
|
|
3281
3368
|
packages: {},
|
|
3282
3369
|
success: true,
|
|
@@ -3292,7 +3379,7 @@ var tanstackQueryPlugin = {
|
|
|
3292
3379
|
exact: false,
|
|
3293
3380
|
silent: false
|
|
3294
3381
|
});
|
|
3295
|
-
|
|
3382
|
+
logger11.info("Successfully installed TanStack Query");
|
|
3296
3383
|
return {
|
|
3297
3384
|
packages: {
|
|
3298
3385
|
dependencies: packages
|
|
@@ -3301,7 +3388,7 @@ var tanstackQueryPlugin = {
|
|
|
3301
3388
|
message: `Installed ${packages.join(", ")}`
|
|
3302
3389
|
};
|
|
3303
3390
|
} catch (error) {
|
|
3304
|
-
|
|
3391
|
+
logger11.error("Failed to install TanStack Query:", error);
|
|
3305
3392
|
return {
|
|
3306
3393
|
packages: {},
|
|
3307
3394
|
success: false,
|
|
@@ -3323,8 +3410,7 @@ var tanstackQueryPlugin = {
|
|
|
3323
3410
|
* Documentation : https://tanstack.com/query/latest/docs/framework/react/quick-start
|
|
3324
3411
|
*/
|
|
3325
3412
|
async configure(ctx) {
|
|
3326
|
-
const
|
|
3327
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
3413
|
+
const { writer } = getPluginServices(ctx);
|
|
3328
3414
|
const files = [];
|
|
3329
3415
|
const srcDir = resolve9(ctx.projectRoot, ctx.srcDir);
|
|
3330
3416
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -3340,7 +3426,7 @@ var tanstackQueryPlugin = {
|
|
|
3340
3426
|
content: queryClientContent,
|
|
3341
3427
|
backup: false
|
|
3342
3428
|
});
|
|
3343
|
-
|
|
3429
|
+
logger11.info(`Created query client: ${queryClientPath}`);
|
|
3344
3430
|
const queriesDir = join10(libDir, "queries");
|
|
3345
3431
|
await ensureDirectory(queriesDir, ctx.fsAdapter);
|
|
3346
3432
|
const exampleQueryPath = join10(queriesDir, `example.${extension}`);
|
|
@@ -3352,7 +3438,7 @@ var tanstackQueryPlugin = {
|
|
|
3352
3438
|
content: exampleQueryContent,
|
|
3353
3439
|
backup: false
|
|
3354
3440
|
});
|
|
3355
|
-
|
|
3441
|
+
logger11.info(`Created example query: ${exampleQueryPath}`);
|
|
3356
3442
|
const mutationsDir = join10(libDir, "mutations");
|
|
3357
3443
|
await ensureDirectory(mutationsDir, ctx.fsAdapter);
|
|
3358
3444
|
const exampleMutationPath = join10(mutationsDir, `example.${extension}`);
|
|
@@ -3364,7 +3450,7 @@ var tanstackQueryPlugin = {
|
|
|
3364
3450
|
content: exampleMutationContent,
|
|
3365
3451
|
backup: false
|
|
3366
3452
|
});
|
|
3367
|
-
|
|
3453
|
+
logger11.info(`Created example mutation: ${exampleMutationPath}`);
|
|
3368
3454
|
const appPath = join10(srcDir, `App.${ctx.typescript ? "tsx" : "jsx"}`);
|
|
3369
3455
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
3370
3456
|
if (appExists) {
|
|
@@ -3384,7 +3470,7 @@ var tanstackQueryPlugin = {
|
|
|
3384
3470
|
content: modifiedAppContent,
|
|
3385
3471
|
backup: true
|
|
3386
3472
|
});
|
|
3387
|
-
|
|
3473
|
+
logger11.info(
|
|
3388
3474
|
`Updated App.${ctx.typescript ? "tsx" : "jsx"} with QueryClientProvider`
|
|
3389
3475
|
);
|
|
3390
3476
|
} else {
|
|
@@ -3396,7 +3482,7 @@ var tanstackQueryPlugin = {
|
|
|
3396
3482
|
content: appContent,
|
|
3397
3483
|
backup: false
|
|
3398
3484
|
});
|
|
3399
|
-
|
|
3485
|
+
logger11.info(
|
|
3400
3486
|
`Created App.${ctx.typescript ? "tsx" : "jsx"} with QueryClientProvider`
|
|
3401
3487
|
);
|
|
3402
3488
|
}
|
|
@@ -3406,7 +3492,7 @@ var tanstackQueryPlugin = {
|
|
|
3406
3492
|
message: "TanStack Query configured successfully"
|
|
3407
3493
|
};
|
|
3408
3494
|
} catch (error) {
|
|
3409
|
-
|
|
3495
|
+
logger11.error("Failed to configure TanStack Query:", error);
|
|
3410
3496
|
return {
|
|
3411
3497
|
files,
|
|
3412
3498
|
success: false,
|
|
@@ -3418,12 +3504,12 @@ var tanstackQueryPlugin = {
|
|
|
3418
3504
|
* Rollback de la configuration TanStack Query
|
|
3419
3505
|
*/
|
|
3420
3506
|
async rollback(_ctx) {
|
|
3421
|
-
const backupManager =
|
|
3507
|
+
const backupManager = getRollbackManager(_ctx);
|
|
3422
3508
|
try {
|
|
3423
3509
|
await backupManager.restoreAll();
|
|
3424
|
-
|
|
3510
|
+
logger11.info("TanStack Query configuration rolled back");
|
|
3425
3511
|
} catch (error) {
|
|
3426
|
-
|
|
3512
|
+
logger11.error("Failed to rollback TanStack Query configuration:", error);
|
|
3427
3513
|
throw error;
|
|
3428
3514
|
}
|
|
3429
3515
|
}
|
|
@@ -3727,7 +3813,7 @@ export default App
|
|
|
3727
3813
|
}
|
|
3728
3814
|
function injectQueryClientProvider(content, isTypeScript) {
|
|
3729
3815
|
if (content.includes("QueryClientProvider") && content.includes("@tanstack/react-query")) {
|
|
3730
|
-
|
|
3816
|
+
logger11.warn("QueryClientProvider already present in App file");
|
|
3731
3817
|
return content;
|
|
3732
3818
|
}
|
|
3733
3819
|
const hasQueryClientProviderImport = content.includes("from '@tanstack/react-query'") || content.includes('from "@tanstack/react-query"');
|
|
@@ -3812,6 +3898,7 @@ export default App
|
|
|
3812
3898
|
|
|
3813
3899
|
// src/plugins/http/tanstack-query-vue.ts
|
|
3814
3900
|
import { join as join11 } from "path";
|
|
3901
|
+
var logger12 = getModuleLogger();
|
|
3815
3902
|
var tanstackVueQueryPlugin = {
|
|
3816
3903
|
name: "@tanstack/vue-query",
|
|
3817
3904
|
displayName: "TanStack Query (Vue)",
|
|
@@ -3830,7 +3917,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3830
3917
|
*/
|
|
3831
3918
|
async install(ctx) {
|
|
3832
3919
|
if (this.detect?.(ctx)) {
|
|
3833
|
-
|
|
3920
|
+
logger12.info("TanStack Vue Query is already installed");
|
|
3834
3921
|
return {
|
|
3835
3922
|
packages: {},
|
|
3836
3923
|
success: true,
|
|
@@ -3846,7 +3933,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3846
3933
|
exact: false,
|
|
3847
3934
|
silent: false
|
|
3848
3935
|
});
|
|
3849
|
-
|
|
3936
|
+
logger12.info("Successfully installed TanStack Vue Query");
|
|
3850
3937
|
return {
|
|
3851
3938
|
packages: {
|
|
3852
3939
|
dependencies: packages
|
|
@@ -3855,7 +3942,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3855
3942
|
message: `Installed ${packages.join(", ")}`
|
|
3856
3943
|
};
|
|
3857
3944
|
} catch (error) {
|
|
3858
|
-
|
|
3945
|
+
logger12.error("Failed to install TanStack Vue Query:", error);
|
|
3859
3946
|
return {
|
|
3860
3947
|
packages: {},
|
|
3861
3948
|
success: false,
|
|
@@ -3872,8 +3959,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3872
3959
|
* - src/main.ts (ou main.js)
|
|
3873
3960
|
*/
|
|
3874
3961
|
async configure(ctx) {
|
|
3875
|
-
const backupManager =
|
|
3876
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
3962
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
3877
3963
|
const files = [];
|
|
3878
3964
|
const srcDir = join11(ctx.projectRoot, ctx.srcDir);
|
|
3879
3965
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -3894,7 +3980,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3894
3980
|
content: queryClientContent,
|
|
3895
3981
|
backup: false
|
|
3896
3982
|
});
|
|
3897
|
-
|
|
3983
|
+
logger12.info(`Created TanStack Query client: ${queryClientPath}`);
|
|
3898
3984
|
}
|
|
3899
3985
|
const mainPath = join11(srcDir, `main.${extension}`);
|
|
3900
3986
|
const mainExists = await checkPathExists(mainPath, ctx.fsAdapter);
|
|
@@ -3913,10 +3999,10 @@ var tanstackVueQueryPlugin = {
|
|
|
3913
3999
|
content: updatedMain,
|
|
3914
4000
|
backup: true
|
|
3915
4001
|
});
|
|
3916
|
-
|
|
4002
|
+
logger12.info(`Updated main file with Vue Query: ${mainPath}`);
|
|
3917
4003
|
}
|
|
3918
4004
|
} else {
|
|
3919
|
-
|
|
4005
|
+
logger12.warn(`Main file not found: ${mainPath}`);
|
|
3920
4006
|
}
|
|
3921
4007
|
return {
|
|
3922
4008
|
files,
|
|
@@ -3924,7 +4010,7 @@ var tanstackVueQueryPlugin = {
|
|
|
3924
4010
|
message: "TanStack Vue Query configured successfully"
|
|
3925
4011
|
};
|
|
3926
4012
|
} catch (error) {
|
|
3927
|
-
|
|
4013
|
+
logger12.error("Failed to configure TanStack Vue Query:", error);
|
|
3928
4014
|
await backupManager.restoreAll();
|
|
3929
4015
|
return {
|
|
3930
4016
|
files,
|
|
@@ -3937,12 +4023,12 @@ var tanstackVueQueryPlugin = {
|
|
|
3937
4023
|
* Rollback de la configuration TanStack Vue Query
|
|
3938
4024
|
*/
|
|
3939
4025
|
async rollback(_ctx) {
|
|
3940
|
-
const backupManager =
|
|
4026
|
+
const backupManager = getRollbackManager(_ctx);
|
|
3941
4027
|
try {
|
|
3942
4028
|
await backupManager.restoreAll();
|
|
3943
|
-
|
|
4029
|
+
logger12.info("TanStack Vue Query configuration rolled back");
|
|
3944
4030
|
} catch (error) {
|
|
3945
|
-
|
|
4031
|
+
logger12.error(
|
|
3946
4032
|
"Failed to rollback TanStack Vue Query configuration:",
|
|
3947
4033
|
error
|
|
3948
4034
|
);
|
|
@@ -3999,6 +4085,7 @@ app.use(VueQueryPlugin, { queryClient })`
|
|
|
3999
4085
|
|
|
4000
4086
|
// src/plugins/i18n/vue-i18n.ts
|
|
4001
4087
|
import { join as join12 } from "path";
|
|
4088
|
+
var logger13 = getModuleLogger();
|
|
4002
4089
|
var vueI18nPlugin = {
|
|
4003
4090
|
name: "vue-i18n",
|
|
4004
4091
|
displayName: "Vue I18n",
|
|
@@ -4017,7 +4104,7 @@ var vueI18nPlugin = {
|
|
|
4017
4104
|
*/
|
|
4018
4105
|
async install(ctx) {
|
|
4019
4106
|
if (this.detect?.(ctx)) {
|
|
4020
|
-
|
|
4107
|
+
logger13.info("vue-i18n is already installed");
|
|
4021
4108
|
return {
|
|
4022
4109
|
packages: {},
|
|
4023
4110
|
success: true,
|
|
@@ -4033,7 +4120,7 @@ var vueI18nPlugin = {
|
|
|
4033
4120
|
exact: false,
|
|
4034
4121
|
silent: false
|
|
4035
4122
|
});
|
|
4036
|
-
|
|
4123
|
+
logger13.info("Successfully installed vue-i18n");
|
|
4037
4124
|
return {
|
|
4038
4125
|
packages: {
|
|
4039
4126
|
dependencies: packages
|
|
@@ -4042,7 +4129,7 @@ var vueI18nPlugin = {
|
|
|
4042
4129
|
message: `Installed vue-i18n: ${packages.join(", ")}`
|
|
4043
4130
|
};
|
|
4044
4131
|
} catch (error) {
|
|
4045
|
-
|
|
4132
|
+
logger13.error("Failed to install vue-i18n:", error);
|
|
4046
4133
|
return {
|
|
4047
4134
|
packages: {},
|
|
4048
4135
|
success: false,
|
|
@@ -4079,7 +4166,7 @@ var vueI18nPlugin = {
|
|
|
4079
4166
|
content: messagesContent,
|
|
4080
4167
|
backup: false
|
|
4081
4168
|
});
|
|
4082
|
-
|
|
4169
|
+
logger13.info(`Created i18n messages: ${messagesPath}`);
|
|
4083
4170
|
}
|
|
4084
4171
|
const i18nIndexPath = join12(i18nDir, `index.${extension}`);
|
|
4085
4172
|
const i18nIndexExists = await checkPathExists(
|
|
@@ -4095,7 +4182,7 @@ var vueI18nPlugin = {
|
|
|
4095
4182
|
content: i18nIndexContent,
|
|
4096
4183
|
backup: false
|
|
4097
4184
|
});
|
|
4098
|
-
|
|
4185
|
+
logger13.info(`Created i18n setup: ${i18nIndexPath}`);
|
|
4099
4186
|
}
|
|
4100
4187
|
const mainPath = join12(srcDir, `main.${extension}`);
|
|
4101
4188
|
const mainExists = await checkPathExists(mainPath, ctx.fsAdapter);
|
|
@@ -4114,10 +4201,10 @@ var vueI18nPlugin = {
|
|
|
4114
4201
|
content: updatedMain,
|
|
4115
4202
|
backup: true
|
|
4116
4203
|
});
|
|
4117
|
-
|
|
4204
|
+
logger13.info(`Updated main file with i18n: ${mainPath}`);
|
|
4118
4205
|
}
|
|
4119
4206
|
} else {
|
|
4120
|
-
|
|
4207
|
+
logger13.warn(`Main file not found: ${mainPath}`);
|
|
4121
4208
|
}
|
|
4122
4209
|
return {
|
|
4123
4210
|
files,
|
|
@@ -4125,7 +4212,7 @@ var vueI18nPlugin = {
|
|
|
4125
4212
|
message: "Vue I18n configured successfully"
|
|
4126
4213
|
};
|
|
4127
4214
|
} catch (error) {
|
|
4128
|
-
|
|
4215
|
+
logger13.error("Failed to configure Vue I18n:", error);
|
|
4129
4216
|
await backupManager.restoreAll();
|
|
4130
4217
|
return {
|
|
4131
4218
|
files,
|
|
@@ -4141,9 +4228,9 @@ var vueI18nPlugin = {
|
|
|
4141
4228
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4142
4229
|
try {
|
|
4143
4230
|
await backupManager.restoreAll();
|
|
4144
|
-
|
|
4231
|
+
logger13.info("Vue I18n configuration rolled back");
|
|
4145
4232
|
} catch (error) {
|
|
4146
|
-
|
|
4233
|
+
logger13.error("Failed to rollback Vue I18n configuration:", error);
|
|
4147
4234
|
throw error;
|
|
4148
4235
|
}
|
|
4149
4236
|
}
|
|
@@ -4217,6 +4304,7 @@ app.use(i18n)`
|
|
|
4217
4304
|
|
|
4218
4305
|
// src/plugins/nextjs/api-routes.ts
|
|
4219
4306
|
import { join as join13 } from "path";
|
|
4307
|
+
var logger14 = getModuleLogger();
|
|
4220
4308
|
var nextjsApiRoutesPlugin = {
|
|
4221
4309
|
name: "nextjs-api-routes",
|
|
4222
4310
|
displayName: "Next.js API Routes",
|
|
@@ -4234,7 +4322,7 @@ var nextjsApiRoutesPlugin = {
|
|
|
4234
4322
|
* Pas d'installation nécessaire
|
|
4235
4323
|
*/
|
|
4236
4324
|
install(_ctx) {
|
|
4237
|
-
|
|
4325
|
+
logger14.info("API routes are files, no installation needed");
|
|
4238
4326
|
return Promise.resolve({
|
|
4239
4327
|
packages: {},
|
|
4240
4328
|
success: true,
|
|
@@ -4264,7 +4352,7 @@ var nextjsApiRoutesPlugin = {
|
|
|
4264
4352
|
const appApiExists = await checkPathExists(appApiPath, ctx.fsAdapter);
|
|
4265
4353
|
const pagesApiExists = await checkPathExists(pagesApiPath, ctx.fsAdapter);
|
|
4266
4354
|
if (appApiExists || pagesApiExists) {
|
|
4267
|
-
|
|
4355
|
+
logger14.warn("API route already exists");
|
|
4268
4356
|
return {
|
|
4269
4357
|
files: [],
|
|
4270
4358
|
success: true,
|
|
@@ -4294,14 +4382,14 @@ var nextjsApiRoutesPlugin = {
|
|
|
4294
4382
|
content: apiContent,
|
|
4295
4383
|
backup: false
|
|
4296
4384
|
});
|
|
4297
|
-
|
|
4385
|
+
logger14.info(`Created API route: ${targetPath}`);
|
|
4298
4386
|
return {
|
|
4299
4387
|
files,
|
|
4300
4388
|
success: true,
|
|
4301
4389
|
message: "Next.js API route created successfully"
|
|
4302
4390
|
};
|
|
4303
4391
|
} catch (error) {
|
|
4304
|
-
|
|
4392
|
+
logger14.error("Failed to create API route:", error);
|
|
4305
4393
|
return {
|
|
4306
4394
|
files,
|
|
4307
4395
|
success: false,
|
|
@@ -4316,9 +4404,9 @@ var nextjsApiRoutesPlugin = {
|
|
|
4316
4404
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4317
4405
|
try {
|
|
4318
4406
|
await backupManager.restoreAll();
|
|
4319
|
-
|
|
4407
|
+
logger14.info("API route configuration rolled back");
|
|
4320
4408
|
} catch (error) {
|
|
4321
|
-
|
|
4409
|
+
logger14.error("Failed to rollback API route configuration:", error);
|
|
4322
4410
|
throw error;
|
|
4323
4411
|
}
|
|
4324
4412
|
}
|
|
@@ -4389,6 +4477,7 @@ export default function handler(
|
|
|
4389
4477
|
|
|
4390
4478
|
// src/plugins/nextjs/font-optimization.ts
|
|
4391
4479
|
import { join as join14 } from "path";
|
|
4480
|
+
var logger15 = getModuleLogger();
|
|
4392
4481
|
var nextjsFontOptimizationPlugin = {
|
|
4393
4482
|
name: "nextjs-font-optimization",
|
|
4394
4483
|
displayName: "Next.js Font Optimization",
|
|
@@ -4406,7 +4495,7 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4406
4495
|
* Pas d'installation nécessaire, next/font est inclus dans Next.js
|
|
4407
4496
|
*/
|
|
4408
4497
|
install(_ctx) {
|
|
4409
|
-
|
|
4498
|
+
logger15.info(
|
|
4410
4499
|
"Font optimization is built into Next.js, no installation needed"
|
|
4411
4500
|
);
|
|
4412
4501
|
return Promise.resolve({
|
|
@@ -4476,12 +4565,12 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4476
4565
|
content: updatedContent,
|
|
4477
4566
|
backup: true
|
|
4478
4567
|
});
|
|
4479
|
-
|
|
4568
|
+
logger15.info(`Added font optimization to ${targetPath}`);
|
|
4480
4569
|
} else {
|
|
4481
|
-
|
|
4570
|
+
logger15.warn("Font optimization already configured");
|
|
4482
4571
|
}
|
|
4483
4572
|
} else {
|
|
4484
|
-
|
|
4573
|
+
logger15.warn("Could not find layout or _app file to configure fonts");
|
|
4485
4574
|
}
|
|
4486
4575
|
return {
|
|
4487
4576
|
files,
|
|
@@ -4489,7 +4578,7 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4489
4578
|
message: "Next.js font optimization configured successfully"
|
|
4490
4579
|
};
|
|
4491
4580
|
} catch (error) {
|
|
4492
|
-
|
|
4581
|
+
logger15.error("Failed to configure font optimization:", error);
|
|
4493
4582
|
return {
|
|
4494
4583
|
files,
|
|
4495
4584
|
success: false,
|
|
@@ -4504,9 +4593,9 @@ var nextjsFontOptimizationPlugin = {
|
|
|
4504
4593
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4505
4594
|
try {
|
|
4506
4595
|
await backupManager.restoreAll();
|
|
4507
|
-
|
|
4596
|
+
logger15.info("Font optimization configuration rolled back");
|
|
4508
4597
|
} catch (error) {
|
|
4509
|
-
|
|
4598
|
+
logger15.error("Failed to rollback font optimization configuration:", error);
|
|
4510
4599
|
throw error;
|
|
4511
4600
|
}
|
|
4512
4601
|
}
|
|
@@ -4569,6 +4658,7 @@ const inter = Inter({ subsets: ['latin'] })
|
|
|
4569
4658
|
|
|
4570
4659
|
// src/plugins/nextjs/image-optimization.ts
|
|
4571
4660
|
import { join as join15 } from "path";
|
|
4661
|
+
var logger16 = getModuleLogger();
|
|
4572
4662
|
var nextjsImageOptimizationPlugin = {
|
|
4573
4663
|
name: "nextjs-image-optimization",
|
|
4574
4664
|
displayName: "Next.js Image Optimization",
|
|
@@ -4586,7 +4676,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4586
4676
|
* Pas d'installation nécessaire, Next.js inclut déjà l'optimisation d'images
|
|
4587
4677
|
*/
|
|
4588
4678
|
install(_ctx) {
|
|
4589
|
-
|
|
4679
|
+
logger16.info(
|
|
4590
4680
|
"Image optimization is built into Next.js, no installation needed"
|
|
4591
4681
|
);
|
|
4592
4682
|
return Promise.resolve({
|
|
@@ -4627,7 +4717,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4627
4717
|
content: updatedContent,
|
|
4628
4718
|
backup: true
|
|
4629
4719
|
});
|
|
4630
|
-
|
|
4720
|
+
logger16.info(
|
|
4631
4721
|
`Updated next.config.${extension} with image optimization`
|
|
4632
4722
|
);
|
|
4633
4723
|
}
|
|
@@ -4640,7 +4730,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4640
4730
|
content: configContent,
|
|
4641
4731
|
backup: false
|
|
4642
4732
|
});
|
|
4643
|
-
|
|
4733
|
+
logger16.info(`Created next.config.${extension} with image optimization`);
|
|
4644
4734
|
}
|
|
4645
4735
|
return {
|
|
4646
4736
|
files,
|
|
@@ -4648,7 +4738,7 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4648
4738
|
message: "Next.js image optimization configured successfully"
|
|
4649
4739
|
};
|
|
4650
4740
|
} catch (error) {
|
|
4651
|
-
|
|
4741
|
+
logger16.error("Failed to configure image optimization:", error);
|
|
4652
4742
|
return {
|
|
4653
4743
|
files,
|
|
4654
4744
|
success: false,
|
|
@@ -4663,9 +4753,9 @@ var nextjsImageOptimizationPlugin = {
|
|
|
4663
4753
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
4664
4754
|
try {
|
|
4665
4755
|
await backupManager.restoreAll();
|
|
4666
|
-
|
|
4756
|
+
logger16.info("Image optimization configuration rolled back");
|
|
4667
4757
|
} catch (error) {
|
|
4668
|
-
|
|
4758
|
+
logger16.error(
|
|
4669
4759
|
"Failed to rollback image optimization configuration:",
|
|
4670
4760
|
error
|
|
4671
4761
|
);
|
|
@@ -4708,7 +4798,7 @@ module.exports = nextConfig
|
|
|
4708
4798
|
}
|
|
4709
4799
|
function injectImageConfig(content, _extension) {
|
|
4710
4800
|
if (content.includes("images:") && content.includes("remotePatterns")) {
|
|
4711
|
-
|
|
4801
|
+
logger16.warn("Image configuration already exists in next.config");
|
|
4712
4802
|
return content;
|
|
4713
4803
|
}
|
|
4714
4804
|
let modifiedContent = content;
|
|
@@ -4756,6 +4846,7 @@ ${match}`
|
|
|
4756
4846
|
|
|
4757
4847
|
// src/plugins/nextjs/middleware.ts
|
|
4758
4848
|
import { join as join16 } from "path";
|
|
4849
|
+
var logger17 = getModuleLogger();
|
|
4759
4850
|
var nextjsMiddlewarePlugin = {
|
|
4760
4851
|
name: "nextjs-middleware",
|
|
4761
4852
|
displayName: "Next.js Middleware",
|
|
@@ -4773,7 +4864,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4773
4864
|
* Pas d'installation nécessaire
|
|
4774
4865
|
*/
|
|
4775
4866
|
install(_ctx) {
|
|
4776
|
-
|
|
4867
|
+
logger17.info("Middleware is a file, no installation needed");
|
|
4777
4868
|
return Promise.resolve({
|
|
4778
4869
|
packages: {},
|
|
4779
4870
|
success: true,
|
|
@@ -4784,8 +4875,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4784
4875
|
* Crée le fichier middleware.ts/js à la racine du projet
|
|
4785
4876
|
*/
|
|
4786
4877
|
async configure(ctx) {
|
|
4787
|
-
const
|
|
4788
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
4878
|
+
const { writer } = getPluginServices(ctx);
|
|
4789
4879
|
const files = [];
|
|
4790
4880
|
const projectRoot = ctx.projectRoot;
|
|
4791
4881
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -4796,7 +4886,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4796
4886
|
ctx.fsAdapter
|
|
4797
4887
|
);
|
|
4798
4888
|
if (middlewareExists) {
|
|
4799
|
-
|
|
4889
|
+
logger17.warn("middleware.ts already exists, skipping creation");
|
|
4800
4890
|
} else {
|
|
4801
4891
|
const middlewareContent = getMiddlewareContent(extension);
|
|
4802
4892
|
await writer.createFile(middlewarePath, middlewareContent);
|
|
@@ -4806,7 +4896,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4806
4896
|
content: middlewareContent,
|
|
4807
4897
|
backup: false
|
|
4808
4898
|
});
|
|
4809
|
-
|
|
4899
|
+
logger17.info(`Created middleware.${extension}`);
|
|
4810
4900
|
}
|
|
4811
4901
|
return {
|
|
4812
4902
|
files,
|
|
@@ -4814,7 +4904,7 @@ var nextjsMiddlewarePlugin = {
|
|
|
4814
4904
|
message: "Next.js middleware created successfully"
|
|
4815
4905
|
};
|
|
4816
4906
|
} catch (error) {
|
|
4817
|
-
|
|
4907
|
+
logger17.error("Failed to create middleware:", error);
|
|
4818
4908
|
return {
|
|
4819
4909
|
files,
|
|
4820
4910
|
success: false,
|
|
@@ -4826,12 +4916,12 @@ var nextjsMiddlewarePlugin = {
|
|
|
4826
4916
|
* Rollback de la configuration
|
|
4827
4917
|
*/
|
|
4828
4918
|
async rollback(_ctx) {
|
|
4829
|
-
const backupManager =
|
|
4919
|
+
const backupManager = getRollbackManager(_ctx);
|
|
4830
4920
|
try {
|
|
4831
4921
|
await backupManager.restoreAll();
|
|
4832
|
-
|
|
4922
|
+
logger17.info("Middleware configuration rolled back");
|
|
4833
4923
|
} catch (error) {
|
|
4834
|
-
|
|
4924
|
+
logger17.error("Failed to rollback middleware configuration:", error);
|
|
4835
4925
|
throw error;
|
|
4836
4926
|
}
|
|
4837
4927
|
}
|
|
@@ -4890,6 +4980,7 @@ export const config = {
|
|
|
4890
4980
|
|
|
4891
4981
|
// src/plugins/routing/react-router.ts
|
|
4892
4982
|
import { resolve as resolve10, join as join17 } from "path";
|
|
4983
|
+
var logger18 = getModuleLogger();
|
|
4893
4984
|
var reactRouterPlugin = {
|
|
4894
4985
|
name: "react-router-dom",
|
|
4895
4986
|
displayName: "React Router",
|
|
@@ -4910,7 +5001,7 @@ var reactRouterPlugin = {
|
|
|
4910
5001
|
*/
|
|
4911
5002
|
async install(ctx) {
|
|
4912
5003
|
if (this.detect?.(ctx)) {
|
|
4913
|
-
|
|
5004
|
+
logger18.info("React Router is already installed");
|
|
4914
5005
|
return {
|
|
4915
5006
|
packages: {},
|
|
4916
5007
|
success: true,
|
|
@@ -4929,7 +5020,7 @@ var reactRouterPlugin = {
|
|
|
4929
5020
|
exact: false,
|
|
4930
5021
|
silent: false
|
|
4931
5022
|
});
|
|
4932
|
-
|
|
5023
|
+
logger18.info(`Successfully installed React Router v7`);
|
|
4933
5024
|
return {
|
|
4934
5025
|
packages: {
|
|
4935
5026
|
dependencies: packages
|
|
@@ -4938,7 +5029,7 @@ var reactRouterPlugin = {
|
|
|
4938
5029
|
message: `Installed ${packages.join(", ")}`
|
|
4939
5030
|
};
|
|
4940
5031
|
} catch (error) {
|
|
4941
|
-
|
|
5032
|
+
logger18.error("Failed to install React Router:", error);
|
|
4942
5033
|
return {
|
|
4943
5034
|
packages: {},
|
|
4944
5035
|
success: false,
|
|
@@ -4974,7 +5065,7 @@ var reactRouterPlugin = {
|
|
|
4974
5065
|
content: routerContent,
|
|
4975
5066
|
backup: false
|
|
4976
5067
|
});
|
|
4977
|
-
|
|
5068
|
+
logger18.info(`Created router configuration: ${routerPath}`);
|
|
4978
5069
|
const homeRoutePath = join17(routesDir, `Home.${extension}`);
|
|
4979
5070
|
const homeRouteContent = ctx.typescript ? getHomeRouteContentTS() : getHomeRouteContentJS();
|
|
4980
5071
|
await writer.createFile(homeRoutePath, homeRouteContent);
|
|
@@ -4984,7 +5075,7 @@ var reactRouterPlugin = {
|
|
|
4984
5075
|
content: homeRouteContent,
|
|
4985
5076
|
backup: false
|
|
4986
5077
|
});
|
|
4987
|
-
|
|
5078
|
+
logger18.info(`Created example route: ${homeRoutePath}`);
|
|
4988
5079
|
const appPath = join17(srcDir, `App.${extension}`);
|
|
4989
5080
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
4990
5081
|
if (appExists) {
|
|
@@ -5004,7 +5095,7 @@ var reactRouterPlugin = {
|
|
|
5004
5095
|
content: modifiedAppContent,
|
|
5005
5096
|
backup: true
|
|
5006
5097
|
});
|
|
5007
|
-
|
|
5098
|
+
logger18.info(`Updated App.${extension} with RouterProvider`);
|
|
5008
5099
|
} else {
|
|
5009
5100
|
const appContent = ctx.typescript ? getAppContentTS2() : getAppContentJS2();
|
|
5010
5101
|
await writer.createFile(appPath, appContent);
|
|
@@ -5014,7 +5105,7 @@ var reactRouterPlugin = {
|
|
|
5014
5105
|
content: appContent,
|
|
5015
5106
|
backup: false
|
|
5016
5107
|
});
|
|
5017
|
-
|
|
5108
|
+
logger18.info(`Created App.${extension} with RouterProvider`);
|
|
5018
5109
|
}
|
|
5019
5110
|
return {
|
|
5020
5111
|
files,
|
|
@@ -5022,7 +5113,7 @@ var reactRouterPlugin = {
|
|
|
5022
5113
|
message: "React Router configured successfully"
|
|
5023
5114
|
};
|
|
5024
5115
|
} catch (error) {
|
|
5025
|
-
|
|
5116
|
+
logger18.error("Failed to configure React Router:", error);
|
|
5026
5117
|
return {
|
|
5027
5118
|
files,
|
|
5028
5119
|
success: false,
|
|
@@ -5037,9 +5128,9 @@ var reactRouterPlugin = {
|
|
|
5037
5128
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
5038
5129
|
try {
|
|
5039
5130
|
await backupManager.restoreAll();
|
|
5040
|
-
|
|
5131
|
+
logger18.info("React Router configuration rolled back");
|
|
5041
5132
|
} catch (error) {
|
|
5042
|
-
|
|
5133
|
+
logger18.error("Failed to rollback React Router configuration:", error);
|
|
5043
5134
|
throw error;
|
|
5044
5135
|
}
|
|
5045
5136
|
}
|
|
@@ -5142,7 +5233,7 @@ export default App
|
|
|
5142
5233
|
}
|
|
5143
5234
|
function injectRouterProvider(content, isTypeScript) {
|
|
5144
5235
|
if (content.includes("RouterProvider")) {
|
|
5145
|
-
|
|
5236
|
+
logger18.warn("RouterProvider already present in App file");
|
|
5146
5237
|
return content;
|
|
5147
5238
|
}
|
|
5148
5239
|
const hasRouterImport = content.includes("from 'react-router-dom'") || content.includes('from "react-router-dom"');
|
|
@@ -5243,6 +5334,7 @@ export default App
|
|
|
5243
5334
|
|
|
5244
5335
|
// src/plugins/routing/tanstack-router.ts
|
|
5245
5336
|
import { resolve as resolve11, join as join18 } from "path";
|
|
5337
|
+
var logger19 = getModuleLogger();
|
|
5246
5338
|
var tanstackRouterPlugin = {
|
|
5247
5339
|
name: "@tanstack/react-router",
|
|
5248
5340
|
displayName: "TanStack Router",
|
|
@@ -5262,7 +5354,7 @@ var tanstackRouterPlugin = {
|
|
|
5262
5354
|
*/
|
|
5263
5355
|
async install(ctx) {
|
|
5264
5356
|
if (this.detect?.(ctx)) {
|
|
5265
|
-
|
|
5357
|
+
logger19.info("TanStack Router is already installed");
|
|
5266
5358
|
return {
|
|
5267
5359
|
packages: {},
|
|
5268
5360
|
success: true,
|
|
@@ -5278,7 +5370,7 @@ var tanstackRouterPlugin = {
|
|
|
5278
5370
|
exact: false,
|
|
5279
5371
|
silent: false
|
|
5280
5372
|
});
|
|
5281
|
-
|
|
5373
|
+
logger19.info("Successfully installed TanStack Router");
|
|
5282
5374
|
return {
|
|
5283
5375
|
packages: {
|
|
5284
5376
|
dependencies: packages
|
|
@@ -5287,7 +5379,7 @@ var tanstackRouterPlugin = {
|
|
|
5287
5379
|
message: `Installed ${packages.join(", ")}`
|
|
5288
5380
|
};
|
|
5289
5381
|
} catch (error) {
|
|
5290
|
-
|
|
5382
|
+
logger19.error("Failed to install TanStack Router:", error);
|
|
5291
5383
|
return {
|
|
5292
5384
|
packages: {},
|
|
5293
5385
|
success: false,
|
|
@@ -5327,7 +5419,7 @@ var tanstackRouterPlugin = {
|
|
|
5327
5419
|
content: rootRouteContent,
|
|
5328
5420
|
backup: false
|
|
5329
5421
|
});
|
|
5330
|
-
|
|
5422
|
+
logger19.info(`Created root route: ${rootRoutePath}`);
|
|
5331
5423
|
const indexRoutePath = join18(routesDir, `index.${extension}`);
|
|
5332
5424
|
const indexRouteContent = ctx.typescript ? getIndexRouteContentTS() : getIndexRouteContentJS();
|
|
5333
5425
|
await writer.createFile(indexRoutePath, indexRouteContent);
|
|
@@ -5337,7 +5429,7 @@ var tanstackRouterPlugin = {
|
|
|
5337
5429
|
content: indexRouteContent,
|
|
5338
5430
|
backup: false
|
|
5339
5431
|
});
|
|
5340
|
-
|
|
5432
|
+
logger19.info(`Created index route: ${indexRoutePath}`);
|
|
5341
5433
|
const aboutRoutePath = join18(routesDir, `about.${extension}`);
|
|
5342
5434
|
const aboutRouteContent = ctx.typescript ? getAboutRouteContentTS() : getAboutRouteContentJS();
|
|
5343
5435
|
await writer.createFile(aboutRoutePath, aboutRouteContent);
|
|
@@ -5347,7 +5439,7 @@ var tanstackRouterPlugin = {
|
|
|
5347
5439
|
content: aboutRouteContent,
|
|
5348
5440
|
backup: false
|
|
5349
5441
|
});
|
|
5350
|
-
|
|
5442
|
+
logger19.info(`Created about route: ${aboutRoutePath}`);
|
|
5351
5443
|
const routerPath = join18(srcDir, `router.${extension}`);
|
|
5352
5444
|
const routerContent = ctx.typescript ? getRouterContentTS2() : getRouterContentJS2();
|
|
5353
5445
|
await writer.createFile(routerPath, routerContent);
|
|
@@ -5357,7 +5449,7 @@ var tanstackRouterPlugin = {
|
|
|
5357
5449
|
content: routerContent,
|
|
5358
5450
|
backup: false
|
|
5359
5451
|
});
|
|
5360
|
-
|
|
5452
|
+
logger19.info(`Created router configuration: ${routerPath}`);
|
|
5361
5453
|
const appPath = join18(srcDir, `App.${extension}`);
|
|
5362
5454
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
5363
5455
|
if (appExists) {
|
|
@@ -5377,7 +5469,7 @@ var tanstackRouterPlugin = {
|
|
|
5377
5469
|
content: modifiedAppContent,
|
|
5378
5470
|
backup: true
|
|
5379
5471
|
});
|
|
5380
|
-
|
|
5472
|
+
logger19.info(`Updated App.${extension} with RouterProvider`);
|
|
5381
5473
|
} else {
|
|
5382
5474
|
const appContent = ctx.typescript ? getAppContentTS3() : getAppContentJS3();
|
|
5383
5475
|
await writer.createFile(appPath, appContent);
|
|
@@ -5387,7 +5479,7 @@ var tanstackRouterPlugin = {
|
|
|
5387
5479
|
content: appContent,
|
|
5388
5480
|
backup: false
|
|
5389
5481
|
});
|
|
5390
|
-
|
|
5482
|
+
logger19.info(`Created App.${extension} with RouterProvider`);
|
|
5391
5483
|
}
|
|
5392
5484
|
return {
|
|
5393
5485
|
files,
|
|
@@ -5395,7 +5487,7 @@ var tanstackRouterPlugin = {
|
|
|
5395
5487
|
message: "TanStack Router configured successfully"
|
|
5396
5488
|
};
|
|
5397
5489
|
} catch (error) {
|
|
5398
|
-
|
|
5490
|
+
logger19.error("Failed to configure TanStack Router:", error);
|
|
5399
5491
|
return {
|
|
5400
5492
|
files,
|
|
5401
5493
|
success: false,
|
|
@@ -5410,9 +5502,9 @@ var tanstackRouterPlugin = {
|
|
|
5410
5502
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
5411
5503
|
try {
|
|
5412
5504
|
await backupManager.restoreAll();
|
|
5413
|
-
|
|
5505
|
+
logger19.info("TanStack Router configuration rolled back");
|
|
5414
5506
|
} catch (error) {
|
|
5415
|
-
|
|
5507
|
+
logger19.error("Failed to rollback TanStack Router configuration:", error);
|
|
5416
5508
|
throw error;
|
|
5417
5509
|
}
|
|
5418
5510
|
}
|
|
@@ -5648,7 +5740,7 @@ export default App
|
|
|
5648
5740
|
}
|
|
5649
5741
|
function injectRouterProvider2(content, isTypeScript) {
|
|
5650
5742
|
if (content.includes("RouterProvider")) {
|
|
5651
|
-
|
|
5743
|
+
logger19.warn("RouterProvider already present in App file");
|
|
5652
5744
|
return content;
|
|
5653
5745
|
}
|
|
5654
5746
|
const hasRouterImport = content.includes("from '@tanstack/react-router'") || content.includes('from "@tanstack/react-router"');
|
|
@@ -5749,6 +5841,7 @@ export default App
|
|
|
5749
5841
|
|
|
5750
5842
|
// src/plugins/routing/vue-router.ts
|
|
5751
5843
|
import { resolve as resolve12, join as join19 } from "path";
|
|
5844
|
+
var logger20 = getModuleLogger();
|
|
5752
5845
|
var vueRouterPlugin = {
|
|
5753
5846
|
name: "vue-router",
|
|
5754
5847
|
displayName: "Vue Router",
|
|
@@ -5767,7 +5860,7 @@ var vueRouterPlugin = {
|
|
|
5767
5860
|
*/
|
|
5768
5861
|
async install(ctx) {
|
|
5769
5862
|
if (this.detect?.(ctx)) {
|
|
5770
|
-
|
|
5863
|
+
logger20.info("Vue Router is already installed");
|
|
5771
5864
|
return {
|
|
5772
5865
|
packages: {},
|
|
5773
5866
|
success: true,
|
|
@@ -5783,7 +5876,7 @@ var vueRouterPlugin = {
|
|
|
5783
5876
|
exact: false,
|
|
5784
5877
|
silent: false
|
|
5785
5878
|
});
|
|
5786
|
-
|
|
5879
|
+
logger20.info("Successfully installed Vue Router v4");
|
|
5787
5880
|
return {
|
|
5788
5881
|
packages: {
|
|
5789
5882
|
dependencies: packages
|
|
@@ -5792,7 +5885,7 @@ var vueRouterPlugin = {
|
|
|
5792
5885
|
message: `Installed ${packages.join(", ")}`
|
|
5793
5886
|
};
|
|
5794
5887
|
} catch (error) {
|
|
5795
|
-
|
|
5888
|
+
logger20.error("Failed to install Vue Router:", error);
|
|
5796
5889
|
return {
|
|
5797
5890
|
packages: {},
|
|
5798
5891
|
success: false,
|
|
@@ -5832,7 +5925,7 @@ var vueRouterPlugin = {
|
|
|
5832
5925
|
content: routerIndexContent,
|
|
5833
5926
|
backup: false
|
|
5834
5927
|
});
|
|
5835
|
-
|
|
5928
|
+
logger20.info(`Created router configuration: ${routerIndexPath}`);
|
|
5836
5929
|
const homeViewPath = join19(viewsDir, "HomeView.vue");
|
|
5837
5930
|
const vueApi = ctx.vueApi || "composition";
|
|
5838
5931
|
const homeViewContent = getHomeViewContent(vueApi);
|
|
@@ -5843,7 +5936,7 @@ var vueRouterPlugin = {
|
|
|
5843
5936
|
content: homeViewContent,
|
|
5844
5937
|
backup: false
|
|
5845
5938
|
});
|
|
5846
|
-
|
|
5939
|
+
logger20.info(`Created HomeView: ${homeViewPath}`);
|
|
5847
5940
|
const aboutViewPath = join19(viewsDir, "AboutView.vue");
|
|
5848
5941
|
const aboutViewContent = getAboutViewContent(vueApi);
|
|
5849
5942
|
await writer.createFile(aboutViewPath, aboutViewContent);
|
|
@@ -5853,7 +5946,7 @@ var vueRouterPlugin = {
|
|
|
5853
5946
|
content: aboutViewContent,
|
|
5854
5947
|
backup: false
|
|
5855
5948
|
});
|
|
5856
|
-
|
|
5949
|
+
logger20.info(`Created AboutView: ${aboutViewPath}`);
|
|
5857
5950
|
const mainPath = join19(srcDir, `main.${extension}`);
|
|
5858
5951
|
if (await checkPathExists(mainPath, ctx.fsAdapter)) {
|
|
5859
5952
|
const mainContent = await readFileContent(
|
|
@@ -5870,10 +5963,10 @@ var vueRouterPlugin = {
|
|
|
5870
5963
|
content: updatedMainContent,
|
|
5871
5964
|
backup: true
|
|
5872
5965
|
});
|
|
5873
|
-
|
|
5966
|
+
logger20.info(`Updated main file: ${mainPath}`);
|
|
5874
5967
|
}
|
|
5875
5968
|
} else {
|
|
5876
|
-
|
|
5969
|
+
logger20.warn(`Main file not found: ${mainPath}`);
|
|
5877
5970
|
}
|
|
5878
5971
|
const appPath = join19(srcDir, "App.vue");
|
|
5879
5972
|
if (await checkPathExists(appPath, ctx.fsAdapter)) {
|
|
@@ -5891,10 +5984,10 @@ var vueRouterPlugin = {
|
|
|
5891
5984
|
content: updatedAppContent,
|
|
5892
5985
|
backup: true
|
|
5893
5986
|
});
|
|
5894
|
-
|
|
5987
|
+
logger20.info(`Updated App.vue: ${appPath}`);
|
|
5895
5988
|
}
|
|
5896
5989
|
} else {
|
|
5897
|
-
|
|
5990
|
+
logger20.warn(`App.vue not found: ${appPath}`);
|
|
5898
5991
|
}
|
|
5899
5992
|
return {
|
|
5900
5993
|
files,
|
|
@@ -5902,7 +5995,7 @@ var vueRouterPlugin = {
|
|
|
5902
5995
|
message: "Vue Router configured successfully"
|
|
5903
5996
|
};
|
|
5904
5997
|
} catch (error) {
|
|
5905
|
-
|
|
5998
|
+
logger20.error("Failed to configure Vue Router:", error);
|
|
5906
5999
|
return {
|
|
5907
6000
|
files,
|
|
5908
6001
|
success: false,
|
|
@@ -5916,7 +6009,7 @@ var vueRouterPlugin = {
|
|
|
5916
6009
|
async rollback(_ctx) {
|
|
5917
6010
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
5918
6011
|
await backupManager.restoreAll();
|
|
5919
|
-
|
|
6012
|
+
logger20.info("Vue Router configuration rolled back");
|
|
5920
6013
|
}
|
|
5921
6014
|
};
|
|
5922
6015
|
function getRouterIndexContentTS() {
|
|
@@ -6062,7 +6155,7 @@ function updateMainFile(content, isTypeScript) {
|
|
|
6062
6155
|
const routerImport = isTypeScript ? "import router from './router'\n" : "import router from './router'\n";
|
|
6063
6156
|
const createAppMatch = content.match(/createApp\([^)]+\)/);
|
|
6064
6157
|
if (!createAppMatch) {
|
|
6065
|
-
|
|
6158
|
+
logger20.warn("Could not find createApp in main file");
|
|
6066
6159
|
return content;
|
|
6067
6160
|
}
|
|
6068
6161
|
const importRegex = /(import\s+.*?from\s+['"].*?['"];?\s*\n)/g;
|
|
@@ -6130,8 +6223,87 @@ function updateAppFile(content) {
|
|
|
6130
6223
|
return content;
|
|
6131
6224
|
}
|
|
6132
6225
|
|
|
6226
|
+
// src/plugins/routing/sveltekit.ts
|
|
6227
|
+
var logger21 = getModuleLogger();
|
|
6228
|
+
var svelteKitPlugin = {
|
|
6229
|
+
name: "@sveltejs/kit",
|
|
6230
|
+
displayName: "SvelteKit",
|
|
6231
|
+
description: "Framework fullstack pour Svelte avec routing int\xE9gr\xE9",
|
|
6232
|
+
category: "routing" /* ROUTING */,
|
|
6233
|
+
version: "^2.5.0",
|
|
6234
|
+
frameworks: ["svelte"],
|
|
6235
|
+
/**
|
|
6236
|
+
* Détecte si SvelteKit est déjà installé
|
|
6237
|
+
*/
|
|
6238
|
+
detect: (ctx) => {
|
|
6239
|
+
return ctx.dependencies["@sveltejs/kit"] !== void 0;
|
|
6240
|
+
},
|
|
6241
|
+
/**
|
|
6242
|
+
* Installe SvelteKit
|
|
6243
|
+
*/
|
|
6244
|
+
async install(ctx) {
|
|
6245
|
+
if (this.detect?.(ctx)) {
|
|
6246
|
+
logger21.info("SvelteKit is already installed");
|
|
6247
|
+
return {
|
|
6248
|
+
packages: {},
|
|
6249
|
+
success: true,
|
|
6250
|
+
message: "SvelteKit already installed"
|
|
6251
|
+
};
|
|
6252
|
+
}
|
|
6253
|
+
try {
|
|
6254
|
+
const packages = ["@sveltejs/kit", "@sveltejs/adapter-auto"];
|
|
6255
|
+
await installPackages(packages, {
|
|
6256
|
+
dev: false,
|
|
6257
|
+
packageManager: ctx.packageManager,
|
|
6258
|
+
projectRoot: ctx.projectRoot,
|
|
6259
|
+
exact: false,
|
|
6260
|
+
silent: false
|
|
6261
|
+
});
|
|
6262
|
+
logger21.info(`Installed ${packages.length} package(s)`);
|
|
6263
|
+
return {
|
|
6264
|
+
packages: {
|
|
6265
|
+
dependencies: packages
|
|
6266
|
+
},
|
|
6267
|
+
success: true,
|
|
6268
|
+
message: "SvelteKit installed successfully"
|
|
6269
|
+
};
|
|
6270
|
+
} catch (error) {
|
|
6271
|
+
logger21.error(`Failed to install SvelteKit: ${String(error)}`);
|
|
6272
|
+
return {
|
|
6273
|
+
packages: {},
|
|
6274
|
+
success: false,
|
|
6275
|
+
message: `Installation failed: ${String(error)}`
|
|
6276
|
+
};
|
|
6277
|
+
}
|
|
6278
|
+
},
|
|
6279
|
+
/**
|
|
6280
|
+
* Configure SvelteKit
|
|
6281
|
+
*/
|
|
6282
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
6283
|
+
async configure(_ctx) {
|
|
6284
|
+
try {
|
|
6285
|
+
logger21.info(
|
|
6286
|
+
"SvelteKit configuration: Already integrated in vite.config.ts"
|
|
6287
|
+
);
|
|
6288
|
+
return {
|
|
6289
|
+
success: true,
|
|
6290
|
+
message: "SvelteKit configuration already set up",
|
|
6291
|
+
files: []
|
|
6292
|
+
};
|
|
6293
|
+
} catch (error) {
|
|
6294
|
+
logger21.error(`Configuration failed: ${String(error)}`);
|
|
6295
|
+
return {
|
|
6296
|
+
success: false,
|
|
6297
|
+
message: `Configuration failed: ${String(error)}`,
|
|
6298
|
+
files: []
|
|
6299
|
+
};
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
};
|
|
6303
|
+
|
|
6133
6304
|
// src/plugins/state/jotai.ts
|
|
6134
6305
|
import { resolve as resolve13, join as join20 } from "path";
|
|
6306
|
+
var logger22 = getModuleLogger();
|
|
6135
6307
|
var jotaiPlugin = {
|
|
6136
6308
|
name: "jotai",
|
|
6137
6309
|
displayName: "Jotai",
|
|
@@ -6151,7 +6323,7 @@ var jotaiPlugin = {
|
|
|
6151
6323
|
*/
|
|
6152
6324
|
async install(ctx) {
|
|
6153
6325
|
if (this.detect?.(ctx)) {
|
|
6154
|
-
|
|
6326
|
+
logger22.info("Jotai is already installed");
|
|
6155
6327
|
return {
|
|
6156
6328
|
packages: {},
|
|
6157
6329
|
success: true,
|
|
@@ -6167,7 +6339,7 @@ var jotaiPlugin = {
|
|
|
6167
6339
|
exact: false,
|
|
6168
6340
|
silent: false
|
|
6169
6341
|
});
|
|
6170
|
-
|
|
6342
|
+
logger22.info("Successfully installed Jotai");
|
|
6171
6343
|
return {
|
|
6172
6344
|
packages: {
|
|
6173
6345
|
dependencies: packages
|
|
@@ -6176,7 +6348,7 @@ var jotaiPlugin = {
|
|
|
6176
6348
|
message: `Installed ${packages.join(", ")}`
|
|
6177
6349
|
};
|
|
6178
6350
|
} catch (error) {
|
|
6179
|
-
|
|
6351
|
+
logger22.error("Failed to install Jotai:", error);
|
|
6180
6352
|
return {
|
|
6181
6353
|
packages: {},
|
|
6182
6354
|
success: false,
|
|
@@ -6197,8 +6369,7 @@ var jotaiPlugin = {
|
|
|
6197
6369
|
* Documentation : https://jotai.org/docs/core/atom
|
|
6198
6370
|
*/
|
|
6199
6371
|
async configure(ctx) {
|
|
6200
|
-
const
|
|
6201
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
6372
|
+
const { writer } = getPluginServices(ctx);
|
|
6202
6373
|
const files = [];
|
|
6203
6374
|
const srcDir = resolve13(ctx.projectRoot, ctx.srcDir);
|
|
6204
6375
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -6214,7 +6385,7 @@ var jotaiPlugin = {
|
|
|
6214
6385
|
content: atomsContent,
|
|
6215
6386
|
backup: false
|
|
6216
6387
|
});
|
|
6217
|
-
|
|
6388
|
+
logger22.info(`Created atoms file: ${atomsPath}`);
|
|
6218
6389
|
const indexPath = join20(storeDir, `index.${extension}`);
|
|
6219
6390
|
const indexContent = ctx.typescript ? getIndexContentTS5() : getIndexContentJS5();
|
|
6220
6391
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -6224,7 +6395,7 @@ var jotaiPlugin = {
|
|
|
6224
6395
|
content: indexContent,
|
|
6225
6396
|
backup: false
|
|
6226
6397
|
});
|
|
6227
|
-
|
|
6398
|
+
logger22.info(`Created store index: ${indexPath}`);
|
|
6228
6399
|
const appPath = join20(srcDir, `App.${ctx.typescript ? "tsx" : "jsx"}`);
|
|
6229
6400
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
6230
6401
|
if (appExists) {
|
|
@@ -6241,7 +6412,7 @@ var jotaiPlugin = {
|
|
|
6241
6412
|
content: modifiedAppContent,
|
|
6242
6413
|
backup: true
|
|
6243
6414
|
});
|
|
6244
|
-
|
|
6415
|
+
logger22.info(
|
|
6245
6416
|
`Updated App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6246
6417
|
);
|
|
6247
6418
|
} else {
|
|
@@ -6253,7 +6424,7 @@ var jotaiPlugin = {
|
|
|
6253
6424
|
content: appContent,
|
|
6254
6425
|
backup: false
|
|
6255
6426
|
});
|
|
6256
|
-
|
|
6427
|
+
logger22.info(
|
|
6257
6428
|
`Created App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6258
6429
|
);
|
|
6259
6430
|
}
|
|
@@ -6263,7 +6434,7 @@ var jotaiPlugin = {
|
|
|
6263
6434
|
message: "Jotai configured successfully"
|
|
6264
6435
|
};
|
|
6265
6436
|
} catch (error) {
|
|
6266
|
-
|
|
6437
|
+
logger22.error("Failed to configure Jotai:", error);
|
|
6267
6438
|
return {
|
|
6268
6439
|
files,
|
|
6269
6440
|
success: false,
|
|
@@ -6275,12 +6446,12 @@ var jotaiPlugin = {
|
|
|
6275
6446
|
* Rollback de la configuration Jotai
|
|
6276
6447
|
*/
|
|
6277
6448
|
async rollback(_ctx) {
|
|
6278
|
-
const backupManager =
|
|
6449
|
+
const backupManager = getRollbackManager(_ctx);
|
|
6279
6450
|
try {
|
|
6280
6451
|
await backupManager.restoreAll();
|
|
6281
|
-
|
|
6452
|
+
logger22.info("Jotai configuration rolled back");
|
|
6282
6453
|
} catch (error) {
|
|
6283
|
-
|
|
6454
|
+
logger22.error("Failed to rollback Jotai configuration:", error);
|
|
6284
6455
|
throw error;
|
|
6285
6456
|
}
|
|
6286
6457
|
}
|
|
@@ -6409,7 +6580,7 @@ export default App
|
|
|
6409
6580
|
}
|
|
6410
6581
|
function injectProvider(content, isTypeScript) {
|
|
6411
6582
|
if (content.includes("Provider") && content.includes("jotai")) {
|
|
6412
|
-
|
|
6583
|
+
logger22.warn("Jotai Provider already present in App file");
|
|
6413
6584
|
return content;
|
|
6414
6585
|
}
|
|
6415
6586
|
const hasProviderImport = content.includes("from 'jotai'") || content.includes('from "jotai"');
|
|
@@ -6481,6 +6652,7 @@ export default App
|
|
|
6481
6652
|
|
|
6482
6653
|
// src/plugins/state/pinia.ts
|
|
6483
6654
|
import { resolve as resolve14, join as join21 } from "path";
|
|
6655
|
+
var logger23 = getModuleLogger();
|
|
6484
6656
|
var piniaPlugin = {
|
|
6485
6657
|
name: "pinia",
|
|
6486
6658
|
displayName: "Pinia",
|
|
@@ -6499,7 +6671,7 @@ var piniaPlugin = {
|
|
|
6499
6671
|
*/
|
|
6500
6672
|
async install(ctx) {
|
|
6501
6673
|
if (this.detect?.(ctx)) {
|
|
6502
|
-
|
|
6674
|
+
logger23.info("Pinia is already installed");
|
|
6503
6675
|
return {
|
|
6504
6676
|
packages: {},
|
|
6505
6677
|
success: true,
|
|
@@ -6507,7 +6679,7 @@ var piniaPlugin = {
|
|
|
6507
6679
|
};
|
|
6508
6680
|
}
|
|
6509
6681
|
if (ctx.vueVersion !== "3") {
|
|
6510
|
-
|
|
6682
|
+
logger23.error("Pinia requires Vue 3");
|
|
6511
6683
|
return {
|
|
6512
6684
|
packages: {},
|
|
6513
6685
|
success: false,
|
|
@@ -6523,7 +6695,7 @@ var piniaPlugin = {
|
|
|
6523
6695
|
exact: false,
|
|
6524
6696
|
silent: false
|
|
6525
6697
|
});
|
|
6526
|
-
|
|
6698
|
+
logger23.info("Successfully installed Pinia");
|
|
6527
6699
|
return {
|
|
6528
6700
|
packages: {
|
|
6529
6701
|
dependencies: packages
|
|
@@ -6532,7 +6704,7 @@ var piniaPlugin = {
|
|
|
6532
6704
|
message: `Installed ${packages.join(", ")}`
|
|
6533
6705
|
};
|
|
6534
6706
|
} catch (error) {
|
|
6535
|
-
|
|
6707
|
+
logger23.error("Failed to install Pinia:", error);
|
|
6536
6708
|
return {
|
|
6537
6709
|
packages: {},
|
|
6538
6710
|
success: false,
|
|
@@ -6551,8 +6723,7 @@ var piniaPlugin = {
|
|
|
6551
6723
|
* - src/main.ts (ou main.js) : Intègre Pinia
|
|
6552
6724
|
*/
|
|
6553
6725
|
async configure(ctx) {
|
|
6554
|
-
const
|
|
6555
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
6726
|
+
const { writer } = getPluginServices(ctx);
|
|
6556
6727
|
const files = [];
|
|
6557
6728
|
const srcDir = resolve14(ctx.projectRoot, ctx.srcDir);
|
|
6558
6729
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -6568,7 +6739,7 @@ var piniaPlugin = {
|
|
|
6568
6739
|
content: storesIndexContent,
|
|
6569
6740
|
backup: false
|
|
6570
6741
|
});
|
|
6571
|
-
|
|
6742
|
+
logger23.info(`Created Pinia stores index: ${storesIndexPath}`);
|
|
6572
6743
|
const counterStorePath = join21(storesDir, `counter.${extension}`);
|
|
6573
6744
|
const counterStoreContent = ctx.typescript ? getCounterStoreContentTS(ctx.vueApi) : getCounterStoreContentJS(ctx.vueApi);
|
|
6574
6745
|
await writer.createFile(counterStorePath, counterStoreContent);
|
|
@@ -6578,7 +6749,7 @@ var piniaPlugin = {
|
|
|
6578
6749
|
content: counterStoreContent,
|
|
6579
6750
|
backup: false
|
|
6580
6751
|
});
|
|
6581
|
-
|
|
6752
|
+
logger23.info(`Created counter store: ${counterStorePath}`);
|
|
6582
6753
|
const mainPath = join21(srcDir, `main.${extension}`);
|
|
6583
6754
|
if (await checkPathExists(mainPath, ctx.fsAdapter)) {
|
|
6584
6755
|
const mainContent = await readFileContent(
|
|
@@ -6595,10 +6766,10 @@ var piniaPlugin = {
|
|
|
6595
6766
|
content: updatedMainContent,
|
|
6596
6767
|
backup: true
|
|
6597
6768
|
});
|
|
6598
|
-
|
|
6769
|
+
logger23.info(`Updated main file: ${mainPath}`);
|
|
6599
6770
|
}
|
|
6600
6771
|
} else {
|
|
6601
|
-
|
|
6772
|
+
logger23.warn(`Main file not found: ${mainPath}`);
|
|
6602
6773
|
}
|
|
6603
6774
|
return {
|
|
6604
6775
|
files,
|
|
@@ -6606,7 +6777,7 @@ var piniaPlugin = {
|
|
|
6606
6777
|
message: "Pinia configured successfully"
|
|
6607
6778
|
};
|
|
6608
6779
|
} catch (error) {
|
|
6609
|
-
|
|
6780
|
+
logger23.error("Failed to configure Pinia:", error);
|
|
6610
6781
|
return {
|
|
6611
6782
|
files,
|
|
6612
6783
|
success: false,
|
|
@@ -6618,9 +6789,9 @@ var piniaPlugin = {
|
|
|
6618
6789
|
* Rollback de la configuration Pinia
|
|
6619
6790
|
*/
|
|
6620
6791
|
async rollback(_ctx) {
|
|
6621
|
-
const backupManager =
|
|
6792
|
+
const backupManager = getRollbackManager(_ctx);
|
|
6622
6793
|
await backupManager.restoreAll();
|
|
6623
|
-
|
|
6794
|
+
logger23.info("Pinia configuration rolled back");
|
|
6624
6795
|
}
|
|
6625
6796
|
};
|
|
6626
6797
|
function getStoresIndexContentTS() {
|
|
@@ -6736,7 +6907,7 @@ function updateMainFile2(content, isTypeScript) {
|
|
|
6736
6907
|
const piniaImport = isTypeScript ? "import pinia from './stores'\n" : "import pinia from './stores'\n";
|
|
6737
6908
|
const createAppMatch = content.match(/createApp\([^)]+\)/);
|
|
6738
6909
|
if (!createAppMatch) {
|
|
6739
|
-
|
|
6910
|
+
logger23.warn("Could not find createApp in main file");
|
|
6740
6911
|
return content;
|
|
6741
6912
|
}
|
|
6742
6913
|
const importRegex = /(import\s+.*?from\s+['"].*?['"];?\s*\n)/g;
|
|
@@ -6758,6 +6929,7 @@ app.use(pinia)`
|
|
|
6758
6929
|
|
|
6759
6930
|
// src/plugins/state/redux-toolkit.ts
|
|
6760
6931
|
import { resolve as resolve15, join as join22 } from "path";
|
|
6932
|
+
var logger24 = getModuleLogger();
|
|
6761
6933
|
var reduxToolkitPlugin = {
|
|
6762
6934
|
name: "@reduxjs/toolkit",
|
|
6763
6935
|
displayName: "Redux Toolkit",
|
|
@@ -6777,7 +6949,7 @@ var reduxToolkitPlugin = {
|
|
|
6777
6949
|
*/
|
|
6778
6950
|
async install(ctx) {
|
|
6779
6951
|
if (this.detect?.(ctx)) {
|
|
6780
|
-
|
|
6952
|
+
logger24.info("Redux Toolkit is already installed");
|
|
6781
6953
|
return {
|
|
6782
6954
|
packages: {},
|
|
6783
6955
|
success: true,
|
|
@@ -6796,7 +6968,7 @@ var reduxToolkitPlugin = {
|
|
|
6796
6968
|
exact: false,
|
|
6797
6969
|
silent: false
|
|
6798
6970
|
});
|
|
6799
|
-
|
|
6971
|
+
logger24.info("Successfully installed Redux Toolkit");
|
|
6800
6972
|
return {
|
|
6801
6973
|
packages: {
|
|
6802
6974
|
dependencies: packages
|
|
@@ -6805,7 +6977,7 @@ var reduxToolkitPlugin = {
|
|
|
6805
6977
|
message: `Installed ${packages.join(", ")}`
|
|
6806
6978
|
};
|
|
6807
6979
|
} catch (error) {
|
|
6808
|
-
|
|
6980
|
+
logger24.error("Failed to install Redux Toolkit:", error);
|
|
6809
6981
|
return {
|
|
6810
6982
|
packages: {},
|
|
6811
6983
|
success: false,
|
|
@@ -6826,8 +6998,7 @@ var reduxToolkitPlugin = {
|
|
|
6826
6998
|
* Documentation : https://redux-toolkit.js.org/introduction/getting-started
|
|
6827
6999
|
*/
|
|
6828
7000
|
async configure(ctx) {
|
|
6829
|
-
const
|
|
6830
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
7001
|
+
const { writer } = getPluginServices(ctx);
|
|
6831
7002
|
const files = [];
|
|
6832
7003
|
const srcDir = resolve15(ctx.projectRoot, ctx.srcDir);
|
|
6833
7004
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -6845,7 +7016,7 @@ var reduxToolkitPlugin = {
|
|
|
6845
7016
|
content: sliceContent,
|
|
6846
7017
|
backup: false
|
|
6847
7018
|
});
|
|
6848
|
-
|
|
7019
|
+
logger24.info(`Created counter slice: ${slicePath}`);
|
|
6849
7020
|
const storePath = join22(storeDir, `index.${extension}`);
|
|
6850
7021
|
const storeContent = ctx.typescript ? getStoreContentTS() : getStoreContentJS();
|
|
6851
7022
|
await writer.createFile(storePath, storeContent);
|
|
@@ -6855,7 +7026,7 @@ var reduxToolkitPlugin = {
|
|
|
6855
7026
|
content: storeContent,
|
|
6856
7027
|
backup: false
|
|
6857
7028
|
});
|
|
6858
|
-
|
|
7029
|
+
logger24.info(`Created Redux store: ${storePath}`);
|
|
6859
7030
|
if (ctx.typescript) {
|
|
6860
7031
|
const hooksPath = join22(storeDir, "hooks.ts");
|
|
6861
7032
|
const hooksContent = getTypedHooksContentTS();
|
|
@@ -6866,7 +7037,7 @@ var reduxToolkitPlugin = {
|
|
|
6866
7037
|
content: hooksContent,
|
|
6867
7038
|
backup: false
|
|
6868
7039
|
});
|
|
6869
|
-
|
|
7040
|
+
logger24.info(`Created typed hooks: ${hooksPath}`);
|
|
6870
7041
|
}
|
|
6871
7042
|
const appPath = join22(srcDir, `App.${ctx.typescript ? "tsx" : "jsx"}`);
|
|
6872
7043
|
const appExists = await checkPathExists(appPath, ctx.fsAdapter);
|
|
@@ -6884,7 +7055,7 @@ var reduxToolkitPlugin = {
|
|
|
6884
7055
|
content: modifiedAppContent,
|
|
6885
7056
|
backup: true
|
|
6886
7057
|
});
|
|
6887
|
-
|
|
7058
|
+
logger24.info(
|
|
6888
7059
|
`Updated App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6889
7060
|
);
|
|
6890
7061
|
} else {
|
|
@@ -6896,7 +7067,7 @@ var reduxToolkitPlugin = {
|
|
|
6896
7067
|
content: appContent,
|
|
6897
7068
|
backup: false
|
|
6898
7069
|
});
|
|
6899
|
-
|
|
7070
|
+
logger24.info(
|
|
6900
7071
|
`Created App.${ctx.typescript ? "tsx" : "jsx"} with Provider`
|
|
6901
7072
|
);
|
|
6902
7073
|
}
|
|
@@ -6906,7 +7077,7 @@ var reduxToolkitPlugin = {
|
|
|
6906
7077
|
message: "Redux Toolkit configured successfully"
|
|
6907
7078
|
};
|
|
6908
7079
|
} catch (error) {
|
|
6909
|
-
|
|
7080
|
+
logger24.error("Failed to configure Redux Toolkit:", error);
|
|
6910
7081
|
return {
|
|
6911
7082
|
files,
|
|
6912
7083
|
success: false,
|
|
@@ -6918,12 +7089,12 @@ var reduxToolkitPlugin = {
|
|
|
6918
7089
|
* Rollback de la configuration Redux Toolkit
|
|
6919
7090
|
*/
|
|
6920
7091
|
async rollback(_ctx) {
|
|
6921
|
-
const backupManager =
|
|
7092
|
+
const backupManager = getRollbackManager(_ctx);
|
|
6922
7093
|
try {
|
|
6923
7094
|
await backupManager.restoreAll();
|
|
6924
|
-
|
|
7095
|
+
logger24.info("Redux Toolkit configuration rolled back");
|
|
6925
7096
|
} catch (error) {
|
|
6926
|
-
|
|
7097
|
+
logger24.error("Failed to rollback Redux Toolkit configuration:", error);
|
|
6927
7098
|
throw error;
|
|
6928
7099
|
}
|
|
6929
7100
|
}
|
|
@@ -7133,7 +7304,7 @@ export default App
|
|
|
7133
7304
|
}
|
|
7134
7305
|
function injectProvider2(content, isTypeScript) {
|
|
7135
7306
|
if (content.includes("<Provider")) {
|
|
7136
|
-
|
|
7307
|
+
logger24.warn("Provider already present in App file");
|
|
7137
7308
|
return content;
|
|
7138
7309
|
}
|
|
7139
7310
|
const hasReactReduxImport = content.includes("from 'react-redux'") || content.includes('from "react-redux"');
|
|
@@ -7228,6 +7399,7 @@ export default App
|
|
|
7228
7399
|
|
|
7229
7400
|
// src/plugins/state/zustand.ts
|
|
7230
7401
|
import { resolve as resolve16, join as join23 } from "path";
|
|
7402
|
+
var logger25 = getModuleLogger();
|
|
7231
7403
|
var zustandPlugin = {
|
|
7232
7404
|
name: "zustand",
|
|
7233
7405
|
displayName: "Zustand",
|
|
@@ -7247,7 +7419,7 @@ var zustandPlugin = {
|
|
|
7247
7419
|
*/
|
|
7248
7420
|
async install(ctx) {
|
|
7249
7421
|
if (this.detect?.(ctx)) {
|
|
7250
|
-
|
|
7422
|
+
logger25.info("Zustand is already installed");
|
|
7251
7423
|
return {
|
|
7252
7424
|
packages: {},
|
|
7253
7425
|
success: true,
|
|
@@ -7263,7 +7435,7 @@ var zustandPlugin = {
|
|
|
7263
7435
|
exact: false,
|
|
7264
7436
|
silent: false
|
|
7265
7437
|
});
|
|
7266
|
-
|
|
7438
|
+
logger25.info("Successfully installed Zustand");
|
|
7267
7439
|
return {
|
|
7268
7440
|
packages: {
|
|
7269
7441
|
dependencies: packages
|
|
@@ -7272,7 +7444,7 @@ var zustandPlugin = {
|
|
|
7272
7444
|
message: `Installed ${packages.join(", ")}`
|
|
7273
7445
|
};
|
|
7274
7446
|
} catch (error) {
|
|
7275
|
-
|
|
7447
|
+
logger25.error("Failed to install Zustand:", error);
|
|
7276
7448
|
return {
|
|
7277
7449
|
packages: {},
|
|
7278
7450
|
success: false,
|
|
@@ -7290,8 +7462,7 @@ var zustandPlugin = {
|
|
|
7290
7462
|
* Documentation : https://zustand.docs.pmnd.rs/getting-started/introduction
|
|
7291
7463
|
*/
|
|
7292
7464
|
async configure(ctx) {
|
|
7293
|
-
const
|
|
7294
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
7465
|
+
const { writer } = getPluginServices(ctx);
|
|
7295
7466
|
const files = [];
|
|
7296
7467
|
const srcDir = resolve16(ctx.projectRoot, ctx.srcDir);
|
|
7297
7468
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -7307,7 +7478,7 @@ var zustandPlugin = {
|
|
|
7307
7478
|
content: storeContent,
|
|
7308
7479
|
backup: false
|
|
7309
7480
|
});
|
|
7310
|
-
|
|
7481
|
+
logger25.info(`Created Zustand store: ${storePath}`);
|
|
7311
7482
|
if (ctx.typescript) {
|
|
7312
7483
|
const hookPath = join23(storeDir, "useStore.ts");
|
|
7313
7484
|
const hookContent = getTypedHookContentTS();
|
|
@@ -7318,7 +7489,7 @@ var zustandPlugin = {
|
|
|
7318
7489
|
content: hookContent,
|
|
7319
7490
|
backup: false
|
|
7320
7491
|
});
|
|
7321
|
-
|
|
7492
|
+
logger25.info(`Created typed hook example: ${hookPath}`);
|
|
7322
7493
|
}
|
|
7323
7494
|
return {
|
|
7324
7495
|
files,
|
|
@@ -7326,7 +7497,7 @@ var zustandPlugin = {
|
|
|
7326
7497
|
message: "Zustand configured successfully"
|
|
7327
7498
|
};
|
|
7328
7499
|
} catch (error) {
|
|
7329
|
-
|
|
7500
|
+
logger25.error("Failed to configure Zustand:", error);
|
|
7330
7501
|
return {
|
|
7331
7502
|
files,
|
|
7332
7503
|
success: false,
|
|
@@ -7338,12 +7509,12 @@ var zustandPlugin = {
|
|
|
7338
7509
|
* Rollback de la configuration Zustand
|
|
7339
7510
|
*/
|
|
7340
7511
|
async rollback(_ctx) {
|
|
7341
|
-
const backupManager =
|
|
7512
|
+
const backupManager = getRollbackManager(_ctx);
|
|
7342
7513
|
try {
|
|
7343
7514
|
await backupManager.restoreAll();
|
|
7344
|
-
|
|
7515
|
+
logger25.info("Zustand configuration rolled back");
|
|
7345
7516
|
} catch (error) {
|
|
7346
|
-
|
|
7517
|
+
logger25.error("Failed to rollback Zustand configuration:", error);
|
|
7347
7518
|
throw error;
|
|
7348
7519
|
}
|
|
7349
7520
|
}
|
|
@@ -7438,6 +7609,7 @@ export const useRemoveAllBears = () =>
|
|
|
7438
7609
|
|
|
7439
7610
|
// src/plugins/testing/react-testing-library.ts
|
|
7440
7611
|
import { join as join24 } from "path";
|
|
7612
|
+
var logger26 = getModuleLogger();
|
|
7441
7613
|
var reactTestingLibraryPlugin = {
|
|
7442
7614
|
name: "react-testing-library",
|
|
7443
7615
|
displayName: "React Testing Library",
|
|
@@ -7456,7 +7628,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7456
7628
|
*/
|
|
7457
7629
|
async install(ctx) {
|
|
7458
7630
|
if (this.detect?.(ctx)) {
|
|
7459
|
-
|
|
7631
|
+
logger26.info("React Testing Library is already installed");
|
|
7460
7632
|
return {
|
|
7461
7633
|
packages: {},
|
|
7462
7634
|
success: true,
|
|
@@ -7476,7 +7648,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7476
7648
|
exact: false,
|
|
7477
7649
|
silent: false
|
|
7478
7650
|
});
|
|
7479
|
-
|
|
7651
|
+
logger26.info("Successfully installed React Testing Library");
|
|
7480
7652
|
return {
|
|
7481
7653
|
packages: {
|
|
7482
7654
|
devDependencies: packages
|
|
@@ -7485,7 +7657,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7485
7657
|
message: `Installed React Testing Library: ${packages.join(", ")}`
|
|
7486
7658
|
};
|
|
7487
7659
|
} catch (error) {
|
|
7488
|
-
|
|
7660
|
+
logger26.error("Failed to install React Testing Library:", error);
|
|
7489
7661
|
return {
|
|
7490
7662
|
packages: {},
|
|
7491
7663
|
success: false,
|
|
@@ -7526,7 +7698,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7526
7698
|
content: setupTestsContent,
|
|
7527
7699
|
backup: false
|
|
7528
7700
|
});
|
|
7529
|
-
|
|
7701
|
+
logger26.info(`Created setupTests file: ${setupTestsPath}`);
|
|
7530
7702
|
}
|
|
7531
7703
|
const testDir = join24(srcDir, "components", "__tests__");
|
|
7532
7704
|
await ensureDirectory(testDir, ctx.fsAdapter);
|
|
@@ -7547,7 +7719,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7547
7719
|
content: exampleTestContent,
|
|
7548
7720
|
backup: false
|
|
7549
7721
|
});
|
|
7550
|
-
|
|
7722
|
+
logger26.info(`Created example test: ${exampleTestPath}`);
|
|
7551
7723
|
}
|
|
7552
7724
|
const vitestConfigPath = join24(projectRoot, "vitest.config.ts");
|
|
7553
7725
|
const vitestConfigExists = await checkPathExists(
|
|
@@ -7555,7 +7727,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7555
7727
|
ctx.fsAdapter
|
|
7556
7728
|
);
|
|
7557
7729
|
if (vitestConfigExists) {
|
|
7558
|
-
|
|
7730
|
+
logger26.info(
|
|
7559
7731
|
"vitest.config.ts found. Make sure to add setupFiles if needed."
|
|
7560
7732
|
);
|
|
7561
7733
|
}
|
|
@@ -7565,7 +7737,7 @@ var reactTestingLibraryPlugin = {
|
|
|
7565
7737
|
message: "React Testing Library configured successfully"
|
|
7566
7738
|
};
|
|
7567
7739
|
} catch (error) {
|
|
7568
|
-
|
|
7740
|
+
logger26.error("Failed to configure React Testing Library:", error);
|
|
7569
7741
|
await backupManager.restoreAll();
|
|
7570
7742
|
return {
|
|
7571
7743
|
files,
|
|
@@ -7581,9 +7753,9 @@ var reactTestingLibraryPlugin = {
|
|
|
7581
7753
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
7582
7754
|
try {
|
|
7583
7755
|
await backupManager.restoreAll();
|
|
7584
|
-
|
|
7756
|
+
logger26.info("React Testing Library configuration rolled back");
|
|
7585
7757
|
} catch (error) {
|
|
7586
|
-
|
|
7758
|
+
logger26.error(
|
|
7587
7759
|
"Failed to rollback React Testing Library configuration:",
|
|
7588
7760
|
error
|
|
7589
7761
|
);
|
|
@@ -7672,6 +7844,7 @@ describe('Example Component', () => {
|
|
|
7672
7844
|
|
|
7673
7845
|
// src/plugins/testing/vue-testing-library.ts
|
|
7674
7846
|
import { join as join25 } from "path";
|
|
7847
|
+
var logger27 = getModuleLogger();
|
|
7675
7848
|
var vueTestingLibraryPlugin = {
|
|
7676
7849
|
name: "@testing-library/vue",
|
|
7677
7850
|
displayName: "Testing Library (Vue)",
|
|
@@ -7690,7 +7863,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7690
7863
|
*/
|
|
7691
7864
|
async install(ctx) {
|
|
7692
7865
|
if (this.detect?.(ctx)) {
|
|
7693
|
-
|
|
7866
|
+
logger27.info("Testing Library (Vue) is already installed");
|
|
7694
7867
|
return {
|
|
7695
7868
|
packages: {},
|
|
7696
7869
|
success: true,
|
|
@@ -7710,7 +7883,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7710
7883
|
exact: false,
|
|
7711
7884
|
silent: false
|
|
7712
7885
|
});
|
|
7713
|
-
|
|
7886
|
+
logger27.info("Successfully installed Testing Library (Vue)");
|
|
7714
7887
|
return {
|
|
7715
7888
|
packages: {
|
|
7716
7889
|
devDependencies: packages
|
|
@@ -7719,7 +7892,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7719
7892
|
message: `Installed Testing Library (Vue): ${packages.join(", ")}`
|
|
7720
7893
|
};
|
|
7721
7894
|
} catch (error) {
|
|
7722
|
-
|
|
7895
|
+
logger27.error("Failed to install Testing Library (Vue):", error);
|
|
7723
7896
|
return {
|
|
7724
7897
|
packages: {},
|
|
7725
7898
|
success: false,
|
|
@@ -7754,7 +7927,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7754
7927
|
content: setupContent,
|
|
7755
7928
|
backup: false
|
|
7756
7929
|
});
|
|
7757
|
-
|
|
7930
|
+
logger27.info(`Created test setup: ${setupPath}`);
|
|
7758
7931
|
}
|
|
7759
7932
|
const testDir = join25(srcDir, "components", "__tests__");
|
|
7760
7933
|
await ensureDirectory(testDir, ctx.fsAdapter);
|
|
@@ -7772,7 +7945,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7772
7945
|
content: testContent,
|
|
7773
7946
|
backup: false
|
|
7774
7947
|
});
|
|
7775
|
-
|
|
7948
|
+
logger27.info(`Created example test: ${testPath}`);
|
|
7776
7949
|
}
|
|
7777
7950
|
const vitestConfigPath = join25(projectRoot, "vitest.config.ts");
|
|
7778
7951
|
const vitestConfigExists = await checkPathExists(
|
|
@@ -7780,7 +7953,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7780
7953
|
ctx.fsAdapter
|
|
7781
7954
|
);
|
|
7782
7955
|
if (vitestConfigExists) {
|
|
7783
|
-
|
|
7956
|
+
logger27.info(
|
|
7784
7957
|
"vitest.config.ts found. Make sure to add setupFiles if needed."
|
|
7785
7958
|
);
|
|
7786
7959
|
}
|
|
@@ -7790,7 +7963,7 @@ var vueTestingLibraryPlugin = {
|
|
|
7790
7963
|
message: "Testing Library (Vue) configured successfully"
|
|
7791
7964
|
};
|
|
7792
7965
|
} catch (error) {
|
|
7793
|
-
|
|
7966
|
+
logger27.error("Failed to configure Testing Library (Vue):", error);
|
|
7794
7967
|
await backupManager.restoreAll();
|
|
7795
7968
|
return {
|
|
7796
7969
|
files,
|
|
@@ -7806,9 +7979,9 @@ var vueTestingLibraryPlugin = {
|
|
|
7806
7979
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
7807
7980
|
try {
|
|
7808
7981
|
await backupManager.restoreAll();
|
|
7809
|
-
|
|
7982
|
+
logger27.info("Testing Library (Vue) configuration rolled back");
|
|
7810
7983
|
} catch (error) {
|
|
7811
|
-
|
|
7984
|
+
logger27.error("Failed to rollback Testing Library (Vue):", error);
|
|
7812
7985
|
throw error;
|
|
7813
7986
|
}
|
|
7814
7987
|
}
|
|
@@ -7854,6 +8027,7 @@ describe('Example component', () => {
|
|
|
7854
8027
|
|
|
7855
8028
|
// src/plugins/testing/vue-test-utils.ts
|
|
7856
8029
|
import { join as join26 } from "path";
|
|
8030
|
+
var logger28 = getModuleLogger();
|
|
7857
8031
|
var vueTestUtilsPlugin = {
|
|
7858
8032
|
name: "@vue/test-utils",
|
|
7859
8033
|
displayName: "Vue Test Utils",
|
|
@@ -7872,7 +8046,7 @@ var vueTestUtilsPlugin = {
|
|
|
7872
8046
|
*/
|
|
7873
8047
|
async install(ctx) {
|
|
7874
8048
|
if (this.detect?.(ctx)) {
|
|
7875
|
-
|
|
8049
|
+
logger28.info("Vue Test Utils is already installed");
|
|
7876
8050
|
return {
|
|
7877
8051
|
packages: {},
|
|
7878
8052
|
success: true,
|
|
@@ -7896,7 +8070,7 @@ var vueTestUtilsPlugin = {
|
|
|
7896
8070
|
exact: false,
|
|
7897
8071
|
silent: false
|
|
7898
8072
|
});
|
|
7899
|
-
|
|
8073
|
+
logger28.info("Successfully installed Vue Test Utils");
|
|
7900
8074
|
return {
|
|
7901
8075
|
packages: {
|
|
7902
8076
|
devDependencies: packages
|
|
@@ -7905,7 +8079,7 @@ var vueTestUtilsPlugin = {
|
|
|
7905
8079
|
message: `Installed ${packages.join(", ")}`
|
|
7906
8080
|
};
|
|
7907
8081
|
} catch (error) {
|
|
7908
|
-
|
|
8082
|
+
logger28.error("Failed to install Vue Test Utils:", error);
|
|
7909
8083
|
return {
|
|
7910
8084
|
packages: {},
|
|
7911
8085
|
success: false,
|
|
@@ -7921,8 +8095,7 @@ var vueTestUtilsPlugin = {
|
|
|
7921
8095
|
* - src/components/__tests__/Example.spec.ts : Exemple de test
|
|
7922
8096
|
*/
|
|
7923
8097
|
async configure(ctx) {
|
|
7924
|
-
const
|
|
7925
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
8098
|
+
const { writer } = getPluginServices(ctx);
|
|
7926
8099
|
const files = [];
|
|
7927
8100
|
const extension = ctx.typescript ? "ts" : "js";
|
|
7928
8101
|
try {
|
|
@@ -7938,7 +8111,7 @@ var vueTestUtilsPlugin = {
|
|
|
7938
8111
|
content: vitestConfigContent,
|
|
7939
8112
|
backup: false
|
|
7940
8113
|
});
|
|
7941
|
-
|
|
8114
|
+
logger28.info(`Created Vitest config: ${vitestConfigPath}`);
|
|
7942
8115
|
const testsDir = join26(
|
|
7943
8116
|
ctx.projectRoot,
|
|
7944
8117
|
ctx.srcDir,
|
|
@@ -7955,7 +8128,7 @@ var vueTestUtilsPlugin = {
|
|
|
7955
8128
|
content: testContent,
|
|
7956
8129
|
backup: false
|
|
7957
8130
|
});
|
|
7958
|
-
|
|
8131
|
+
logger28.info(`Created example test: ${testFilePath}`);
|
|
7959
8132
|
const packageJsonPath = join26(ctx.projectRoot, "package.json");
|
|
7960
8133
|
await writer.modifyPackageJson(ctx.projectRoot, (pkg) => {
|
|
7961
8134
|
pkg.scripts = pkg.scripts || {};
|
|
@@ -7969,14 +8142,14 @@ var vueTestUtilsPlugin = {
|
|
|
7969
8142
|
path: normalizePath(packageJsonPath),
|
|
7970
8143
|
backup: true
|
|
7971
8144
|
});
|
|
7972
|
-
|
|
8145
|
+
logger28.info("Updated package.json with test scripts");
|
|
7973
8146
|
return {
|
|
7974
8147
|
files,
|
|
7975
8148
|
success: true,
|
|
7976
8149
|
message: "Vue Test Utils configured successfully"
|
|
7977
8150
|
};
|
|
7978
8151
|
} catch (error) {
|
|
7979
|
-
|
|
8152
|
+
logger28.error("Failed to configure Vue Test Utils:", error);
|
|
7980
8153
|
return {
|
|
7981
8154
|
files,
|
|
7982
8155
|
success: false,
|
|
@@ -7988,9 +8161,9 @@ var vueTestUtilsPlugin = {
|
|
|
7988
8161
|
* Rollback de la configuration Vue Test Utils
|
|
7989
8162
|
*/
|
|
7990
8163
|
async rollback(_ctx) {
|
|
7991
|
-
const backupManager =
|
|
8164
|
+
const backupManager = getRollbackManager(_ctx);
|
|
7992
8165
|
await backupManager.restoreAll();
|
|
7993
|
-
|
|
8166
|
+
logger28.info("Vue Test Utils configuration rolled back");
|
|
7994
8167
|
}
|
|
7995
8168
|
};
|
|
7996
8169
|
function getVitestConfig(typescript) {
|
|
@@ -8170,8 +8343,82 @@ describe('HelloWorld', () => {
|
|
|
8170
8343
|
`;
|
|
8171
8344
|
}
|
|
8172
8345
|
|
|
8346
|
+
// src/plugins/testing/svelte-testing-library.ts
|
|
8347
|
+
var logger29 = getModuleLogger();
|
|
8348
|
+
var svelteTestingLibraryPlugin = {
|
|
8349
|
+
name: "@testing-library/svelte",
|
|
8350
|
+
displayName: "Svelte Testing Library",
|
|
8351
|
+
description: "Biblioth\xE8que de test pour composants Svelte",
|
|
8352
|
+
category: "testing" /* TESTING */,
|
|
8353
|
+
version: "^4.2.0",
|
|
8354
|
+
frameworks: ["svelte"],
|
|
8355
|
+
requires: ["vitest"],
|
|
8356
|
+
detect: (ctx) => {
|
|
8357
|
+
return ctx.devDependencies["@testing-library/svelte"] !== void 0;
|
|
8358
|
+
},
|
|
8359
|
+
async install(ctx) {
|
|
8360
|
+
if (this.detect?.(ctx)) {
|
|
8361
|
+
logger29.info("Svelte Testing Library is already installed");
|
|
8362
|
+
return {
|
|
8363
|
+
packages: {},
|
|
8364
|
+
success: true,
|
|
8365
|
+
message: "Svelte Testing Library already installed"
|
|
8366
|
+
};
|
|
8367
|
+
}
|
|
8368
|
+
try {
|
|
8369
|
+
const packages = [
|
|
8370
|
+
"@testing-library/svelte",
|
|
8371
|
+
"@testing-library/dom",
|
|
8372
|
+
"@testing-library/user-event",
|
|
8373
|
+
"@vitest/ui"
|
|
8374
|
+
];
|
|
8375
|
+
await installPackages(packages, {
|
|
8376
|
+
dev: true,
|
|
8377
|
+
packageManager: ctx.packageManager,
|
|
8378
|
+
projectRoot: ctx.projectRoot,
|
|
8379
|
+
exact: false,
|
|
8380
|
+
silent: false
|
|
8381
|
+
});
|
|
8382
|
+
logger29.info(`Installed ${packages.length} package(s)`);
|
|
8383
|
+
return {
|
|
8384
|
+
packages: {
|
|
8385
|
+
devDependencies: packages
|
|
8386
|
+
},
|
|
8387
|
+
success: true,
|
|
8388
|
+
message: "Svelte Testing Library installed successfully"
|
|
8389
|
+
};
|
|
8390
|
+
} catch (error) {
|
|
8391
|
+
logger29.error(`Failed to install Svelte Testing Library: ${String(error)}`);
|
|
8392
|
+
return {
|
|
8393
|
+
packages: {},
|
|
8394
|
+
success: false,
|
|
8395
|
+
message: `Installation failed: ${String(error)}`
|
|
8396
|
+
};
|
|
8397
|
+
}
|
|
8398
|
+
},
|
|
8399
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
8400
|
+
async configure(_ctx) {
|
|
8401
|
+
try {
|
|
8402
|
+
logger29.info("Svelte Testing Library is configured to work with Vitest");
|
|
8403
|
+
return {
|
|
8404
|
+
success: true,
|
|
8405
|
+
message: "Svelte Testing Library configured successfully",
|
|
8406
|
+
files: []
|
|
8407
|
+
};
|
|
8408
|
+
} catch (error) {
|
|
8409
|
+
logger29.error(`Configuration failed: ${String(error)}`);
|
|
8410
|
+
return {
|
|
8411
|
+
success: false,
|
|
8412
|
+
message: `Configuration failed: ${String(error)}`,
|
|
8413
|
+
files: []
|
|
8414
|
+
};
|
|
8415
|
+
}
|
|
8416
|
+
}
|
|
8417
|
+
};
|
|
8418
|
+
|
|
8173
8419
|
// src/plugins/tooling/eslint.ts
|
|
8174
8420
|
import { join as join27 } from "path";
|
|
8421
|
+
var logger30 = getModuleLogger();
|
|
8175
8422
|
var eslintPlugin = {
|
|
8176
8423
|
name: "eslint",
|
|
8177
8424
|
displayName: "ESLint",
|
|
@@ -8190,7 +8437,7 @@ var eslintPlugin = {
|
|
|
8190
8437
|
*/
|
|
8191
8438
|
async install(ctx) {
|
|
8192
8439
|
if (this.detect?.(ctx)) {
|
|
8193
|
-
|
|
8440
|
+
logger30.info("ESLint is already installed");
|
|
8194
8441
|
return {
|
|
8195
8442
|
packages: {},
|
|
8196
8443
|
success: true,
|
|
@@ -8216,7 +8463,7 @@ var eslintPlugin = {
|
|
|
8216
8463
|
exact: false,
|
|
8217
8464
|
silent: false
|
|
8218
8465
|
});
|
|
8219
|
-
|
|
8466
|
+
logger30.info("Successfully installed ESLint");
|
|
8220
8467
|
return {
|
|
8221
8468
|
packages: {
|
|
8222
8469
|
devDependencies: packages
|
|
@@ -8225,7 +8472,7 @@ var eslintPlugin = {
|
|
|
8225
8472
|
message: `Installed ${packages.join(", ")}`
|
|
8226
8473
|
};
|
|
8227
8474
|
} catch (error) {
|
|
8228
|
-
|
|
8475
|
+
logger30.error("Failed to install ESLint:", error);
|
|
8229
8476
|
return {
|
|
8230
8477
|
packages: {},
|
|
8231
8478
|
success: false,
|
|
@@ -8253,7 +8500,7 @@ var eslintPlugin = {
|
|
|
8253
8500
|
ctx.fsAdapter
|
|
8254
8501
|
);
|
|
8255
8502
|
if (eslintConfigExists) {
|
|
8256
|
-
|
|
8503
|
+
logger30.warn("eslint.config.js already exists, skipping creation");
|
|
8257
8504
|
} else {
|
|
8258
8505
|
const eslintConfigContent = getESLintConfigContent(ctx);
|
|
8259
8506
|
await writer.createFile(eslintConfigPath, eslintConfigContent);
|
|
@@ -8263,7 +8510,7 @@ var eslintPlugin = {
|
|
|
8263
8510
|
content: eslintConfigContent,
|
|
8264
8511
|
backup: false
|
|
8265
8512
|
});
|
|
8266
|
-
|
|
8513
|
+
logger30.info(`Created ESLint config: ${eslintConfigPath}`);
|
|
8267
8514
|
}
|
|
8268
8515
|
const packageJsonPath = join27(projectRoot, "package.json");
|
|
8269
8516
|
const packageJsonExists = await checkPathExists(
|
|
@@ -8302,7 +8549,7 @@ var eslintPlugin = {
|
|
|
8302
8549
|
content: updatedContent,
|
|
8303
8550
|
backup: true
|
|
8304
8551
|
});
|
|
8305
|
-
|
|
8552
|
+
logger30.info("Updated package.json with ESLint scripts");
|
|
8306
8553
|
}
|
|
8307
8554
|
}
|
|
8308
8555
|
return {
|
|
@@ -8311,7 +8558,7 @@ var eslintPlugin = {
|
|
|
8311
8558
|
message: "ESLint configured successfully"
|
|
8312
8559
|
};
|
|
8313
8560
|
} catch (error) {
|
|
8314
|
-
|
|
8561
|
+
logger30.error("Failed to configure ESLint:", error);
|
|
8315
8562
|
await backupManager.restoreAll();
|
|
8316
8563
|
return {
|
|
8317
8564
|
files,
|
|
@@ -8327,9 +8574,9 @@ var eslintPlugin = {
|
|
|
8327
8574
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
8328
8575
|
try {
|
|
8329
8576
|
await backupManager.restoreAll();
|
|
8330
|
-
|
|
8577
|
+
logger30.info("ESLint configuration rolled back");
|
|
8331
8578
|
} catch (error) {
|
|
8332
|
-
|
|
8579
|
+
logger30.error("Failed to rollback ESLint configuration:", error);
|
|
8333
8580
|
throw error;
|
|
8334
8581
|
}
|
|
8335
8582
|
}
|
|
@@ -8432,6 +8679,7 @@ export default [
|
|
|
8432
8679
|
|
|
8433
8680
|
// src/plugins/tooling/eslint-vue.ts
|
|
8434
8681
|
import { join as join28 } from "path";
|
|
8682
|
+
var logger31 = getModuleLogger();
|
|
8435
8683
|
var eslintVuePlugin = {
|
|
8436
8684
|
name: "eslint-plugin-vue",
|
|
8437
8685
|
displayName: "ESLint Vue",
|
|
@@ -8450,7 +8698,7 @@ var eslintVuePlugin = {
|
|
|
8450
8698
|
*/
|
|
8451
8699
|
async install(ctx) {
|
|
8452
8700
|
if (this.detect?.(ctx)) {
|
|
8453
|
-
|
|
8701
|
+
logger31.info("ESLint Vue is already installed");
|
|
8454
8702
|
return {
|
|
8455
8703
|
packages: {},
|
|
8456
8704
|
success: true,
|
|
@@ -8473,7 +8721,7 @@ var eslintVuePlugin = {
|
|
|
8473
8721
|
exact: false,
|
|
8474
8722
|
silent: false
|
|
8475
8723
|
});
|
|
8476
|
-
|
|
8724
|
+
logger31.info("Successfully installed ESLint Vue");
|
|
8477
8725
|
return {
|
|
8478
8726
|
packages: {
|
|
8479
8727
|
devDependencies: packages
|
|
@@ -8482,7 +8730,7 @@ var eslintVuePlugin = {
|
|
|
8482
8730
|
message: `Installed ${packages.join(", ")}`
|
|
8483
8731
|
};
|
|
8484
8732
|
} catch (error) {
|
|
8485
|
-
|
|
8733
|
+
logger31.error("Failed to install ESLint Vue:", error);
|
|
8486
8734
|
return {
|
|
8487
8735
|
packages: {},
|
|
8488
8736
|
success: false,
|
|
@@ -8524,7 +8772,7 @@ var eslintVuePlugin = {
|
|
|
8524
8772
|
content: updatedContent,
|
|
8525
8773
|
backup: true
|
|
8526
8774
|
});
|
|
8527
|
-
|
|
8775
|
+
logger31.info(`Updated ESLint config: ${eslintConfigPath}`);
|
|
8528
8776
|
}
|
|
8529
8777
|
} else {
|
|
8530
8778
|
const eslintConfigContent = getESLintVueConfigContent(ctx);
|
|
@@ -8535,7 +8783,7 @@ var eslintVuePlugin = {
|
|
|
8535
8783
|
content: eslintConfigContent,
|
|
8536
8784
|
backup: false
|
|
8537
8785
|
});
|
|
8538
|
-
|
|
8786
|
+
logger31.info(`Created ESLint Vue config: ${eslintConfigPath}`);
|
|
8539
8787
|
}
|
|
8540
8788
|
return {
|
|
8541
8789
|
files,
|
|
@@ -8543,7 +8791,7 @@ var eslintVuePlugin = {
|
|
|
8543
8791
|
message: "ESLint Vue configured successfully"
|
|
8544
8792
|
};
|
|
8545
8793
|
} catch (error) {
|
|
8546
|
-
|
|
8794
|
+
logger31.error("Failed to configure ESLint Vue:", error);
|
|
8547
8795
|
return {
|
|
8548
8796
|
files,
|
|
8549
8797
|
success: false,
|
|
@@ -8557,7 +8805,7 @@ var eslintVuePlugin = {
|
|
|
8557
8805
|
async rollback(_ctx) {
|
|
8558
8806
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
8559
8807
|
await backupManager.restoreAll();
|
|
8560
|
-
|
|
8808
|
+
logger31.info("ESLint Vue configuration rolled back");
|
|
8561
8809
|
}
|
|
8562
8810
|
};
|
|
8563
8811
|
function getESLintVueConfigContent(ctx) {
|
|
@@ -8645,6 +8893,7 @@ function updateESLintConfig(existingContent, ctx) {
|
|
|
8645
8893
|
// src/plugins/tooling/husky.ts
|
|
8646
8894
|
import { join as join29 } from "path";
|
|
8647
8895
|
import { execa } from "execa";
|
|
8896
|
+
var logger32 = getModuleLogger();
|
|
8648
8897
|
var huskyPlugin = {
|
|
8649
8898
|
name: "husky",
|
|
8650
8899
|
displayName: "Husky",
|
|
@@ -8663,7 +8912,7 @@ var huskyPlugin = {
|
|
|
8663
8912
|
*/
|
|
8664
8913
|
async install(ctx) {
|
|
8665
8914
|
if (this.detect?.(ctx)) {
|
|
8666
|
-
|
|
8915
|
+
logger32.info("Husky is already installed");
|
|
8667
8916
|
return {
|
|
8668
8917
|
packages: {},
|
|
8669
8918
|
success: true,
|
|
@@ -8678,7 +8927,7 @@ var huskyPlugin = {
|
|
|
8678
8927
|
exact: false,
|
|
8679
8928
|
silent: false
|
|
8680
8929
|
});
|
|
8681
|
-
|
|
8930
|
+
logger32.info("Successfully installed Husky");
|
|
8682
8931
|
return {
|
|
8683
8932
|
packages: {
|
|
8684
8933
|
devDependencies: ["husky"]
|
|
@@ -8687,7 +8936,7 @@ var huskyPlugin = {
|
|
|
8687
8936
|
message: "Installed husky"
|
|
8688
8937
|
};
|
|
8689
8938
|
} catch (error) {
|
|
8690
|
-
|
|
8939
|
+
logger32.error("Failed to install Husky:", error);
|
|
8691
8940
|
return {
|
|
8692
8941
|
packages: {},
|
|
8693
8942
|
success: false,
|
|
@@ -8714,7 +8963,7 @@ var huskyPlugin = {
|
|
|
8714
8963
|
const gitDir = join29(projectRoot, ".git");
|
|
8715
8964
|
const gitExists = await checkPathExists(gitDir, ctx.fsAdapter);
|
|
8716
8965
|
if (!gitExists) {
|
|
8717
|
-
|
|
8966
|
+
logger32.warn(
|
|
8718
8967
|
".git directory not found. Husky hooks will be skipped. Initialize Git and run npm run prepare to set up Husky."
|
|
8719
8968
|
);
|
|
8720
8969
|
return {
|
|
@@ -8739,7 +8988,7 @@ var huskyPlugin = {
|
|
|
8739
8988
|
content: preCommitContent,
|
|
8740
8989
|
backup: false
|
|
8741
8990
|
});
|
|
8742
|
-
|
|
8991
|
+
logger32.info(`Created pre-commit hook: ${preCommitPath}`);
|
|
8743
8992
|
}
|
|
8744
8993
|
const prePushPath = join29(huskyDir, "pre-push");
|
|
8745
8994
|
const prePushExists = await checkPathExists(prePushPath, ctx.fsAdapter);
|
|
@@ -8752,7 +9001,7 @@ var huskyPlugin = {
|
|
|
8752
9001
|
content: prePushContent,
|
|
8753
9002
|
backup: false
|
|
8754
9003
|
});
|
|
8755
|
-
|
|
9004
|
+
logger32.info(`Created pre-push hook: ${prePushPath}`);
|
|
8756
9005
|
}
|
|
8757
9006
|
const packageJsonPath = join29(projectRoot, "package.json");
|
|
8758
9007
|
const packageJsonExists = await checkPathExists(
|
|
@@ -8781,7 +9030,7 @@ var huskyPlugin = {
|
|
|
8781
9030
|
content: updatedContent,
|
|
8782
9031
|
backup: true
|
|
8783
9032
|
});
|
|
8784
|
-
|
|
9033
|
+
logger32.info("Updated package.json with Husky prepare script");
|
|
8785
9034
|
}
|
|
8786
9035
|
}
|
|
8787
9036
|
try {
|
|
@@ -8789,9 +9038,9 @@ var huskyPlugin = {
|
|
|
8789
9038
|
cwd: projectRoot,
|
|
8790
9039
|
stdio: "inherit"
|
|
8791
9040
|
});
|
|
8792
|
-
|
|
9041
|
+
logger32.info("Husky initialized successfully");
|
|
8793
9042
|
} catch {
|
|
8794
|
-
|
|
9043
|
+
logger32.warn(
|
|
8795
9044
|
"Failed to run husky init automatically. You may need to run it manually: npx husky init"
|
|
8796
9045
|
);
|
|
8797
9046
|
}
|
|
@@ -8801,7 +9050,7 @@ var huskyPlugin = {
|
|
|
8801
9050
|
message: "Husky configured successfully"
|
|
8802
9051
|
};
|
|
8803
9052
|
} catch (error) {
|
|
8804
|
-
|
|
9053
|
+
logger32.error("Failed to configure Husky:", error);
|
|
8805
9054
|
await backupManager.restoreAll();
|
|
8806
9055
|
return {
|
|
8807
9056
|
files,
|
|
@@ -8817,9 +9066,9 @@ var huskyPlugin = {
|
|
|
8817
9066
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
8818
9067
|
try {
|
|
8819
9068
|
await backupManager.restoreAll();
|
|
8820
|
-
|
|
9069
|
+
logger32.info("Husky configuration rolled back");
|
|
8821
9070
|
} catch (error) {
|
|
8822
|
-
|
|
9071
|
+
logger32.error("Failed to rollback Husky configuration:", error);
|
|
8823
9072
|
throw error;
|
|
8824
9073
|
}
|
|
8825
9074
|
}
|
|
@@ -8842,6 +9091,7 @@ npm run test:unit
|
|
|
8842
9091
|
|
|
8843
9092
|
// src/plugins/tooling/commitlint.ts
|
|
8844
9093
|
import { join as join30 } from "path";
|
|
9094
|
+
var logger33 = getModuleLogger();
|
|
8845
9095
|
var commitlintPlugin = {
|
|
8846
9096
|
name: "@commitlint/cli",
|
|
8847
9097
|
displayName: "Commitlint",
|
|
@@ -8860,7 +9110,7 @@ var commitlintPlugin = {
|
|
|
8860
9110
|
*/
|
|
8861
9111
|
async install(ctx) {
|
|
8862
9112
|
if (this.detect?.(ctx)) {
|
|
8863
|
-
|
|
9113
|
+
logger33.info("Commitlint is already installed");
|
|
8864
9114
|
return {
|
|
8865
9115
|
packages: {},
|
|
8866
9116
|
success: true,
|
|
@@ -8879,7 +9129,7 @@ var commitlintPlugin = {
|
|
|
8879
9129
|
exact: false,
|
|
8880
9130
|
silent: false
|
|
8881
9131
|
});
|
|
8882
|
-
|
|
9132
|
+
logger33.info("Successfully installed Commitlint");
|
|
8883
9133
|
return {
|
|
8884
9134
|
packages: {
|
|
8885
9135
|
devDependencies: packages
|
|
@@ -8888,7 +9138,7 @@ var commitlintPlugin = {
|
|
|
8888
9138
|
message: `Installed Commitlint: ${packages.join(", ")}`
|
|
8889
9139
|
};
|
|
8890
9140
|
} catch (error) {
|
|
8891
|
-
|
|
9141
|
+
logger33.error("Failed to install Commitlint:", error);
|
|
8892
9142
|
return {
|
|
8893
9143
|
packages: {},
|
|
8894
9144
|
success: false,
|
|
@@ -8923,7 +9173,7 @@ var commitlintPlugin = {
|
|
|
8923
9173
|
content: configContent,
|
|
8924
9174
|
backup: false
|
|
8925
9175
|
});
|
|
8926
|
-
|
|
9176
|
+
logger33.info(`Created commitlint config: ${configPath}`);
|
|
8927
9177
|
}
|
|
8928
9178
|
await writer.modifyPackageJson(projectRoot, (pkg) => {
|
|
8929
9179
|
pkg.scripts = pkg.scripts || {};
|
|
@@ -8955,7 +9205,7 @@ var commitlintPlugin = {
|
|
|
8955
9205
|
content: commitMsgContent,
|
|
8956
9206
|
backup: false
|
|
8957
9207
|
});
|
|
8958
|
-
|
|
9208
|
+
logger33.info(`Created commit-msg hook: ${commitMsgPath}`);
|
|
8959
9209
|
} else {
|
|
8960
9210
|
const existingContent = await readFileContent(
|
|
8961
9211
|
commitMsgPath,
|
|
@@ -8973,11 +9223,11 @@ var commitlintPlugin = {
|
|
|
8973
9223
|
content: updatedContent,
|
|
8974
9224
|
backup: true
|
|
8975
9225
|
});
|
|
8976
|
-
|
|
9226
|
+
logger33.info(`Updated commit-msg hook: ${commitMsgPath}`);
|
|
8977
9227
|
}
|
|
8978
9228
|
}
|
|
8979
9229
|
} else {
|
|
8980
|
-
|
|
9230
|
+
logger33.warn(
|
|
8981
9231
|
".husky directory not found. Commit-msg hook not created. Install Husky first."
|
|
8982
9232
|
);
|
|
8983
9233
|
}
|
|
@@ -8987,7 +9237,7 @@ var commitlintPlugin = {
|
|
|
8987
9237
|
message: "Commitlint configured successfully"
|
|
8988
9238
|
};
|
|
8989
9239
|
} catch (error) {
|
|
8990
|
-
|
|
9240
|
+
logger33.error("Failed to configure Commitlint:", error);
|
|
8991
9241
|
await backupManager.restoreAll();
|
|
8992
9242
|
return {
|
|
8993
9243
|
files,
|
|
@@ -9003,9 +9253,9 @@ var commitlintPlugin = {
|
|
|
9003
9253
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9004
9254
|
try {
|
|
9005
9255
|
await backupManager.restoreAll();
|
|
9006
|
-
|
|
9256
|
+
logger33.info("Commitlint configuration rolled back");
|
|
9007
9257
|
} catch (error) {
|
|
9008
|
-
|
|
9258
|
+
logger33.error("Failed to rollback Commitlint configuration:", error);
|
|
9009
9259
|
throw error;
|
|
9010
9260
|
}
|
|
9011
9261
|
}
|
|
@@ -9029,6 +9279,7 @@ ${getCommitMsgCommand()}
|
|
|
9029
9279
|
|
|
9030
9280
|
// src/plugins/tooling/lint-staged.ts
|
|
9031
9281
|
import { join as join31 } from "path";
|
|
9282
|
+
var logger34 = getModuleLogger();
|
|
9032
9283
|
var lintStagedPlugin = {
|
|
9033
9284
|
name: "lint-staged",
|
|
9034
9285
|
displayName: "lint-staged",
|
|
@@ -9047,7 +9298,7 @@ var lintStagedPlugin = {
|
|
|
9047
9298
|
*/
|
|
9048
9299
|
async install(ctx) {
|
|
9049
9300
|
if (this.detect?.(ctx)) {
|
|
9050
|
-
|
|
9301
|
+
logger34.info("lint-staged is already installed");
|
|
9051
9302
|
return {
|
|
9052
9303
|
packages: {},
|
|
9053
9304
|
success: true,
|
|
@@ -9062,7 +9313,7 @@ var lintStagedPlugin = {
|
|
|
9062
9313
|
exact: false,
|
|
9063
9314
|
silent: false
|
|
9064
9315
|
});
|
|
9065
|
-
|
|
9316
|
+
logger34.info("Successfully installed lint-staged");
|
|
9066
9317
|
return {
|
|
9067
9318
|
packages: {
|
|
9068
9319
|
devDependencies: ["lint-staged"]
|
|
@@ -9071,7 +9322,7 @@ var lintStagedPlugin = {
|
|
|
9071
9322
|
message: "Installed lint-staged"
|
|
9072
9323
|
};
|
|
9073
9324
|
} catch (error) {
|
|
9074
|
-
|
|
9325
|
+
logger34.error("Failed to install lint-staged:", error);
|
|
9075
9326
|
return {
|
|
9076
9327
|
packages: {},
|
|
9077
9328
|
success: false,
|
|
@@ -9088,8 +9339,7 @@ var lintStagedPlugin = {
|
|
|
9088
9339
|
* - package.json (script lint-staged)
|
|
9089
9340
|
*/
|
|
9090
9341
|
async configure(ctx) {
|
|
9091
|
-
const backupManager =
|
|
9092
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
9342
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
9093
9343
|
const files = [];
|
|
9094
9344
|
const projectRoot = ctx.projectRoot;
|
|
9095
9345
|
const configPath = join31(projectRoot, "lint-staged.config.cjs");
|
|
@@ -9105,7 +9355,7 @@ var lintStagedPlugin = {
|
|
|
9105
9355
|
content: configContent,
|
|
9106
9356
|
backup: false
|
|
9107
9357
|
});
|
|
9108
|
-
|
|
9358
|
+
logger34.info(`Created lint-staged config: ${configPath}`);
|
|
9109
9359
|
}
|
|
9110
9360
|
await writer.modifyPackageJson(projectRoot, (pkg) => {
|
|
9111
9361
|
pkg.scripts = pkg.scripts || {};
|
|
@@ -9119,14 +9369,14 @@ var lintStagedPlugin = {
|
|
|
9119
9369
|
path: normalizePath(packageJsonPath),
|
|
9120
9370
|
backup: true
|
|
9121
9371
|
});
|
|
9122
|
-
|
|
9372
|
+
logger34.info("Updated package.json with lint-staged script");
|
|
9123
9373
|
return {
|
|
9124
9374
|
files,
|
|
9125
9375
|
success: true,
|
|
9126
9376
|
message: "lint-staged configured successfully"
|
|
9127
9377
|
};
|
|
9128
9378
|
} catch (error) {
|
|
9129
|
-
|
|
9379
|
+
logger34.error("Failed to configure lint-staged:", error);
|
|
9130
9380
|
await backupManager.restoreAll();
|
|
9131
9381
|
return {
|
|
9132
9382
|
files,
|
|
@@ -9139,12 +9389,12 @@ var lintStagedPlugin = {
|
|
|
9139
9389
|
* Rollback de la configuration lint-staged
|
|
9140
9390
|
*/
|
|
9141
9391
|
async rollback(_ctx) {
|
|
9142
|
-
const backupManager =
|
|
9392
|
+
const backupManager = getRollbackManager(_ctx);
|
|
9143
9393
|
try {
|
|
9144
9394
|
await backupManager.restoreAll();
|
|
9145
|
-
|
|
9395
|
+
logger34.info("lint-staged configuration rolled back");
|
|
9146
9396
|
} catch (error) {
|
|
9147
|
-
|
|
9397
|
+
logger34.error("Failed to rollback lint-staged configuration:", error);
|
|
9148
9398
|
throw error;
|
|
9149
9399
|
}
|
|
9150
9400
|
}
|
|
@@ -9159,6 +9409,7 @@ function getLintStagedConfig() {
|
|
|
9159
9409
|
|
|
9160
9410
|
// src/plugins/tooling/prettier.ts
|
|
9161
9411
|
import { join as join32 } from "path";
|
|
9412
|
+
var logger35 = getModuleLogger();
|
|
9162
9413
|
var prettierPlugin = {
|
|
9163
9414
|
name: "prettier",
|
|
9164
9415
|
displayName: "Prettier",
|
|
@@ -9177,7 +9428,7 @@ var prettierPlugin = {
|
|
|
9177
9428
|
*/
|
|
9178
9429
|
async install(ctx) {
|
|
9179
9430
|
if (this.detect?.(ctx)) {
|
|
9180
|
-
|
|
9431
|
+
logger35.info("Prettier is already installed");
|
|
9181
9432
|
return {
|
|
9182
9433
|
packages: {},
|
|
9183
9434
|
success: true,
|
|
@@ -9192,7 +9443,7 @@ var prettierPlugin = {
|
|
|
9192
9443
|
exact: false,
|
|
9193
9444
|
silent: false
|
|
9194
9445
|
});
|
|
9195
|
-
|
|
9446
|
+
logger35.info("Successfully installed Prettier");
|
|
9196
9447
|
return {
|
|
9197
9448
|
packages: {
|
|
9198
9449
|
devDependencies: ["prettier"]
|
|
@@ -9201,7 +9452,7 @@ var prettierPlugin = {
|
|
|
9201
9452
|
message: "Installed prettier"
|
|
9202
9453
|
};
|
|
9203
9454
|
} catch (error) {
|
|
9204
|
-
|
|
9455
|
+
logger35.error("Failed to install Prettier:", error);
|
|
9205
9456
|
return {
|
|
9206
9457
|
packages: {},
|
|
9207
9458
|
success: false,
|
|
@@ -9230,7 +9481,7 @@ var prettierPlugin = {
|
|
|
9230
9481
|
ctx.fsAdapter
|
|
9231
9482
|
);
|
|
9232
9483
|
if (prettierrcExists) {
|
|
9233
|
-
|
|
9484
|
+
logger35.warn(".prettierrc.json already exists, skipping creation");
|
|
9234
9485
|
} else {
|
|
9235
9486
|
const prettierrcContent = getPrettierConfigContent();
|
|
9236
9487
|
await writer.createFile(prettierrcPath, prettierrcContent);
|
|
@@ -9240,7 +9491,7 @@ var prettierPlugin = {
|
|
|
9240
9491
|
content: prettierrcContent,
|
|
9241
9492
|
backup: false
|
|
9242
9493
|
});
|
|
9243
|
-
|
|
9494
|
+
logger35.info(`Created Prettier config: ${prettierrcPath}`);
|
|
9244
9495
|
}
|
|
9245
9496
|
const prettierignorePath = join32(projectRoot, ".prettierignore");
|
|
9246
9497
|
const prettierignoreExists = await checkPathExists(
|
|
@@ -9248,7 +9499,7 @@ var prettierPlugin = {
|
|
|
9248
9499
|
ctx.fsAdapter
|
|
9249
9500
|
);
|
|
9250
9501
|
if (prettierignoreExists) {
|
|
9251
|
-
|
|
9502
|
+
logger35.warn(".prettierignore already exists, skipping creation");
|
|
9252
9503
|
} else {
|
|
9253
9504
|
const prettierignoreContent = getPrettierIgnoreContent();
|
|
9254
9505
|
await writer.createFile(prettierignorePath, prettierignoreContent);
|
|
@@ -9258,7 +9509,7 @@ var prettierPlugin = {
|
|
|
9258
9509
|
content: prettierignoreContent,
|
|
9259
9510
|
backup: false
|
|
9260
9511
|
});
|
|
9261
|
-
|
|
9512
|
+
logger35.info(`Created .prettierignore: ${prettierignorePath}`);
|
|
9262
9513
|
}
|
|
9263
9514
|
const packageJsonPath = join32(projectRoot, "package.json");
|
|
9264
9515
|
const packageJsonExists = await checkPathExists(
|
|
@@ -9297,7 +9548,7 @@ var prettierPlugin = {
|
|
|
9297
9548
|
content: updatedContent,
|
|
9298
9549
|
backup: true
|
|
9299
9550
|
});
|
|
9300
|
-
|
|
9551
|
+
logger35.info("Updated package.json with Prettier scripts");
|
|
9301
9552
|
}
|
|
9302
9553
|
}
|
|
9303
9554
|
return {
|
|
@@ -9306,7 +9557,7 @@ var prettierPlugin = {
|
|
|
9306
9557
|
message: "Prettier configured successfully"
|
|
9307
9558
|
};
|
|
9308
9559
|
} catch (error) {
|
|
9309
|
-
|
|
9560
|
+
logger35.error("Failed to configure Prettier:", error);
|
|
9310
9561
|
await backupManager.restoreAll();
|
|
9311
9562
|
return {
|
|
9312
9563
|
files,
|
|
@@ -9322,9 +9573,9 @@ var prettierPlugin = {
|
|
|
9322
9573
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9323
9574
|
try {
|
|
9324
9575
|
await backupManager.restoreAll();
|
|
9325
|
-
|
|
9576
|
+
logger35.info("Prettier configuration rolled back");
|
|
9326
9577
|
} catch (error) {
|
|
9327
|
-
|
|
9578
|
+
logger35.error("Failed to rollback Prettier configuration:", error);
|
|
9328
9579
|
throw error;
|
|
9329
9580
|
}
|
|
9330
9581
|
}
|
|
@@ -9362,6 +9613,7 @@ pnpm-lock.yaml
|
|
|
9362
9613
|
|
|
9363
9614
|
// src/plugins/tooling/unplugin-auto-import.ts
|
|
9364
9615
|
import { join as join33 } from "path";
|
|
9616
|
+
var logger36 = getModuleLogger();
|
|
9365
9617
|
var unpluginAutoImportPlugin = {
|
|
9366
9618
|
name: "unplugin-auto-import",
|
|
9367
9619
|
displayName: "Auto Import (Vue)",
|
|
@@ -9381,7 +9633,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9381
9633
|
*/
|
|
9382
9634
|
async install(ctx) {
|
|
9383
9635
|
if (this.detect?.(ctx)) {
|
|
9384
|
-
|
|
9636
|
+
logger36.info("unplugin-auto-import is already installed");
|
|
9385
9637
|
return {
|
|
9386
9638
|
packages: {},
|
|
9387
9639
|
success: true,
|
|
@@ -9397,7 +9649,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9397
9649
|
exact: false,
|
|
9398
9650
|
silent: false
|
|
9399
9651
|
});
|
|
9400
|
-
|
|
9652
|
+
logger36.info("Successfully installed unplugin-auto-import");
|
|
9401
9653
|
return {
|
|
9402
9654
|
packages: {
|
|
9403
9655
|
devDependencies: packages
|
|
@@ -9406,7 +9658,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9406
9658
|
message: `Installed unplugin-auto-import: ${packages.join(", ")}`
|
|
9407
9659
|
};
|
|
9408
9660
|
} catch (error) {
|
|
9409
|
-
|
|
9661
|
+
logger36.error("Failed to install unplugin-auto-import:", error);
|
|
9410
9662
|
return {
|
|
9411
9663
|
packages: {},
|
|
9412
9664
|
success: false,
|
|
@@ -9449,7 +9701,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9449
9701
|
content: updatedContent,
|
|
9450
9702
|
backup: true
|
|
9451
9703
|
});
|
|
9452
|
-
|
|
9704
|
+
logger36.info(`Updated ${viteConfigPath} with Auto Import plugin`);
|
|
9453
9705
|
}
|
|
9454
9706
|
} else {
|
|
9455
9707
|
const viteConfigContent = getViteConfigContent();
|
|
@@ -9460,7 +9712,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9460
9712
|
content: viteConfigContent,
|
|
9461
9713
|
backup: false
|
|
9462
9714
|
});
|
|
9463
|
-
|
|
9715
|
+
logger36.info(`Created ${viteConfigPath} with Auto Import plugin`);
|
|
9464
9716
|
}
|
|
9465
9717
|
return {
|
|
9466
9718
|
files,
|
|
@@ -9468,7 +9720,7 @@ var unpluginAutoImportPlugin = {
|
|
|
9468
9720
|
message: "unplugin-auto-import configured successfully"
|
|
9469
9721
|
};
|
|
9470
9722
|
} catch (error) {
|
|
9471
|
-
|
|
9723
|
+
logger36.error("Failed to configure unplugin-auto-import:", error);
|
|
9472
9724
|
await backupManager.restoreAll();
|
|
9473
9725
|
return {
|
|
9474
9726
|
files,
|
|
@@ -9484,9 +9736,9 @@ var unpluginAutoImportPlugin = {
|
|
|
9484
9736
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9485
9737
|
try {
|
|
9486
9738
|
await backupManager.restoreAll();
|
|
9487
|
-
|
|
9739
|
+
logger36.info("unplugin-auto-import configuration rolled back");
|
|
9488
9740
|
} catch (error) {
|
|
9489
|
-
|
|
9741
|
+
logger36.error(
|
|
9490
9742
|
"Failed to rollback unplugin-auto-import configuration:",
|
|
9491
9743
|
error
|
|
9492
9744
|
);
|
|
@@ -9548,6 +9800,7 @@ function injectAutoImportPlugin(content) {
|
|
|
9548
9800
|
|
|
9549
9801
|
// src/plugins/tooling/unplugin-vue-components.ts
|
|
9550
9802
|
import { join as join34 } from "path";
|
|
9803
|
+
var logger37 = getModuleLogger();
|
|
9551
9804
|
var unpluginVueComponentsPlugin = {
|
|
9552
9805
|
name: "unplugin-vue-components",
|
|
9553
9806
|
displayName: "Auto Components (Vue)",
|
|
@@ -9567,7 +9820,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9567
9820
|
*/
|
|
9568
9821
|
async install(ctx) {
|
|
9569
9822
|
if (this.detect?.(ctx)) {
|
|
9570
|
-
|
|
9823
|
+
logger37.info("unplugin-vue-components is already installed");
|
|
9571
9824
|
return {
|
|
9572
9825
|
packages: {},
|
|
9573
9826
|
success: true,
|
|
@@ -9583,7 +9836,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9583
9836
|
exact: false,
|
|
9584
9837
|
silent: false
|
|
9585
9838
|
});
|
|
9586
|
-
|
|
9839
|
+
logger37.info("Successfully installed unplugin-vue-components");
|
|
9587
9840
|
return {
|
|
9588
9841
|
packages: {
|
|
9589
9842
|
devDependencies: packages
|
|
@@ -9592,7 +9845,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9592
9845
|
message: `Installed unplugin-vue-components: ${packages.join(", ")}`
|
|
9593
9846
|
};
|
|
9594
9847
|
} catch (error) {
|
|
9595
|
-
|
|
9848
|
+
logger37.error("Failed to install unplugin-vue-components:", error);
|
|
9596
9849
|
return {
|
|
9597
9850
|
packages: {},
|
|
9598
9851
|
success: false,
|
|
@@ -9635,7 +9888,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9635
9888
|
content: updatedContent,
|
|
9636
9889
|
backup: true
|
|
9637
9890
|
});
|
|
9638
|
-
|
|
9891
|
+
logger37.info(`Updated ${viteConfigPath} with Vue Components plugin`);
|
|
9639
9892
|
}
|
|
9640
9893
|
} else {
|
|
9641
9894
|
const viteConfigContent = getViteConfigContent2();
|
|
@@ -9646,7 +9899,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9646
9899
|
content: viteConfigContent,
|
|
9647
9900
|
backup: false
|
|
9648
9901
|
});
|
|
9649
|
-
|
|
9902
|
+
logger37.info(`Created ${viteConfigPath} with Vue Components plugin`);
|
|
9650
9903
|
}
|
|
9651
9904
|
return {
|
|
9652
9905
|
files,
|
|
@@ -9654,7 +9907,7 @@ var unpluginVueComponentsPlugin = {
|
|
|
9654
9907
|
message: "unplugin-vue-components configured successfully"
|
|
9655
9908
|
};
|
|
9656
9909
|
} catch (error) {
|
|
9657
|
-
|
|
9910
|
+
logger37.error("Failed to configure unplugin-vue-components:", error);
|
|
9658
9911
|
await backupManager.restoreAll();
|
|
9659
9912
|
return {
|
|
9660
9913
|
files,
|
|
@@ -9670,9 +9923,9 @@ var unpluginVueComponentsPlugin = {
|
|
|
9670
9923
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
9671
9924
|
try {
|
|
9672
9925
|
await backupManager.restoreAll();
|
|
9673
|
-
|
|
9926
|
+
logger37.info("unplugin-vue-components configuration rolled back");
|
|
9674
9927
|
} catch (error) {
|
|
9675
|
-
|
|
9928
|
+
logger37.error(
|
|
9676
9929
|
"Failed to rollback unplugin-vue-components configuration:",
|
|
9677
9930
|
error
|
|
9678
9931
|
);
|
|
@@ -9732,6 +9985,7 @@ function injectComponentsPlugin(content) {
|
|
|
9732
9985
|
|
|
9733
9986
|
// src/plugins/tooling/vue-tsc.ts
|
|
9734
9987
|
import { join as join35 } from "path";
|
|
9988
|
+
var logger38 = getModuleLogger();
|
|
9735
9989
|
var vueTscPlugin = {
|
|
9736
9990
|
name: "vue-tsc",
|
|
9737
9991
|
displayName: "vue-tsc",
|
|
@@ -9751,7 +10005,7 @@ var vueTscPlugin = {
|
|
|
9751
10005
|
*/
|
|
9752
10006
|
async install(ctx) {
|
|
9753
10007
|
if (this.detect?.(ctx)) {
|
|
9754
|
-
|
|
10008
|
+
logger38.info("vue-tsc is already installed");
|
|
9755
10009
|
return {
|
|
9756
10010
|
packages: {},
|
|
9757
10011
|
success: true,
|
|
@@ -9767,7 +10021,7 @@ var vueTscPlugin = {
|
|
|
9767
10021
|
exact: false,
|
|
9768
10022
|
silent: false
|
|
9769
10023
|
});
|
|
9770
|
-
|
|
10024
|
+
logger38.info("Successfully installed vue-tsc");
|
|
9771
10025
|
return {
|
|
9772
10026
|
packages: {
|
|
9773
10027
|
devDependencies: packages
|
|
@@ -9776,7 +10030,7 @@ var vueTscPlugin = {
|
|
|
9776
10030
|
message: `Installed vue-tsc: ${packages.join(", ")}`
|
|
9777
10031
|
};
|
|
9778
10032
|
} catch (error) {
|
|
9779
|
-
|
|
10033
|
+
logger38.error("Failed to install vue-tsc:", error);
|
|
9780
10034
|
return {
|
|
9781
10035
|
packages: {},
|
|
9782
10036
|
success: false,
|
|
@@ -9790,8 +10044,7 @@ var vueTscPlugin = {
|
|
|
9790
10044
|
* Ajoute le script typecheck si absent
|
|
9791
10045
|
*/
|
|
9792
10046
|
async configure(ctx) {
|
|
9793
|
-
const
|
|
9794
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
10047
|
+
const { writer } = getPluginServices(ctx);
|
|
9795
10048
|
const files = [];
|
|
9796
10049
|
const packageJsonPath = join35(ctx.projectRoot, "package.json");
|
|
9797
10050
|
try {
|
|
@@ -9807,14 +10060,14 @@ var vueTscPlugin = {
|
|
|
9807
10060
|
path: normalizePath(packageJsonPath),
|
|
9808
10061
|
backup: true
|
|
9809
10062
|
});
|
|
9810
|
-
|
|
10063
|
+
logger38.info("Updated package.json with vue-tsc typecheck script");
|
|
9811
10064
|
return {
|
|
9812
10065
|
files,
|
|
9813
10066
|
success: true,
|
|
9814
10067
|
message: "vue-tsc configured successfully"
|
|
9815
10068
|
};
|
|
9816
10069
|
} catch (error) {
|
|
9817
|
-
|
|
10070
|
+
logger38.error("Failed to configure vue-tsc:", error);
|
|
9818
10071
|
return {
|
|
9819
10072
|
files,
|
|
9820
10073
|
success: false,
|
|
@@ -9826,14 +10079,15 @@ var vueTscPlugin = {
|
|
|
9826
10079
|
* Rollback de la configuration vue-tsc
|
|
9827
10080
|
*/
|
|
9828
10081
|
async rollback(_ctx) {
|
|
9829
|
-
const backupManager =
|
|
10082
|
+
const backupManager = getRollbackManager(_ctx);
|
|
9830
10083
|
await backupManager.restoreAll();
|
|
9831
|
-
|
|
10084
|
+
logger38.info("vue-tsc configuration rolled back");
|
|
9832
10085
|
}
|
|
9833
10086
|
};
|
|
9834
10087
|
|
|
9835
10088
|
// src/plugins/ui/radix-ui.ts
|
|
9836
10089
|
import { join as join36 } from "path";
|
|
10090
|
+
var logger39 = getModuleLogger();
|
|
9837
10091
|
var radixUiPlugin = {
|
|
9838
10092
|
name: "radix-ui",
|
|
9839
10093
|
displayName: "Radix UI",
|
|
@@ -9852,7 +10106,7 @@ var radixUiPlugin = {
|
|
|
9852
10106
|
*/
|
|
9853
10107
|
async install(ctx) {
|
|
9854
10108
|
if (this.detect?.(ctx)) {
|
|
9855
|
-
|
|
10109
|
+
logger39.info("Radix UI is already installed");
|
|
9856
10110
|
return {
|
|
9857
10111
|
packages: {},
|
|
9858
10112
|
success: true,
|
|
@@ -9879,7 +10133,7 @@ var radixUiPlugin = {
|
|
|
9879
10133
|
exact: false,
|
|
9880
10134
|
silent: false
|
|
9881
10135
|
});
|
|
9882
|
-
|
|
10136
|
+
logger39.info("Successfully installed Radix UI primitives");
|
|
9883
10137
|
return {
|
|
9884
10138
|
packages: {
|
|
9885
10139
|
dependencies: packages
|
|
@@ -9888,7 +10142,7 @@ var radixUiPlugin = {
|
|
|
9888
10142
|
message: `Installed Radix UI primitives: ${packages.length} packages`
|
|
9889
10143
|
};
|
|
9890
10144
|
} catch (error) {
|
|
9891
|
-
|
|
10145
|
+
logger39.error("Failed to install Radix UI:", error);
|
|
9892
10146
|
return {
|
|
9893
10147
|
packages: {},
|
|
9894
10148
|
success: false,
|
|
@@ -9907,8 +10161,7 @@ var radixUiPlugin = {
|
|
|
9907
10161
|
* Documentation : https://www.radix-ui.com/primitives/docs
|
|
9908
10162
|
*/
|
|
9909
10163
|
async configure(ctx) {
|
|
9910
|
-
const backupManager =
|
|
9911
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
10164
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
9912
10165
|
const files = [];
|
|
9913
10166
|
const srcDir = join36(ctx.projectRoot, ctx.srcDir);
|
|
9914
10167
|
const extension = ctx.typescript ? "tsx" : "jsx";
|
|
@@ -9924,7 +10177,7 @@ var radixUiPlugin = {
|
|
|
9924
10177
|
content: dialogContent,
|
|
9925
10178
|
backup: false
|
|
9926
10179
|
});
|
|
9927
|
-
|
|
10180
|
+
logger39.info(`Created Dialog component: ${dialogPath}`);
|
|
9928
10181
|
const dropdownMenuPath = join36(radixDir, `DropdownMenu.${extension}`);
|
|
9929
10182
|
const dropdownMenuContent = ctx.typescript ? getDropdownMenuContentTS() : getDropdownMenuContentJS();
|
|
9930
10183
|
await writer.createFile(dropdownMenuPath, dropdownMenuContent);
|
|
@@ -9934,7 +10187,7 @@ var radixUiPlugin = {
|
|
|
9934
10187
|
content: dropdownMenuContent,
|
|
9935
10188
|
backup: false
|
|
9936
10189
|
});
|
|
9937
|
-
|
|
10190
|
+
logger39.info(`Created DropdownMenu component: ${dropdownMenuPath}`);
|
|
9938
10191
|
const indexPath = join36(radixDir, `index.${ctx.typescript ? "ts" : "js"}`);
|
|
9939
10192
|
const indexContent = ctx.typescript ? getIndexContentTS6() : getIndexContentJS6();
|
|
9940
10193
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -9944,14 +10197,14 @@ var radixUiPlugin = {
|
|
|
9944
10197
|
content: indexContent,
|
|
9945
10198
|
backup: false
|
|
9946
10199
|
});
|
|
9947
|
-
|
|
10200
|
+
logger39.info(`Created Radix UI components index: ${indexPath}`);
|
|
9948
10201
|
return {
|
|
9949
10202
|
files,
|
|
9950
10203
|
success: true,
|
|
9951
10204
|
message: "Radix UI configured successfully"
|
|
9952
10205
|
};
|
|
9953
10206
|
} catch (error) {
|
|
9954
|
-
|
|
10207
|
+
logger39.error("Failed to configure Radix UI:", error);
|
|
9955
10208
|
await backupManager.restoreAll();
|
|
9956
10209
|
return {
|
|
9957
10210
|
files,
|
|
@@ -9964,12 +10217,12 @@ var radixUiPlugin = {
|
|
|
9964
10217
|
* Rollback de la configuration Radix UI
|
|
9965
10218
|
*/
|
|
9966
10219
|
async rollback(_ctx) {
|
|
9967
|
-
const backupManager =
|
|
10220
|
+
const backupManager = getRollbackManager(_ctx);
|
|
9968
10221
|
try {
|
|
9969
10222
|
await backupManager.restoreAll();
|
|
9970
|
-
|
|
10223
|
+
logger39.info("Radix UI configuration rolled back");
|
|
9971
10224
|
} catch (error) {
|
|
9972
|
-
|
|
10225
|
+
logger39.error("Failed to rollback Radix UI configuration:", error);
|
|
9973
10226
|
throw error;
|
|
9974
10227
|
}
|
|
9975
10228
|
}
|
|
@@ -10564,6 +10817,7 @@ export {
|
|
|
10564
10817
|
|
|
10565
10818
|
// src/plugins/ui/react-hot-toast.ts
|
|
10566
10819
|
import { join as join37 } from "path";
|
|
10820
|
+
var logger40 = getModuleLogger();
|
|
10567
10821
|
var reactHotToastPlugin = {
|
|
10568
10822
|
name: "react-hot-toast",
|
|
10569
10823
|
displayName: "React Hot Toast",
|
|
@@ -10582,7 +10836,7 @@ var reactHotToastPlugin = {
|
|
|
10582
10836
|
*/
|
|
10583
10837
|
async install(ctx) {
|
|
10584
10838
|
if (this.detect?.(ctx)) {
|
|
10585
|
-
|
|
10839
|
+
logger40.info("React Hot Toast is already installed");
|
|
10586
10840
|
return {
|
|
10587
10841
|
packages: {},
|
|
10588
10842
|
success: true,
|
|
@@ -10598,7 +10852,7 @@ var reactHotToastPlugin = {
|
|
|
10598
10852
|
exact: false,
|
|
10599
10853
|
silent: false
|
|
10600
10854
|
});
|
|
10601
|
-
|
|
10855
|
+
logger40.info("Successfully installed React Hot Toast");
|
|
10602
10856
|
return {
|
|
10603
10857
|
packages: {
|
|
10604
10858
|
dependencies: packages
|
|
@@ -10607,7 +10861,7 @@ var reactHotToastPlugin = {
|
|
|
10607
10861
|
message: `Installed React Hot Toast: ${packages.join(", ")}`
|
|
10608
10862
|
};
|
|
10609
10863
|
} catch (error) {
|
|
10610
|
-
|
|
10864
|
+
logger40.error("Failed to install React Hot Toast:", error);
|
|
10611
10865
|
return {
|
|
10612
10866
|
packages: {},
|
|
10613
10867
|
success: false,
|
|
@@ -10657,9 +10911,9 @@ var reactHotToastPlugin = {
|
|
|
10657
10911
|
content: updatedContent,
|
|
10658
10912
|
backup: true
|
|
10659
10913
|
});
|
|
10660
|
-
|
|
10914
|
+
logger40.info(`Added Toaster to ${targetPath}`);
|
|
10661
10915
|
} else {
|
|
10662
|
-
|
|
10916
|
+
logger40.warn("Toaster already configured in the app");
|
|
10663
10917
|
}
|
|
10664
10918
|
} else {
|
|
10665
10919
|
const newAppPath = join37(srcDir, `App.${extension}`);
|
|
@@ -10671,7 +10925,7 @@ var reactHotToastPlugin = {
|
|
|
10671
10925
|
content: newAppContent,
|
|
10672
10926
|
backup: false
|
|
10673
10927
|
});
|
|
10674
|
-
|
|
10928
|
+
logger40.info(`Created App.${extension} with Toaster`);
|
|
10675
10929
|
}
|
|
10676
10930
|
return {
|
|
10677
10931
|
files,
|
|
@@ -10679,7 +10933,7 @@ var reactHotToastPlugin = {
|
|
|
10679
10933
|
message: "React Hot Toast configured successfully"
|
|
10680
10934
|
};
|
|
10681
10935
|
} catch (error) {
|
|
10682
|
-
|
|
10936
|
+
logger40.error("Failed to configure React Hot Toast:", error);
|
|
10683
10937
|
await backupManager.restoreAll();
|
|
10684
10938
|
return {
|
|
10685
10939
|
files,
|
|
@@ -10695,9 +10949,9 @@ var reactHotToastPlugin = {
|
|
|
10695
10949
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
10696
10950
|
try {
|
|
10697
10951
|
await backupManager.restoreAll();
|
|
10698
|
-
|
|
10952
|
+
logger40.info("React Hot Toast configuration rolled back");
|
|
10699
10953
|
} catch (error) {
|
|
10700
|
-
|
|
10954
|
+
logger40.error("Failed to rollback React Hot Toast configuration:", error);
|
|
10701
10955
|
throw error;
|
|
10702
10956
|
}
|
|
10703
10957
|
}
|
|
@@ -10760,6 +11014,7 @@ export default App
|
|
|
10760
11014
|
|
|
10761
11015
|
// src/plugins/ui/react-hot-toast-nextjs.ts
|
|
10762
11016
|
import { join as join38 } from "path";
|
|
11017
|
+
var logger41 = getModuleLogger();
|
|
10763
11018
|
var reactHotToastNextjsPlugin = {
|
|
10764
11019
|
name: "react-hot-toast-nextjs",
|
|
10765
11020
|
displayName: "React Hot Toast (Next.js)",
|
|
@@ -10778,7 +11033,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10778
11033
|
*/
|
|
10779
11034
|
async install(ctx) {
|
|
10780
11035
|
if (this.detect?.(ctx)) {
|
|
10781
|
-
|
|
11036
|
+
logger41.info("React Hot Toast is already installed");
|
|
10782
11037
|
return {
|
|
10783
11038
|
packages: {},
|
|
10784
11039
|
success: true,
|
|
@@ -10794,7 +11049,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10794
11049
|
exact: false,
|
|
10795
11050
|
silent: false
|
|
10796
11051
|
});
|
|
10797
|
-
|
|
11052
|
+
logger41.info("Successfully installed React Hot Toast");
|
|
10798
11053
|
return {
|
|
10799
11054
|
packages: {
|
|
10800
11055
|
dependencies: packages
|
|
@@ -10803,7 +11058,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10803
11058
|
message: `Installed React Hot Toast: ${packages.join(", ")}`
|
|
10804
11059
|
};
|
|
10805
11060
|
} catch (error) {
|
|
10806
|
-
|
|
11061
|
+
logger41.error("Failed to install React Hot Toast:", error);
|
|
10807
11062
|
return {
|
|
10808
11063
|
packages: {},
|
|
10809
11064
|
success: false,
|
|
@@ -10881,9 +11136,9 @@ var reactHotToastNextjsPlugin = {
|
|
|
10881
11136
|
content: updatedContent,
|
|
10882
11137
|
backup: targetContent ? true : false
|
|
10883
11138
|
});
|
|
10884
|
-
|
|
11139
|
+
logger41.info(`Added Toaster to ${targetPath}`);
|
|
10885
11140
|
} else {
|
|
10886
|
-
|
|
11141
|
+
logger41.warn("Toaster already configured");
|
|
10887
11142
|
}
|
|
10888
11143
|
}
|
|
10889
11144
|
return {
|
|
@@ -10892,7 +11147,7 @@ var reactHotToastNextjsPlugin = {
|
|
|
10892
11147
|
message: "React Hot Toast configured successfully for Next.js"
|
|
10893
11148
|
};
|
|
10894
11149
|
} catch (error) {
|
|
10895
|
-
|
|
11150
|
+
logger41.error("Failed to configure React Hot Toast:", error);
|
|
10896
11151
|
await backupManager.restoreAll();
|
|
10897
11152
|
return {
|
|
10898
11153
|
files,
|
|
@@ -10908,9 +11163,9 @@ var reactHotToastNextjsPlugin = {
|
|
|
10908
11163
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
10909
11164
|
try {
|
|
10910
11165
|
await backupManager.restoreAll();
|
|
10911
|
-
|
|
11166
|
+
logger41.info("React Hot Toast configuration rolled back");
|
|
10912
11167
|
} catch (error) {
|
|
10913
|
-
|
|
11168
|
+
logger41.error("Failed to rollback React Hot Toast configuration:", error);
|
|
10914
11169
|
throw error;
|
|
10915
11170
|
}
|
|
10916
11171
|
}
|
|
@@ -11058,6 +11313,7 @@ export default function App({ Component, pageProps }) {
|
|
|
11058
11313
|
|
|
11059
11314
|
// src/plugins/ui/react-icons.ts
|
|
11060
11315
|
import { join as join39 } from "path";
|
|
11316
|
+
var logger42 = getModuleLogger();
|
|
11061
11317
|
var reactIconsPlugin = {
|
|
11062
11318
|
name: "react-icons",
|
|
11063
11319
|
displayName: "React Icons",
|
|
@@ -11076,7 +11332,7 @@ var reactIconsPlugin = {
|
|
|
11076
11332
|
*/
|
|
11077
11333
|
async install(ctx) {
|
|
11078
11334
|
if (this.detect?.(ctx)) {
|
|
11079
|
-
|
|
11335
|
+
logger42.info("React Icons is already installed");
|
|
11080
11336
|
return {
|
|
11081
11337
|
packages: {},
|
|
11082
11338
|
success: true,
|
|
@@ -11092,7 +11348,7 @@ var reactIconsPlugin = {
|
|
|
11092
11348
|
exact: false,
|
|
11093
11349
|
silent: false
|
|
11094
11350
|
});
|
|
11095
|
-
|
|
11351
|
+
logger42.info("Successfully installed React Icons");
|
|
11096
11352
|
return {
|
|
11097
11353
|
packages: {
|
|
11098
11354
|
dependencies: packages
|
|
@@ -11101,7 +11357,7 @@ var reactIconsPlugin = {
|
|
|
11101
11357
|
message: `Installed React Icons: ${packages.join(", ")}`
|
|
11102
11358
|
};
|
|
11103
11359
|
} catch (error) {
|
|
11104
|
-
|
|
11360
|
+
logger42.error("Failed to install React Icons:", error);
|
|
11105
11361
|
return {
|
|
11106
11362
|
packages: {},
|
|
11107
11363
|
success: false,
|
|
@@ -11119,8 +11375,7 @@ var reactIconsPlugin = {
|
|
|
11119
11375
|
* Documentation : https://react-icons.github.io/react-icons
|
|
11120
11376
|
*/
|
|
11121
11377
|
async configure(ctx) {
|
|
11122
|
-
const backupManager =
|
|
11123
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
11378
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
11124
11379
|
const files = [];
|
|
11125
11380
|
const srcDir = join39(ctx.projectRoot, ctx.srcDir);
|
|
11126
11381
|
try {
|
|
@@ -11138,7 +11393,7 @@ var reactIconsPlugin = {
|
|
|
11138
11393
|
content: iconExampleContent,
|
|
11139
11394
|
backup: false
|
|
11140
11395
|
});
|
|
11141
|
-
|
|
11396
|
+
logger42.info(`Created icon example: ${iconExamplePath}`);
|
|
11142
11397
|
const indexPath = join39(iconsDir, `index.${ctx.typescript ? "ts" : "js"}`);
|
|
11143
11398
|
const indexContent = ctx.typescript ? getIndexContentTS7() : getIndexContentJS7();
|
|
11144
11399
|
await writer.createFile(indexPath, indexContent);
|
|
@@ -11148,14 +11403,14 @@ var reactIconsPlugin = {
|
|
|
11148
11403
|
content: indexContent,
|
|
11149
11404
|
backup: false
|
|
11150
11405
|
});
|
|
11151
|
-
|
|
11406
|
+
logger42.info(`Created icons index: ${indexPath}`);
|
|
11152
11407
|
return {
|
|
11153
11408
|
files,
|
|
11154
11409
|
success: true,
|
|
11155
11410
|
message: "React Icons configured successfully"
|
|
11156
11411
|
};
|
|
11157
11412
|
} catch (error) {
|
|
11158
|
-
|
|
11413
|
+
logger42.error("Failed to configure React Icons:", error);
|
|
11159
11414
|
await backupManager.restoreAll();
|
|
11160
11415
|
return {
|
|
11161
11416
|
files,
|
|
@@ -11168,12 +11423,12 @@ var reactIconsPlugin = {
|
|
|
11168
11423
|
* Rollback de la configuration React Icons
|
|
11169
11424
|
*/
|
|
11170
11425
|
async rollback(_ctx) {
|
|
11171
|
-
const backupManager =
|
|
11426
|
+
const backupManager = getRollbackManager(_ctx);
|
|
11172
11427
|
try {
|
|
11173
11428
|
await backupManager.restoreAll();
|
|
11174
|
-
|
|
11429
|
+
logger42.info("React Icons configuration rolled back");
|
|
11175
11430
|
} catch (error) {
|
|
11176
|
-
|
|
11431
|
+
logger42.error("Failed to rollback React Icons configuration:", error);
|
|
11177
11432
|
throw error;
|
|
11178
11433
|
}
|
|
11179
11434
|
}
|
|
@@ -11256,6 +11511,7 @@ export { MdHome, MdSettings, MdSearch } from 'react-icons/md'
|
|
|
11256
11511
|
|
|
11257
11512
|
// src/plugins/ui/shadcn-ui.ts
|
|
11258
11513
|
import { join as join40 } from "path";
|
|
11514
|
+
var logger43 = getModuleLogger();
|
|
11259
11515
|
var shadcnUiPlugin = {
|
|
11260
11516
|
name: "shadcn-ui",
|
|
11261
11517
|
displayName: "Shadcn/ui",
|
|
@@ -11280,7 +11536,7 @@ var shadcnUiPlugin = {
|
|
|
11280
11536
|
*/
|
|
11281
11537
|
async install(ctx) {
|
|
11282
11538
|
if (this.detect?.(ctx)) {
|
|
11283
|
-
|
|
11539
|
+
logger43.info("Shadcn/ui dependencies are already installed");
|
|
11284
11540
|
return {
|
|
11285
11541
|
packages: {},
|
|
11286
11542
|
success: true,
|
|
@@ -11310,7 +11566,7 @@ var shadcnUiPlugin = {
|
|
|
11310
11566
|
exact: false,
|
|
11311
11567
|
silent: false
|
|
11312
11568
|
});
|
|
11313
|
-
|
|
11569
|
+
logger43.info("Successfully installed Shadcn/ui dependencies");
|
|
11314
11570
|
return {
|
|
11315
11571
|
packages: {
|
|
11316
11572
|
dependencies: packages
|
|
@@ -11319,7 +11575,7 @@ var shadcnUiPlugin = {
|
|
|
11319
11575
|
message: `Installed Shadcn/ui dependencies: ${packages.join(", ")}`
|
|
11320
11576
|
};
|
|
11321
11577
|
} catch (error) {
|
|
11322
|
-
|
|
11578
|
+
logger43.error("Failed to install Shadcn/ui dependencies:", error);
|
|
11323
11579
|
return {
|
|
11324
11580
|
packages: {},
|
|
11325
11581
|
success: false,
|
|
@@ -11350,7 +11606,7 @@ var shadcnUiPlugin = {
|
|
|
11350
11606
|
ctx.fsAdapter
|
|
11351
11607
|
);
|
|
11352
11608
|
if (componentsJsonExists) {
|
|
11353
|
-
|
|
11609
|
+
logger43.warn("components.json already exists, skipping creation");
|
|
11354
11610
|
} else {
|
|
11355
11611
|
const componentsJsonContent = getComponentsJsonContent(ctx);
|
|
11356
11612
|
await writer.createFile(componentsJsonPath, componentsJsonContent);
|
|
@@ -11360,14 +11616,14 @@ var shadcnUiPlugin = {
|
|
|
11360
11616
|
content: componentsJsonContent,
|
|
11361
11617
|
backup: false
|
|
11362
11618
|
});
|
|
11363
|
-
|
|
11619
|
+
logger43.info(`Created components.json: ${componentsJsonPath}`);
|
|
11364
11620
|
}
|
|
11365
11621
|
const libDir = join40(srcDir, "lib");
|
|
11366
11622
|
await ensureDirectory(libDir, ctx.fsAdapter);
|
|
11367
11623
|
const utilsPath = join40(libDir, `utils.${ctx.typescript ? "ts" : "js"}`);
|
|
11368
11624
|
const utilsExists = await checkPathExists(utilsPath, ctx.fsAdapter);
|
|
11369
11625
|
if (utilsExists) {
|
|
11370
|
-
|
|
11626
|
+
logger43.warn(
|
|
11371
11627
|
"utils.ts already exists, checking if cn function is present"
|
|
11372
11628
|
);
|
|
11373
11629
|
const existingContent = await readFileContent(
|
|
@@ -11385,7 +11641,7 @@ var shadcnUiPlugin = {
|
|
|
11385
11641
|
content: updatedContent,
|
|
11386
11642
|
backup: true
|
|
11387
11643
|
});
|
|
11388
|
-
|
|
11644
|
+
logger43.info("Added cn function to utils.ts");
|
|
11389
11645
|
}
|
|
11390
11646
|
} else {
|
|
11391
11647
|
const utilsContent = ctx.typescript ? getUtilsContentTS() : getUtilsContentJS();
|
|
@@ -11396,7 +11652,7 @@ var shadcnUiPlugin = {
|
|
|
11396
11652
|
content: utilsContent,
|
|
11397
11653
|
backup: false
|
|
11398
11654
|
});
|
|
11399
|
-
|
|
11655
|
+
logger43.info(`Created utils file: ${utilsPath}`);
|
|
11400
11656
|
}
|
|
11401
11657
|
const uiDir = join40(srcDir, "components", "ui");
|
|
11402
11658
|
await ensureDirectory(uiDir, ctx.fsAdapter);
|
|
@@ -11411,7 +11667,7 @@ var shadcnUiPlugin = {
|
|
|
11411
11667
|
content: buttonContent,
|
|
11412
11668
|
backup: false
|
|
11413
11669
|
});
|
|
11414
|
-
|
|
11670
|
+
logger43.info(`Created Button component: ${buttonPath}`);
|
|
11415
11671
|
}
|
|
11416
11672
|
const cssPath = join40(srcDir, "index.css");
|
|
11417
11673
|
const cssExists = await checkPathExists(cssPath, ctx.fsAdapter);
|
|
@@ -11431,7 +11687,7 @@ var shadcnUiPlugin = {
|
|
|
11431
11687
|
content: updatedCss,
|
|
11432
11688
|
backup: true
|
|
11433
11689
|
});
|
|
11434
|
-
|
|
11690
|
+
logger43.info("Added Shadcn/ui CSS variables to index.css");
|
|
11435
11691
|
}
|
|
11436
11692
|
}
|
|
11437
11693
|
return {
|
|
@@ -11440,7 +11696,7 @@ var shadcnUiPlugin = {
|
|
|
11440
11696
|
message: "Shadcn/ui configured successfully"
|
|
11441
11697
|
};
|
|
11442
11698
|
} catch (error) {
|
|
11443
|
-
|
|
11699
|
+
logger43.error("Failed to configure Shadcn/ui:", error);
|
|
11444
11700
|
await backupManager.restoreAll();
|
|
11445
11701
|
return {
|
|
11446
11702
|
files,
|
|
@@ -11456,9 +11712,9 @@ var shadcnUiPlugin = {
|
|
|
11456
11712
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
11457
11713
|
try {
|
|
11458
11714
|
await backupManager.restoreAll();
|
|
11459
|
-
|
|
11715
|
+
logger43.info("Shadcn/ui configuration rolled back");
|
|
11460
11716
|
} catch (error) {
|
|
11461
|
-
|
|
11717
|
+
logger43.error("Failed to rollback Shadcn/ui configuration:", error);
|
|
11462
11718
|
throw error;
|
|
11463
11719
|
}
|
|
11464
11720
|
}
|
|
@@ -11728,6 +11984,7 @@ function getShadcnCSSVariables() {
|
|
|
11728
11984
|
|
|
11729
11985
|
// src/plugins/ui/shadcn-ui-nextjs.ts
|
|
11730
11986
|
import { join as join41 } from "path";
|
|
11987
|
+
var logger44 = getModuleLogger();
|
|
11731
11988
|
var shadcnUiNextjsPlugin = {
|
|
11732
11989
|
name: "shadcn-ui-nextjs",
|
|
11733
11990
|
displayName: "Shadcn/ui (Next.js)",
|
|
@@ -11747,7 +12004,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11747
12004
|
*/
|
|
11748
12005
|
async install(ctx) {
|
|
11749
12006
|
if (this.detect?.(ctx)) {
|
|
11750
|
-
|
|
12007
|
+
logger44.info("Shadcn/ui dependencies are already installed");
|
|
11751
12008
|
return {
|
|
11752
12009
|
packages: {},
|
|
11753
12010
|
success: true,
|
|
@@ -11777,7 +12034,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11777
12034
|
exact: false,
|
|
11778
12035
|
silent: false
|
|
11779
12036
|
});
|
|
11780
|
-
|
|
12037
|
+
logger44.info("Successfully installed Shadcn/ui dependencies");
|
|
11781
12038
|
return {
|
|
11782
12039
|
packages: {
|
|
11783
12040
|
dependencies: packages
|
|
@@ -11786,7 +12043,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11786
12043
|
message: `Installed Shadcn/ui dependencies: ${packages.join(", ")}`
|
|
11787
12044
|
};
|
|
11788
12045
|
} catch (error) {
|
|
11789
|
-
|
|
12046
|
+
logger44.error("Failed to install Shadcn/ui dependencies:", error);
|
|
11790
12047
|
return {
|
|
11791
12048
|
packages: {},
|
|
11792
12049
|
success: false,
|
|
@@ -11816,7 +12073,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11816
12073
|
ctx.fsAdapter
|
|
11817
12074
|
);
|
|
11818
12075
|
if (componentsJsonExists) {
|
|
11819
|
-
|
|
12076
|
+
logger44.warn("components.json already exists, skipping creation");
|
|
11820
12077
|
} else {
|
|
11821
12078
|
const componentsJsonContent = getComponentsJsonContentNextjs(ctx);
|
|
11822
12079
|
await writer.createFile(componentsJsonPath, componentsJsonContent);
|
|
@@ -11826,14 +12083,14 @@ var shadcnUiNextjsPlugin = {
|
|
|
11826
12083
|
content: componentsJsonContent,
|
|
11827
12084
|
backup: false
|
|
11828
12085
|
});
|
|
11829
|
-
|
|
12086
|
+
logger44.info(`Created components.json: ${componentsJsonPath}`);
|
|
11830
12087
|
}
|
|
11831
12088
|
const libDir = join41(baseDir, "lib");
|
|
11832
12089
|
await ensureDirectory(libDir, ctx.fsAdapter);
|
|
11833
12090
|
const utilsPath = join41(libDir, `utils.${ctx.typescript ? "ts" : "js"}`);
|
|
11834
12091
|
const utilsExists = await checkPathExists(utilsPath, ctx.fsAdapter);
|
|
11835
12092
|
if (utilsExists) {
|
|
11836
|
-
|
|
12093
|
+
logger44.warn(
|
|
11837
12094
|
"utils.ts already exists, checking if cn function is present"
|
|
11838
12095
|
);
|
|
11839
12096
|
const existingContent = await readFileContent(
|
|
@@ -11851,7 +12108,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11851
12108
|
content: updatedContent,
|
|
11852
12109
|
backup: true
|
|
11853
12110
|
});
|
|
11854
|
-
|
|
12111
|
+
logger44.info("Added cn function to utils.ts");
|
|
11855
12112
|
}
|
|
11856
12113
|
} else {
|
|
11857
12114
|
const utilsContent = ctx.typescript ? getUtilsContentTS2() : getUtilsContentJS2();
|
|
@@ -11862,7 +12119,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11862
12119
|
content: utilsContent,
|
|
11863
12120
|
backup: false
|
|
11864
12121
|
});
|
|
11865
|
-
|
|
12122
|
+
logger44.info(`Created utils file: ${utilsPath}`);
|
|
11866
12123
|
}
|
|
11867
12124
|
const uiDir = join41(baseDir, "components", "ui");
|
|
11868
12125
|
await ensureDirectory(uiDir, ctx.fsAdapter);
|
|
@@ -11877,7 +12134,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11877
12134
|
content: buttonContent,
|
|
11878
12135
|
backup: false
|
|
11879
12136
|
});
|
|
11880
|
-
|
|
12137
|
+
logger44.info(`Created Button component: ${buttonPath}`);
|
|
11881
12138
|
}
|
|
11882
12139
|
const cssFiles = [
|
|
11883
12140
|
join41(projectRoot, "app", "globals.css"),
|
|
@@ -11903,7 +12160,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11903
12160
|
content: updatedCss,
|
|
11904
12161
|
backup: true
|
|
11905
12162
|
});
|
|
11906
|
-
|
|
12163
|
+
logger44.info(`Added Shadcn/ui CSS variables to ${cssPath}`);
|
|
11907
12164
|
}
|
|
11908
12165
|
break;
|
|
11909
12166
|
}
|
|
@@ -11914,7 +12171,7 @@ var shadcnUiNextjsPlugin = {
|
|
|
11914
12171
|
message: "Shadcn/ui configured successfully for Next.js"
|
|
11915
12172
|
};
|
|
11916
12173
|
} catch (error) {
|
|
11917
|
-
|
|
12174
|
+
logger44.error("Failed to configure Shadcn/ui:", error);
|
|
11918
12175
|
return {
|
|
11919
12176
|
files,
|
|
11920
12177
|
success: false,
|
|
@@ -11929,9 +12186,9 @@ var shadcnUiNextjsPlugin = {
|
|
|
11929
12186
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
11930
12187
|
try {
|
|
11931
12188
|
await backupManager.restoreAll();
|
|
11932
|
-
|
|
12189
|
+
logger44.info("Shadcn/ui configuration rolled back");
|
|
11933
12190
|
} catch (error) {
|
|
11934
|
-
|
|
12191
|
+
logger44.error("Failed to rollback Shadcn/ui configuration:", error);
|
|
11935
12192
|
throw error;
|
|
11936
12193
|
}
|
|
11937
12194
|
}
|
|
@@ -12203,6 +12460,7 @@ function getShadcnCSSVariables2() {
|
|
|
12203
12460
|
|
|
12204
12461
|
// src/plugins/ui/vuetify.ts
|
|
12205
12462
|
import { join as join42 } from "path";
|
|
12463
|
+
var logger45 = getModuleLogger();
|
|
12206
12464
|
var vuetifyPlugin = {
|
|
12207
12465
|
name: "vuetify",
|
|
12208
12466
|
displayName: "Vuetify",
|
|
@@ -12221,7 +12479,7 @@ var vuetifyPlugin = {
|
|
|
12221
12479
|
*/
|
|
12222
12480
|
async install(ctx) {
|
|
12223
12481
|
if (this.detect?.(ctx)) {
|
|
12224
|
-
|
|
12482
|
+
logger45.info("Vuetify is already installed");
|
|
12225
12483
|
return {
|
|
12226
12484
|
packages: {},
|
|
12227
12485
|
success: true,
|
|
@@ -12262,7 +12520,7 @@ var vuetifyPlugin = {
|
|
|
12262
12520
|
silent: false
|
|
12263
12521
|
});
|
|
12264
12522
|
}
|
|
12265
|
-
|
|
12523
|
+
logger45.info("Successfully installed Vuetify");
|
|
12266
12524
|
return {
|
|
12267
12525
|
packages: {
|
|
12268
12526
|
dependencies: packages,
|
|
@@ -12272,7 +12530,7 @@ var vuetifyPlugin = {
|
|
|
12272
12530
|
message: `Installed ${packages.concat(devPackages).join(", ")}`
|
|
12273
12531
|
};
|
|
12274
12532
|
} catch (error) {
|
|
12275
|
-
|
|
12533
|
+
logger45.error("Failed to install Vuetify:", error);
|
|
12276
12534
|
return {
|
|
12277
12535
|
packages: {},
|
|
12278
12536
|
success: false,
|
|
@@ -12306,7 +12564,7 @@ var vuetifyPlugin = {
|
|
|
12306
12564
|
content: vuetifyConfigContent,
|
|
12307
12565
|
backup: false
|
|
12308
12566
|
});
|
|
12309
|
-
|
|
12567
|
+
logger45.info(`Created Vuetify config: ${vuetifyConfigPath}`);
|
|
12310
12568
|
const componentsDir = join42(ctx.projectRoot, ctx.srcDir, "components");
|
|
12311
12569
|
await ensureDirectory(componentsDir, ctx.fsAdapter);
|
|
12312
12570
|
const componentPath = join42(componentsDir, "HelloVuetify.vue");
|
|
@@ -12318,7 +12576,7 @@ var vuetifyPlugin = {
|
|
|
12318
12576
|
content: componentContent,
|
|
12319
12577
|
backup: false
|
|
12320
12578
|
});
|
|
12321
|
-
|
|
12579
|
+
logger45.info(`Created example component: ${componentPath}`);
|
|
12322
12580
|
const mainPath = join42(ctx.projectRoot, ctx.srcDir, `main.${extension}`);
|
|
12323
12581
|
const mainExists = await checkPathExists(mainPath, ctx.fsAdapter);
|
|
12324
12582
|
if (mainExists) {
|
|
@@ -12334,7 +12592,7 @@ var vuetifyPlugin = {
|
|
|
12334
12592
|
path: normalizePath(mainPath),
|
|
12335
12593
|
backup: true
|
|
12336
12594
|
});
|
|
12337
|
-
|
|
12595
|
+
logger45.info(`Updated ${mainPath} to import Vuetify`);
|
|
12338
12596
|
}
|
|
12339
12597
|
const viteConfigPath = join42(ctx.projectRoot, `vite.config.${extension}`);
|
|
12340
12598
|
const viteConfigExists = await checkPathExists(
|
|
@@ -12356,7 +12614,7 @@ var vuetifyPlugin = {
|
|
|
12356
12614
|
path: normalizePath(viteConfigPath),
|
|
12357
12615
|
backup: true
|
|
12358
12616
|
});
|
|
12359
|
-
|
|
12617
|
+
logger45.info(`Updated ${viteConfigPath} to include Vuetify plugin`);
|
|
12360
12618
|
}
|
|
12361
12619
|
return {
|
|
12362
12620
|
files,
|
|
@@ -12364,7 +12622,7 @@ var vuetifyPlugin = {
|
|
|
12364
12622
|
message: "Vuetify configured successfully"
|
|
12365
12623
|
};
|
|
12366
12624
|
} catch (error) {
|
|
12367
|
-
|
|
12625
|
+
logger45.error("Failed to configure Vuetify:", error);
|
|
12368
12626
|
return {
|
|
12369
12627
|
files,
|
|
12370
12628
|
success: false,
|
|
@@ -12378,7 +12636,7 @@ var vuetifyPlugin = {
|
|
|
12378
12636
|
async rollback(_ctx) {
|
|
12379
12637
|
const backupManager = new BackupManager(_ctx.fsAdapter);
|
|
12380
12638
|
await backupManager.restoreAll();
|
|
12381
|
-
|
|
12639
|
+
logger45.info("Vuetify configuration rolled back");
|
|
12382
12640
|
}
|
|
12383
12641
|
};
|
|
12384
12642
|
function getVuetifyConfig(typescript) {
|
|
@@ -12552,8 +12810,77 @@ function updateViteConfig(content) {
|
|
|
12552
12810
|
return content;
|
|
12553
12811
|
}
|
|
12554
12812
|
|
|
12813
|
+
// src/plugins/ui/skeleton-ui.ts
|
|
12814
|
+
var logger46 = getModuleLogger();
|
|
12815
|
+
var skeletonUiPlugin = {
|
|
12816
|
+
name: "@skeletonlabs/skeleton",
|
|
12817
|
+
displayName: "Skeleton UI",
|
|
12818
|
+
description: "Composants UI l\xE9gers et personnalisables pour Svelte",
|
|
12819
|
+
category: "ui" /* UI */,
|
|
12820
|
+
version: "^2.12.0",
|
|
12821
|
+
frameworks: ["svelte"],
|
|
12822
|
+
requires: ["tailwindcss"],
|
|
12823
|
+
detect: (ctx) => {
|
|
12824
|
+
return ctx.dependencies["@skeletonlabs/skeleton"] !== void 0;
|
|
12825
|
+
},
|
|
12826
|
+
async install(ctx) {
|
|
12827
|
+
if (this.detect?.(ctx)) {
|
|
12828
|
+
logger46.info("Skeleton UI is already installed");
|
|
12829
|
+
return {
|
|
12830
|
+
packages: {},
|
|
12831
|
+
success: true,
|
|
12832
|
+
message: "Skeleton UI already installed"
|
|
12833
|
+
};
|
|
12834
|
+
}
|
|
12835
|
+
try {
|
|
12836
|
+
const packages = ["@skeletonlabs/skeleton", "@skeletonlabs/tw-plugin"];
|
|
12837
|
+
await installPackages(packages, {
|
|
12838
|
+
dev: false,
|
|
12839
|
+
packageManager: ctx.packageManager,
|
|
12840
|
+
projectRoot: ctx.projectRoot,
|
|
12841
|
+
exact: false,
|
|
12842
|
+
silent: false
|
|
12843
|
+
});
|
|
12844
|
+
logger46.info(`Installed ${packages.length} package(s)`);
|
|
12845
|
+
return {
|
|
12846
|
+
packages: {
|
|
12847
|
+
dependencies: packages
|
|
12848
|
+
},
|
|
12849
|
+
success: true,
|
|
12850
|
+
message: "Skeleton UI installed successfully"
|
|
12851
|
+
};
|
|
12852
|
+
} catch (error) {
|
|
12853
|
+
logger46.error(`Failed to install Skeleton UI: ${String(error)}`);
|
|
12854
|
+
return {
|
|
12855
|
+
packages: {},
|
|
12856
|
+
success: false,
|
|
12857
|
+
message: `Installation failed: ${String(error)}`
|
|
12858
|
+
};
|
|
12859
|
+
}
|
|
12860
|
+
},
|
|
12861
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
12862
|
+
async configure(_ctx) {
|
|
12863
|
+
try {
|
|
12864
|
+
logger46.info("Skeleton UI is configured to work with TailwindCSS");
|
|
12865
|
+
return {
|
|
12866
|
+
success: true,
|
|
12867
|
+
message: "Skeleton UI configured successfully",
|
|
12868
|
+
files: []
|
|
12869
|
+
};
|
|
12870
|
+
} catch (error) {
|
|
12871
|
+
logger46.error(`Configuration failed: ${String(error)}`);
|
|
12872
|
+
return {
|
|
12873
|
+
success: false,
|
|
12874
|
+
message: `Configuration failed: ${String(error)}`,
|
|
12875
|
+
files: []
|
|
12876
|
+
};
|
|
12877
|
+
}
|
|
12878
|
+
}
|
|
12879
|
+
};
|
|
12880
|
+
|
|
12555
12881
|
// src/plugins/utils/date-fns.ts
|
|
12556
12882
|
import { join as join43 } from "path";
|
|
12883
|
+
var logger47 = getModuleLogger();
|
|
12557
12884
|
var dateFnsPlugin = {
|
|
12558
12885
|
name: "date-fns",
|
|
12559
12886
|
displayName: "date-fns",
|
|
@@ -12572,7 +12899,7 @@ var dateFnsPlugin = {
|
|
|
12572
12899
|
*/
|
|
12573
12900
|
async install(ctx) {
|
|
12574
12901
|
if (this.detect?.(ctx)) {
|
|
12575
|
-
|
|
12902
|
+
logger47.info("date-fns is already installed");
|
|
12576
12903
|
return {
|
|
12577
12904
|
packages: {},
|
|
12578
12905
|
success: true,
|
|
@@ -12588,7 +12915,7 @@ var dateFnsPlugin = {
|
|
|
12588
12915
|
exact: false,
|
|
12589
12916
|
silent: false
|
|
12590
12917
|
});
|
|
12591
|
-
|
|
12918
|
+
logger47.info("Successfully installed date-fns");
|
|
12592
12919
|
return {
|
|
12593
12920
|
packages: {
|
|
12594
12921
|
dependencies: packages
|
|
@@ -12597,7 +12924,7 @@ var dateFnsPlugin = {
|
|
|
12597
12924
|
message: `Installed date-fns: ${packages.join(", ")}`
|
|
12598
12925
|
};
|
|
12599
12926
|
} catch (error) {
|
|
12600
|
-
|
|
12927
|
+
logger47.error("Failed to install date-fns:", error);
|
|
12601
12928
|
return {
|
|
12602
12929
|
packages: {},
|
|
12603
12930
|
success: false,
|
|
@@ -12614,8 +12941,7 @@ var dateFnsPlugin = {
|
|
|
12614
12941
|
* Documentation : https://date-fns.org
|
|
12615
12942
|
*/
|
|
12616
12943
|
async configure(ctx) {
|
|
12617
|
-
const backupManager =
|
|
12618
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
12944
|
+
const { backupManager, writer } = getPluginServices(ctx);
|
|
12619
12945
|
const files = [];
|
|
12620
12946
|
const srcDir = join43(ctx.projectRoot, ctx.srcDir);
|
|
12621
12947
|
try {
|
|
@@ -12633,14 +12959,14 @@ var dateFnsPlugin = {
|
|
|
12633
12959
|
content: dateUtilsContent,
|
|
12634
12960
|
backup: false
|
|
12635
12961
|
});
|
|
12636
|
-
|
|
12962
|
+
logger47.info(`Created date utilities: ${dateUtilsPath}`);
|
|
12637
12963
|
return {
|
|
12638
12964
|
files,
|
|
12639
12965
|
success: true,
|
|
12640
12966
|
message: "date-fns configured successfully"
|
|
12641
12967
|
};
|
|
12642
12968
|
} catch (error) {
|
|
12643
|
-
|
|
12969
|
+
logger47.error("Failed to configure date-fns:", error);
|
|
12644
12970
|
await backupManager.restoreAll();
|
|
12645
12971
|
return {
|
|
12646
12972
|
files,
|
|
@@ -12653,12 +12979,12 @@ var dateFnsPlugin = {
|
|
|
12653
12979
|
* Rollback de la configuration date-fns
|
|
12654
12980
|
*/
|
|
12655
12981
|
async rollback(_ctx) {
|
|
12656
|
-
const backupManager =
|
|
12982
|
+
const backupManager = getRollbackManager(_ctx);
|
|
12657
12983
|
try {
|
|
12658
12984
|
await backupManager.restoreAll();
|
|
12659
|
-
|
|
12985
|
+
logger47.info("date-fns configuration rolled back");
|
|
12660
12986
|
} catch (error) {
|
|
12661
|
-
|
|
12987
|
+
logger47.error("Failed to rollback date-fns configuration:", error);
|
|
12662
12988
|
throw error;
|
|
12663
12989
|
}
|
|
12664
12990
|
}
|
|
@@ -12769,6 +13095,8 @@ function getDateUtilsContentJS() {
|
|
|
12769
13095
|
} from 'date-fns'
|
|
12770
13096
|
import { fr } from 'date-fns/locale'
|
|
12771
13097
|
|
|
13098
|
+
const logger = getModuleLogger()
|
|
13099
|
+
|
|
12772
13100
|
/**
|
|
12773
13101
|
* Utilitaires de manipulation de dates avec date-fns
|
|
12774
13102
|
*
|
|
@@ -12838,6 +13166,7 @@ export function getMinutesDifference(date1, date2) {
|
|
|
12838
13166
|
|
|
12839
13167
|
// src/plugins/utils/vueuse.ts
|
|
12840
13168
|
import { resolve as resolve17, join as join44 } from "path";
|
|
13169
|
+
var logger48 = getModuleLogger();
|
|
12841
13170
|
var vueusePlugin = {
|
|
12842
13171
|
name: "@vueuse/core",
|
|
12843
13172
|
displayName: "VueUse",
|
|
@@ -12856,7 +13185,7 @@ var vueusePlugin = {
|
|
|
12856
13185
|
*/
|
|
12857
13186
|
async install(ctx) {
|
|
12858
13187
|
if (this.detect?.(ctx)) {
|
|
12859
|
-
|
|
13188
|
+
logger48.info("VueUse is already installed");
|
|
12860
13189
|
return {
|
|
12861
13190
|
packages: {},
|
|
12862
13191
|
success: true,
|
|
@@ -12872,7 +13201,7 @@ var vueusePlugin = {
|
|
|
12872
13201
|
exact: false,
|
|
12873
13202
|
silent: false
|
|
12874
13203
|
});
|
|
12875
|
-
|
|
13204
|
+
logger48.info("Successfully installed VueUse");
|
|
12876
13205
|
return {
|
|
12877
13206
|
packages: {
|
|
12878
13207
|
dependencies: packages
|
|
@@ -12881,7 +13210,7 @@ var vueusePlugin = {
|
|
|
12881
13210
|
message: `Installed ${packages.join(", ")}`
|
|
12882
13211
|
};
|
|
12883
13212
|
} catch (error) {
|
|
12884
|
-
|
|
13213
|
+
logger48.error("Failed to install VueUse:", error);
|
|
12885
13214
|
return {
|
|
12886
13215
|
packages: {},
|
|
12887
13216
|
success: false,
|
|
@@ -12896,8 +13225,7 @@ var vueusePlugin = {
|
|
|
12896
13225
|
* - src/composables/useExample.ts (ou .js) : Exemple d'utilisation
|
|
12897
13226
|
*/
|
|
12898
13227
|
async configure(ctx) {
|
|
12899
|
-
const
|
|
12900
|
-
const writer = new ConfigWriter(backupManager, ctx.fsAdapter);
|
|
13228
|
+
const { writer } = getPluginServices(ctx);
|
|
12901
13229
|
const files = [];
|
|
12902
13230
|
const srcDir = resolve17(ctx.projectRoot, ctx.srcDir);
|
|
12903
13231
|
const extension = ctx.typescript ? "ts" : "js";
|
|
@@ -12913,14 +13241,14 @@ var vueusePlugin = {
|
|
|
12913
13241
|
content: exampleContent,
|
|
12914
13242
|
backup: false
|
|
12915
13243
|
});
|
|
12916
|
-
|
|
13244
|
+
logger48.info(`Created VueUse example: ${examplePath}`);
|
|
12917
13245
|
return {
|
|
12918
13246
|
files,
|
|
12919
13247
|
success: true,
|
|
12920
13248
|
message: "VueUse configured successfully"
|
|
12921
13249
|
};
|
|
12922
13250
|
} catch (error) {
|
|
12923
|
-
|
|
13251
|
+
logger48.error("Failed to configure VueUse:", error);
|
|
12924
13252
|
return {
|
|
12925
13253
|
files,
|
|
12926
13254
|
success: false,
|
|
@@ -12932,9 +13260,9 @@ var vueusePlugin = {
|
|
|
12932
13260
|
* Rollback de la configuration VueUse
|
|
12933
13261
|
*/
|
|
12934
13262
|
async rollback(_ctx) {
|
|
12935
|
-
const backupManager =
|
|
13263
|
+
const backupManager = getRollbackManager(_ctx);
|
|
12936
13264
|
await backupManager.restoreAll();
|
|
12937
|
-
|
|
13265
|
+
logger48.info("VueUse configuration rolled back");
|
|
12938
13266
|
}
|
|
12939
13267
|
};
|
|
12940
13268
|
function getExampleContentTS2() {
|
|
@@ -12969,6 +13297,8 @@ function getExampleContentJS2() {
|
|
|
12969
13297
|
return `import { computed } from 'vue'
|
|
12970
13298
|
import { useMouse, useCounter } from '@vueuse/core'
|
|
12971
13299
|
|
|
13300
|
+
const logger = getModuleLogger()
|
|
13301
|
+
|
|
12972
13302
|
/**
|
|
12973
13303
|
* Exemple de composable utilisant VueUse
|
|
12974
13304
|
*/
|
|
@@ -12995,6 +13325,7 @@ export function useExample() {
|
|
|
12995
13325
|
}
|
|
12996
13326
|
|
|
12997
13327
|
// src/plugins/registry.ts
|
|
13328
|
+
var logger49 = getModuleLogger();
|
|
12998
13329
|
var pluginRegistry = [
|
|
12999
13330
|
// ANIMATION
|
|
13000
13331
|
framerMotionPlugin,
|
|
@@ -13007,6 +13338,7 @@ var pluginRegistry = [
|
|
|
13007
13338
|
// FORMS
|
|
13008
13339
|
reactHookFormPlugin,
|
|
13009
13340
|
zodPlugin,
|
|
13341
|
+
svelteFormsPlugin,
|
|
13010
13342
|
// HTTP
|
|
13011
13343
|
axiosPlugin,
|
|
13012
13344
|
tanstackQueryPlugin,
|
|
@@ -13022,6 +13354,7 @@ var pluginRegistry = [
|
|
|
13022
13354
|
reactRouterPlugin,
|
|
13023
13355
|
tanstackRouterPlugin,
|
|
13024
13356
|
vueRouterPlugin,
|
|
13357
|
+
svelteKitPlugin,
|
|
13025
13358
|
// STATE
|
|
13026
13359
|
jotaiPlugin,
|
|
13027
13360
|
piniaPlugin,
|
|
@@ -13031,6 +13364,7 @@ var pluginRegistry = [
|
|
|
13031
13364
|
reactTestingLibraryPlugin,
|
|
13032
13365
|
vueTestingLibraryPlugin,
|
|
13033
13366
|
vueTestUtilsPlugin,
|
|
13367
|
+
svelteTestingLibraryPlugin,
|
|
13034
13368
|
// TOOLING
|
|
13035
13369
|
eslintPlugin,
|
|
13036
13370
|
eslintVuePlugin,
|
|
@@ -13049,6 +13383,7 @@ var pluginRegistry = [
|
|
|
13049
13383
|
shadcnUiPlugin,
|
|
13050
13384
|
shadcnUiNextjsPlugin,
|
|
13051
13385
|
vuetifyPlugin,
|
|
13386
|
+
skeletonUiPlugin,
|
|
13052
13387
|
// UTILS
|
|
13053
13388
|
dateFnsPlugin,
|
|
13054
13389
|
vueusePlugin
|
|
@@ -13064,14 +13399,14 @@ function validatePlugin(plugin) {
|
|
|
13064
13399
|
];
|
|
13065
13400
|
for (const field of requiredFields) {
|
|
13066
13401
|
if (!(field in plugin) || plugin[field] === void 0) {
|
|
13067
|
-
|
|
13402
|
+
logger49.error(`Plugin validation failed: missing field '${field}'`, {
|
|
13068
13403
|
plugin: plugin.name
|
|
13069
13404
|
});
|
|
13070
13405
|
return false;
|
|
13071
13406
|
}
|
|
13072
13407
|
}
|
|
13073
13408
|
if (!Object.values(Category).includes(plugin.category)) {
|
|
13074
|
-
|
|
13409
|
+
logger49.error(
|
|
13075
13410
|
`Plugin validation failed: invalid category '${plugin.category}'`,
|
|
13076
13411
|
{
|
|
13077
13412
|
plugin: plugin.name
|
|
@@ -13080,7 +13415,7 @@ function validatePlugin(plugin) {
|
|
|
13080
13415
|
return false;
|
|
13081
13416
|
}
|
|
13082
13417
|
if (!Array.isArray(plugin.frameworks) || plugin.frameworks.length === 0) {
|
|
13083
|
-
|
|
13418
|
+
logger49.error(
|
|
13084
13419
|
`Plugin validation failed: 'frameworks' must be a non-empty array`,
|
|
13085
13420
|
{
|
|
13086
13421
|
plugin: plugin.name
|
|
@@ -13089,13 +13424,13 @@ function validatePlugin(plugin) {
|
|
|
13089
13424
|
return false;
|
|
13090
13425
|
}
|
|
13091
13426
|
if (typeof plugin.install !== "function") {
|
|
13092
|
-
|
|
13427
|
+
logger49.error(`Plugin validation failed: 'install' must be a function`, {
|
|
13093
13428
|
plugin: plugin.name
|
|
13094
13429
|
});
|
|
13095
13430
|
return false;
|
|
13096
13431
|
}
|
|
13097
13432
|
if (typeof plugin.configure !== "function") {
|
|
13098
|
-
|
|
13433
|
+
logger49.error(`Plugin validation failed: 'configure' must be a function`, {
|
|
13099
13434
|
plugin: plugin.name
|
|
13100
13435
|
});
|
|
13101
13436
|
return false;
|
|
@@ -13113,7 +13448,7 @@ function validateRegistry(plugins) {
|
|
|
13113
13448
|
}
|
|
13114
13449
|
}
|
|
13115
13450
|
if (invalidPlugins.length > 0) {
|
|
13116
|
-
|
|
13451
|
+
logger49.warn(`Some plugins failed validation and were excluded:`, {
|
|
13117
13452
|
invalidPlugins,
|
|
13118
13453
|
total: plugins.length,
|
|
13119
13454
|
valid: validPlugins.length
|
|
@@ -13127,10 +13462,38 @@ function getValidatedRegistry() {
|
|
|
13127
13462
|
function getPluginsByCategory(category) {
|
|
13128
13463
|
return getValidatedRegistry().filter((p) => p.category === category);
|
|
13129
13464
|
}
|
|
13465
|
+
function getCompatiblePlugins(ctx) {
|
|
13466
|
+
return getValidatedRegistry().filter((plugin) => {
|
|
13467
|
+
if (!plugin.frameworks.includes(ctx.framework)) {
|
|
13468
|
+
return false;
|
|
13469
|
+
}
|
|
13470
|
+
if (plugin.requiresTypeScript === true && !ctx.typescript) {
|
|
13471
|
+
return false;
|
|
13472
|
+
}
|
|
13473
|
+
if (plugin.bundlers && plugin.bundlers.length > 0) {
|
|
13474
|
+
if (ctx.bundler === null || !plugin.bundlers.includes(ctx.bundler)) {
|
|
13475
|
+
return false;
|
|
13476
|
+
}
|
|
13477
|
+
}
|
|
13478
|
+
return true;
|
|
13479
|
+
});
|
|
13480
|
+
}
|
|
13481
|
+
function getRecommendedPlugins(ctx) {
|
|
13482
|
+
const compatible = getCompatiblePlugins(ctx);
|
|
13483
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
13484
|
+
for (const plugin of compatible) {
|
|
13485
|
+
const category = plugin.category;
|
|
13486
|
+
if (!categoryMap.has(category)) {
|
|
13487
|
+
categoryMap.set(category, plugin);
|
|
13488
|
+
}
|
|
13489
|
+
}
|
|
13490
|
+
return Array.from(categoryMap.values());
|
|
13491
|
+
}
|
|
13130
13492
|
|
|
13131
13493
|
export {
|
|
13132
|
-
ConfigWriter,
|
|
13133
13494
|
BackupManager,
|
|
13495
|
+
ConfigWriter,
|
|
13134
13496
|
pluginRegistry,
|
|
13135
|
-
getPluginsByCategory
|
|
13497
|
+
getPluginsByCategory,
|
|
13498
|
+
getRecommendedPlugins
|
|
13136
13499
|
};
|