@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,25 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompatibilityValidator,
|
|
3
3
|
allCompatibilityRules
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O2IJKLMT.js";
|
|
5
5
|
import {
|
|
6
6
|
BackupManager,
|
|
7
7
|
ConfigWriter,
|
|
8
8
|
getPluginsByCategory,
|
|
9
|
+
getRecommendedPlugins,
|
|
9
10
|
pluginRegistry
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZAGZRB7Y.js";
|
|
11
12
|
import {
|
|
12
13
|
PluginTracker
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
installPackages
|
|
16
|
-
} from "./chunk-MQV3WNMH.js";
|
|
14
|
+
} from "./chunk-WHV4KF4U.js";
|
|
17
15
|
import {
|
|
16
|
+
getModuleLogger,
|
|
18
17
|
logger
|
|
19
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QPEUT7QG.js";
|
|
20
19
|
import {
|
|
21
20
|
getTranslations
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3WLFBAII.js";
|
|
23
22
|
|
|
24
23
|
// src/core/framework-registry.ts
|
|
25
24
|
var frameworkRegistry = {
|
|
@@ -34,11 +33,11 @@ var frameworkRegistry = {
|
|
|
34
33
|
ts: "react-ts"
|
|
35
34
|
},
|
|
36
35
|
getSetupPrompt: async (language) => {
|
|
37
|
-
const { promptViteSetup } = await import("./vite-setup-
|
|
36
|
+
const { promptViteSetup } = await import("./vite-setup-GOJ73AYC.js");
|
|
38
37
|
return await promptViteSetup(language);
|
|
39
38
|
},
|
|
40
39
|
createProject: async (options, currentDir, language) => {
|
|
41
|
-
const { createViteProject } = await import("./vite-installer-
|
|
40
|
+
const { createViteProject } = await import("./vite-installer-PPES2JQY.js");
|
|
42
41
|
return await createViteProject(
|
|
43
42
|
options,
|
|
44
43
|
currentDir,
|
|
@@ -58,11 +57,11 @@ var frameworkRegistry = {
|
|
|
58
57
|
defaultBundler: "nextjs",
|
|
59
58
|
createCommand: "npm create next-app@latest",
|
|
60
59
|
getSetupPrompt: async (language) => {
|
|
61
|
-
const { promptNextjsSetup } = await import("./nextjs-setup-
|
|
60
|
+
const { promptNextjsSetup } = await import("./nextjs-setup-I5JJ43KS.js");
|
|
62
61
|
return await promptNextjsSetup(language);
|
|
63
62
|
},
|
|
64
63
|
createProject: async (options, currentDir, language) => {
|
|
65
|
-
const { createNextjsProject } = await import("./nextjs-installer-
|
|
64
|
+
const { createNextjsProject } = await import("./nextjs-installer-TQTRTWTQ.js");
|
|
66
65
|
return await createNextjsProject(
|
|
67
66
|
options,
|
|
68
67
|
currentDir,
|
|
@@ -86,11 +85,11 @@ var frameworkRegistry = {
|
|
|
86
85
|
ts: "vue-ts"
|
|
87
86
|
},
|
|
88
87
|
getSetupPrompt: async (language) => {
|
|
89
|
-
const { promptVueSetup } = await import("./vue-setup-
|
|
88
|
+
const { promptVueSetup } = await import("./vue-setup-3QAOL6JM.js");
|
|
90
89
|
return await promptVueSetup(language);
|
|
91
90
|
},
|
|
92
91
|
createProject: async (options, currentDir, language) => {
|
|
93
|
-
const { createVueProject } = await import("./vue-installer-
|
|
92
|
+
const { createVueProject } = await import("./vue-installer-XTKXJNTQ.js");
|
|
94
93
|
return await createVueProject(
|
|
95
94
|
options,
|
|
96
95
|
currentDir,
|
|
@@ -109,12 +108,16 @@ var frameworkRegistry = {
|
|
|
109
108
|
detectPackages: ["svelte", "@sveltejs/kit"],
|
|
110
109
|
defaultBundler: "vite",
|
|
111
110
|
createCommand: "npm create svelte@latest",
|
|
112
|
-
getSetupPrompt: async (
|
|
113
|
-
|
|
111
|
+
getSetupPrompt: async (language) => {
|
|
112
|
+
const { promptSvelteSetup } = await import("./svelte-setup-2IJCXART.js");
|
|
113
|
+
return await promptSvelteSetup(language);
|
|
114
114
|
},
|
|
115
|
-
createProject: async (
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
createProject: async (options, currentDir, language) => {
|
|
116
|
+
const { createSvelteProject } = await import("./svelte-installer-HWNNV2YK.js");
|
|
117
|
+
return await createSvelteProject(
|
|
118
|
+
options,
|
|
119
|
+
currentDir,
|
|
120
|
+
language
|
|
118
121
|
);
|
|
119
122
|
},
|
|
120
123
|
i18nKeys: {
|
|
@@ -278,18 +281,17 @@ var Installer = class {
|
|
|
278
281
|
/**
|
|
279
282
|
* @param ctx - Contexte du projet détecté
|
|
280
283
|
* @param validator - Validateur de compatibilité
|
|
281
|
-
* @param writer - Writer de configuration
|
|
282
284
|
* @param backupManager - Gestionnaire de backups
|
|
283
285
|
* @param fs - Système de fichiers optionnel (par défaut: filesystem réel via memfs.useAsNodeFs)
|
|
284
286
|
*/
|
|
285
|
-
constructor(ctx, validator,
|
|
287
|
+
constructor(ctx, validator, backupManager, _fs) {
|
|
286
288
|
this.ctx = ctx;
|
|
287
289
|
this.validator = validator;
|
|
288
|
-
this.writer = writer;
|
|
289
290
|
this.backupManager = backupManager;
|
|
290
291
|
this.tracker = new PluginTracker(ctx.projectRoot, ctx.fsAdapter);
|
|
291
292
|
}
|
|
292
293
|
tracker;
|
|
294
|
+
logger = getModuleLogger();
|
|
293
295
|
/**
|
|
294
296
|
* Installe un ensemble de plugins
|
|
295
297
|
*
|
|
@@ -306,7 +308,7 @@ var Installer = class {
|
|
|
306
308
|
*/
|
|
307
309
|
async install(plugins, options) {
|
|
308
310
|
const startTime = Date.now();
|
|
309
|
-
logger.info(`Starting installation of ${plugins.length} plugin(s)`);
|
|
311
|
+
this.logger.info(`Starting installation of ${plugins.length} plugin(s)`);
|
|
310
312
|
try {
|
|
311
313
|
await this.tracker.load();
|
|
312
314
|
const notInstalledPromises = plugins.map(async (p) => {
|
|
@@ -314,9 +316,9 @@ var Installer = class {
|
|
|
314
316
|
const isDetected = p.detect ? await p.detect(this.ctx) : false;
|
|
315
317
|
const isInstalled = isTracked || isDetected;
|
|
316
318
|
if (isInstalled) {
|
|
317
|
-
logger.info(`${p.displayName} is already installed, skipping...`);
|
|
319
|
+
this.logger.info(`${p.displayName} is already installed, skipping...`);
|
|
318
320
|
if (isDetected && !isTracked) {
|
|
319
|
-
logger.debug(
|
|
321
|
+
this.logger.debug(
|
|
320
322
|
`${p.displayName} detected but not tracked, adding to tracker...`
|
|
321
323
|
);
|
|
322
324
|
try {
|
|
@@ -331,7 +333,7 @@ var Installer = class {
|
|
|
331
333
|
}
|
|
332
334
|
});
|
|
333
335
|
} catch (error) {
|
|
334
|
-
logger.warn(
|
|
336
|
+
this.logger.warn(
|
|
335
337
|
`Failed to add ${p.displayName} to tracker: ${error instanceof Error ? error.message : String(error)}`
|
|
336
338
|
);
|
|
337
339
|
}
|
|
@@ -345,7 +347,7 @@ var Installer = class {
|
|
|
345
347
|
(p) => p !== null
|
|
346
348
|
);
|
|
347
349
|
if (notInstalled.length === 0) {
|
|
348
|
-
logger.info("All plugins are already installed");
|
|
350
|
+
this.logger.info("All plugins are already installed");
|
|
349
351
|
return {
|
|
350
352
|
success: true,
|
|
351
353
|
duration: Date.now() - startTime,
|
|
@@ -363,7 +365,7 @@ var Installer = class {
|
|
|
363
365
|
);
|
|
364
366
|
}
|
|
365
367
|
}
|
|
366
|
-
logger.debug("Validating plugins compatibility...");
|
|
368
|
+
this.logger.debug("Validating plugins compatibility...");
|
|
367
369
|
const validationResult = this.validator.validate(notInstalled, this.ctx);
|
|
368
370
|
if (!validationResult.valid) {
|
|
369
371
|
const errorMessages = validationResult.errors.map((e) => e.message).join("; ");
|
|
@@ -372,26 +374,27 @@ var Installer = class {
|
|
|
372
374
|
);
|
|
373
375
|
}
|
|
374
376
|
if (validationResult.warnings.length > 0) {
|
|
375
|
-
logger.warn(
|
|
377
|
+
this.logger.warn(
|
|
376
378
|
`Found ${validationResult.warnings.length} warning(s):`,
|
|
377
379
|
validationResult.warnings.map((w) => w.message)
|
|
378
380
|
);
|
|
379
381
|
}
|
|
380
|
-
logger.debug("Resolving dependencies...");
|
|
382
|
+
this.logger.debug("Resolving dependencies...");
|
|
381
383
|
const resolved = this.resolveDependencies(notInstalled);
|
|
382
384
|
const allPlugins = resolved.plugins;
|
|
383
385
|
if (resolved.autoInstalled.length > 0) {
|
|
384
|
-
logger.info(
|
|
386
|
+
this.logger.info(
|
|
385
387
|
`Auto-installing ${resolved.autoInstalled.length} required dependency(ies): ${resolved.autoInstalled.join(", ")}`
|
|
386
388
|
);
|
|
387
389
|
}
|
|
388
|
-
logger.debug("Running pre-install hooks...");
|
|
390
|
+
this.logger.debug("Running pre-install hooks...");
|
|
389
391
|
await this.runPreInstallHooks(allPlugins);
|
|
392
|
+
let installResults = [];
|
|
390
393
|
if (options?.skipPackageInstall) {
|
|
391
|
-
logger.info("Skipping package installation (--no-install mode)");
|
|
394
|
+
this.logger.info("Skipping package installation (--no-install mode)");
|
|
392
395
|
} else {
|
|
393
|
-
logger.debug("Installing packages...");
|
|
394
|
-
|
|
396
|
+
this.logger.debug("Installing packages...");
|
|
397
|
+
installResults = await this.installPackages(allPlugins);
|
|
395
398
|
const failedInstalls = installResults.filter((r) => !r.success);
|
|
396
399
|
if (failedInstalls.length > 0) {
|
|
397
400
|
throw new Error(
|
|
@@ -399,12 +402,12 @@ var Installer = class {
|
|
|
399
402
|
);
|
|
400
403
|
}
|
|
401
404
|
}
|
|
402
|
-
logger.debug("Configuring plugins...");
|
|
405
|
+
this.logger.debug("Configuring plugins...");
|
|
403
406
|
const configResults = [];
|
|
404
407
|
const filesCreated = [];
|
|
405
408
|
for (const plugin of allPlugins) {
|
|
406
409
|
try {
|
|
407
|
-
logger.debug(`Configuring ${plugin.displayName}...`);
|
|
410
|
+
this.logger.debug(`Configuring ${plugin.displayName}...`);
|
|
408
411
|
const configResult = await plugin.configure(this.ctx);
|
|
409
412
|
configResults.push(configResult);
|
|
410
413
|
filesCreated.push(...configResult.files || []);
|
|
@@ -415,30 +418,39 @@ var Installer = class {
|
|
|
415
418
|
}
|
|
416
419
|
} catch (error) {
|
|
417
420
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
418
|
-
logger.error(
|
|
421
|
+
this.logger.error(
|
|
419
422
|
`Configuration failed for ${plugin.displayName}: ${errorMessage}`
|
|
420
423
|
);
|
|
421
424
|
throw error;
|
|
422
425
|
}
|
|
423
426
|
}
|
|
424
|
-
logger.debug("Running post-install hooks...");
|
|
427
|
+
this.logger.debug("Running post-install hooks...");
|
|
425
428
|
await this.runPostInstallHooks(allPlugins);
|
|
426
|
-
logger.debug("Tracking installed plugins...");
|
|
429
|
+
this.logger.debug("Tracking installed plugins...");
|
|
430
|
+
const installResultsByName = /* @__PURE__ */ new Map();
|
|
431
|
+
for (let i = 0; i < allPlugins.length; i++) {
|
|
432
|
+
const plugin = allPlugins[i];
|
|
433
|
+
const result = installResults[i];
|
|
434
|
+
if (plugin && result) {
|
|
435
|
+
installResultsByName.set(plugin.name, result);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
427
438
|
for (const plugin of allPlugins) {
|
|
439
|
+
const installResult = installResultsByName.get(plugin.name);
|
|
428
440
|
await this.tracker.addPlugin({
|
|
429
441
|
name: plugin.name,
|
|
430
442
|
displayName: plugin.displayName,
|
|
431
443
|
category: plugin.category,
|
|
432
444
|
version: plugin.version,
|
|
433
445
|
packages: {
|
|
434
|
-
dependencies: [],
|
|
435
|
-
devDependencies: []
|
|
446
|
+
dependencies: installResult?.packages.dependencies ?? [],
|
|
447
|
+
devDependencies: installResult?.packages.devDependencies ?? []
|
|
436
448
|
}
|
|
437
449
|
});
|
|
438
450
|
}
|
|
439
451
|
const duration = Date.now() - startTime;
|
|
440
452
|
const installed = allPlugins.map((p) => p.name);
|
|
441
|
-
logger.info(
|
|
453
|
+
this.logger.info(
|
|
442
454
|
`Successfully installed ${installed.length} plugin(s) in ${duration}ms`
|
|
443
455
|
);
|
|
444
456
|
return {
|
|
@@ -450,13 +462,13 @@ var Installer = class {
|
|
|
450
462
|
};
|
|
451
463
|
} catch (error) {
|
|
452
464
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
453
|
-
logger.error(`Installation failed: ${errorMessage}`);
|
|
454
|
-
logger.debug("Rolling back changes...");
|
|
465
|
+
this.logger.error(`Installation failed: ${errorMessage}`);
|
|
466
|
+
this.logger.debug("Rolling back changes...");
|
|
455
467
|
try {
|
|
456
468
|
await this.rollback(plugins);
|
|
457
469
|
} catch (rollbackError) {
|
|
458
470
|
const rollbackMessage = rollbackError instanceof Error ? rollbackError.message : String(rollbackError);
|
|
459
|
-
logger.error(`Rollback failed: ${rollbackMessage}`);
|
|
471
|
+
this.logger.error(`Rollback failed: ${rollbackMessage}`);
|
|
460
472
|
}
|
|
461
473
|
const duration = Date.now() - startTime;
|
|
462
474
|
return {
|
|
@@ -491,7 +503,7 @@ var Installer = class {
|
|
|
491
503
|
}
|
|
492
504
|
for (const required of plugin.requires) {
|
|
493
505
|
if (!pluginMap.has(required)) {
|
|
494
|
-
logger.warn(
|
|
506
|
+
this.logger.warn(
|
|
495
507
|
`Plugin ${plugin.name} requires ${required}, but it's not available in the registry`
|
|
496
508
|
);
|
|
497
509
|
}
|
|
@@ -516,7 +528,7 @@ var Installer = class {
|
|
|
516
528
|
for (const plugin of plugins) {
|
|
517
529
|
try {
|
|
518
530
|
if (plugin.detect && await plugin.detect(this.ctx)) {
|
|
519
|
-
logger.debug(`${plugin.displayName} is already installed`);
|
|
531
|
+
this.logger.debug(`${plugin.displayName} is already installed`);
|
|
520
532
|
results.push({
|
|
521
533
|
packages: {},
|
|
522
534
|
success: true,
|
|
@@ -524,17 +536,13 @@ var Installer = class {
|
|
|
524
536
|
});
|
|
525
537
|
continue;
|
|
526
538
|
}
|
|
527
|
-
if (plugin.preInstall) {
|
|
528
|
-
await plugin.preInstall(this.ctx);
|
|
529
|
-
}
|
|
530
539
|
const result = await plugin.install(this.ctx);
|
|
531
|
-
if (plugin.postInstall) {
|
|
532
|
-
await plugin.postInstall(this.ctx);
|
|
533
|
-
}
|
|
534
540
|
results.push(result);
|
|
535
541
|
} catch (error) {
|
|
536
542
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
537
|
-
logger.error(
|
|
543
|
+
this.logger.error(
|
|
544
|
+
`Failed to install ${plugin.displayName}: ${errorMessage}`
|
|
545
|
+
);
|
|
538
546
|
results.push({
|
|
539
547
|
packages: {},
|
|
540
548
|
success: false,
|
|
@@ -542,39 +550,6 @@ var Installer = class {
|
|
|
542
550
|
});
|
|
543
551
|
}
|
|
544
552
|
}
|
|
545
|
-
const allDependencies = [];
|
|
546
|
-
const allDevDependencies = [];
|
|
547
|
-
for (const result of results) {
|
|
548
|
-
if (result.success && result.packages) {
|
|
549
|
-
if (result.packages.dependencies) {
|
|
550
|
-
allDependencies.push(...result.packages.dependencies);
|
|
551
|
-
}
|
|
552
|
-
if (result.packages.devDependencies) {
|
|
553
|
-
allDevDependencies.push(...result.packages.devDependencies);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
const allPackagesToInstall = [...allDependencies, ...allDevDependencies];
|
|
558
|
-
if (allPackagesToInstall.length > 0) {
|
|
559
|
-
const depsToInstall = allDependencies;
|
|
560
|
-
const devDepsToInstall = allDevDependencies;
|
|
561
|
-
if (depsToInstall.length > 0) {
|
|
562
|
-
await installPackages(depsToInstall, {
|
|
563
|
-
packageManager: this.ctx.packageManager,
|
|
564
|
-
projectRoot: this.ctx.projectRoot,
|
|
565
|
-
dev: false,
|
|
566
|
-
silent: false
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
if (devDepsToInstall.length > 0) {
|
|
570
|
-
await installPackages(devDepsToInstall, {
|
|
571
|
-
packageManager: this.ctx.packageManager,
|
|
572
|
-
projectRoot: this.ctx.projectRoot,
|
|
573
|
-
dev: true,
|
|
574
|
-
silent: false
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
553
|
return results;
|
|
579
554
|
}
|
|
580
555
|
/**
|
|
@@ -591,7 +566,7 @@ var Installer = class {
|
|
|
591
566
|
await plugin.preInstall(this.ctx);
|
|
592
567
|
} catch (error) {
|
|
593
568
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
594
|
-
logger.warn(
|
|
569
|
+
this.logger.warn(
|
|
595
570
|
`Pre-install hook failed for ${plugin.displayName}: ${errorMessage}`
|
|
596
571
|
);
|
|
597
572
|
}
|
|
@@ -612,7 +587,7 @@ var Installer = class {
|
|
|
612
587
|
await plugin.postInstall(this.ctx);
|
|
613
588
|
} catch (error) {
|
|
614
589
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
615
|
-
logger.warn(
|
|
590
|
+
this.logger.warn(
|
|
616
591
|
`Post-install hook failed for ${plugin.displayName}: ${errorMessage}`
|
|
617
592
|
);
|
|
618
593
|
}
|
|
@@ -627,15 +602,15 @@ var Installer = class {
|
|
|
627
602
|
* @internal
|
|
628
603
|
*/
|
|
629
604
|
async rollback(plugins) {
|
|
630
|
-
logger.debug("Starting rollback...");
|
|
605
|
+
this.logger.debug("Starting rollback...");
|
|
631
606
|
for (const plugin of plugins.reverse()) {
|
|
632
607
|
if (plugin.rollback) {
|
|
633
608
|
try {
|
|
634
609
|
await plugin.rollback(this.ctx);
|
|
635
|
-
logger.debug(`Rolled back ${plugin.displayName}`);
|
|
610
|
+
this.logger.debug(`Rolled back ${plugin.displayName}`);
|
|
636
611
|
} catch (error) {
|
|
637
612
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
638
|
-
logger.error(
|
|
613
|
+
this.logger.error(
|
|
639
614
|
`Rollback failed for ${plugin.displayName}: ${errorMessage}`
|
|
640
615
|
);
|
|
641
616
|
}
|
|
@@ -643,10 +618,10 @@ var Installer = class {
|
|
|
643
618
|
}
|
|
644
619
|
try {
|
|
645
620
|
await this.backupManager.restoreAll();
|
|
646
|
-
logger.debug("Restored all file backups");
|
|
621
|
+
this.logger.debug("Restored all file backups");
|
|
647
622
|
} catch (error) {
|
|
648
623
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
649
|
-
logger.error(`Failed to restore backups: ${errorMessage}`);
|
|
624
|
+
this.logger.error(`Failed to restore backups: ${errorMessage}`);
|
|
650
625
|
}
|
|
651
626
|
}
|
|
652
627
|
};
|
|
@@ -807,8 +782,22 @@ function displayNextSteps(lang) {
|
|
|
807
782
|
console.log();
|
|
808
783
|
}
|
|
809
784
|
|
|
810
|
-
// src/cli/
|
|
785
|
+
// src/cli/ui/logo.ts
|
|
811
786
|
import pc2 from "picocolors";
|
|
787
|
+
var LOGO = `
|
|
788
|
+
___________ __ _ ________
|
|
789
|
+
/ ____/ ____/__ ____ __ _/ // / / ____/
|
|
790
|
+
/ / / /_ / _ \\/ __ \\/ / / / // / / __/
|
|
791
|
+
/ /___/ __ / __/ / / / /_/ /__ / / /___
|
|
792
|
+
\\____/_/ /_/\\___/_/ /_/\\__,_/__/_/ \\____/
|
|
793
|
+
|
|
794
|
+
`;
|
|
795
|
+
function displayLogo() {
|
|
796
|
+
console.log(pc2.cyan(LOGO));
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// src/cli/commands/base-framework-command.ts
|
|
800
|
+
import pc3 from "picocolors";
|
|
812
801
|
var BaseFrameworkCommand = class {
|
|
813
802
|
/**
|
|
814
803
|
* Affiche les informations spécifiques du contexte détecté
|
|
@@ -836,17 +825,20 @@ var BaseFrameworkCommand = class {
|
|
|
836
825
|
* @param ctx - Contexte du projet
|
|
837
826
|
* @param _t - Traductions
|
|
838
827
|
*/
|
|
839
|
-
displayFrameworkMismatchWarning(ctx, _t) {
|
|
828
|
+
displayFrameworkMismatchWarning(ctx, _t, silent) {
|
|
829
|
+
if (silent) {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
840
832
|
const framework = this.getFramework();
|
|
841
833
|
const metadata = getFrameworkMetadata(framework);
|
|
842
834
|
console.log();
|
|
843
835
|
console.log(
|
|
844
|
-
|
|
836
|
+
pc3.yellow(
|
|
845
837
|
`\u26A0\uFE0F Framework d\xE9tect\xE9: ${ctx.framework}. Cette commande est destin\xE9e aux projets ${metadata?.displayName || framework}.`
|
|
846
838
|
)
|
|
847
839
|
);
|
|
848
840
|
console.log(
|
|
849
|
-
|
|
841
|
+
pc3.gray(
|
|
850
842
|
`Utilisez "npx @configjs/cli ${ctx.framework}" pour les projets ${ctx.framework}.`
|
|
851
843
|
)
|
|
852
844
|
);
|
|
@@ -858,20 +850,23 @@ var BaseFrameworkCommand = class {
|
|
|
858
850
|
* @param ctx - Contexte du projet
|
|
859
851
|
* @param t - Traductions
|
|
860
852
|
*/
|
|
861
|
-
displayDetectedContext(ctx, t) {
|
|
853
|
+
displayDetectedContext(ctx, t, silent) {
|
|
854
|
+
if (silent) {
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
862
857
|
console.log(
|
|
863
|
-
|
|
858
|
+
pc3.green(` \u2713 ${t.detection.framework}: `) + pc3.bold(`${ctx.framework} ${pc3.gray(ctx.frameworkVersion)}`)
|
|
864
859
|
);
|
|
865
860
|
console.log(
|
|
866
|
-
|
|
861
|
+
pc3.green(` \u2713 ${t.detection.typescript}: `) + pc3.bold(ctx.typescript ? "Oui" : "Non")
|
|
867
862
|
);
|
|
868
863
|
if (ctx.bundler) {
|
|
869
864
|
console.log(
|
|
870
|
-
|
|
865
|
+
pc3.green(` \u2713 ${t.detection.bundler}: `) + pc3.bold(`${ctx.bundler} ${pc3.gray(ctx.bundlerVersion || "")}`)
|
|
871
866
|
);
|
|
872
867
|
}
|
|
873
868
|
console.log(
|
|
874
|
-
|
|
869
|
+
pc3.green(` \u2713 ${t.detection.packageManager}: `) + pc3.bold(ctx.packageManager)
|
|
875
870
|
);
|
|
876
871
|
this.displayFrameworkSpecificInfo(ctx, t);
|
|
877
872
|
console.log();
|
|
@@ -885,9 +880,12 @@ var BaseFrameworkCommand = class {
|
|
|
885
880
|
* @returns Liste des plugins sélectionnés
|
|
886
881
|
*/
|
|
887
882
|
async selectPlugins(ctx, language, options) {
|
|
888
|
-
if (options.yes) {
|
|
889
|
-
|
|
890
|
-
|
|
883
|
+
if (options.yes || options.silent) {
|
|
884
|
+
const recommended = getRecommendedPlugins(ctx);
|
|
885
|
+
if (!options.silent) {
|
|
886
|
+
logger.info("Using default recommendations (--yes mode)");
|
|
887
|
+
}
|
|
888
|
+
return recommended;
|
|
891
889
|
}
|
|
892
890
|
return promptPluginSelection(ctx, pluginRegistry, language);
|
|
893
891
|
}
|
|
@@ -915,30 +913,33 @@ var BaseFrameworkCommand = class {
|
|
|
915
913
|
if (!options.dryRun) {
|
|
916
914
|
return false;
|
|
917
915
|
}
|
|
916
|
+
if (options.silent) {
|
|
917
|
+
return true;
|
|
918
|
+
}
|
|
918
919
|
console.log();
|
|
919
|
-
console.log(
|
|
920
|
-
console.log(
|
|
921
|
-
console.log(
|
|
920
|
+
console.log(pc3.bold(pc3.yellow("\u2501".repeat(60))));
|
|
921
|
+
console.log(pc3.bold(pc3.yellow("\u{1F50D} MODE DRY-RUN (simulation uniquement)")));
|
|
922
|
+
console.log(pc3.bold(pc3.yellow("\u2501".repeat(60))));
|
|
922
923
|
console.log();
|
|
923
|
-
console.log(
|
|
924
|
+
console.log(pc3.bold(pc3.cyan("\u{1F4E6} Packages \xE0 installer :")));
|
|
924
925
|
for (const plugin of selectedPlugins) {
|
|
925
926
|
console.log(
|
|
926
|
-
|
|
927
|
+
pc3.blue(` \u2022 ${plugin.displayName}`) + pc3.gray(
|
|
927
928
|
` (${plugin.name}${plugin.version ? `@${plugin.version}` : ""})`
|
|
928
929
|
)
|
|
929
930
|
);
|
|
930
931
|
}
|
|
931
932
|
console.log();
|
|
932
|
-
console.log(
|
|
933
|
+
console.log(pc3.bold(pc3.cyan("\u{1F4DD} Fichiers qui seraient cr\xE9\xE9s/modifi\xE9s :")));
|
|
933
934
|
for (const plugin of selectedPlugins) {
|
|
934
|
-
console.log(
|
|
935
|
+
console.log(pc3.gray(` \u2022 ${plugin.displayName} configuration`));
|
|
935
936
|
}
|
|
936
937
|
console.log();
|
|
937
938
|
console.log(
|
|
938
|
-
|
|
939
|
+
pc3.yellow("\u26A0\uFE0F Aucune modification n'a \xE9t\xE9 effectu\xE9e (dry-run)")
|
|
939
940
|
);
|
|
940
941
|
console.log(
|
|
941
|
-
|
|
942
|
+
pc3.cyan("\u{1F4A1} Ex\xE9cutez sans --dry-run pour appliquer les changements")
|
|
942
943
|
);
|
|
943
944
|
console.log();
|
|
944
945
|
return true;
|
|
@@ -956,11 +957,16 @@ var BaseFrameworkCommand = class {
|
|
|
956
957
|
const backupManager = new BackupManager();
|
|
957
958
|
const configWriter = new ConfigWriter(backupManager);
|
|
958
959
|
const validator = new CompatibilityValidator(allCompatibilityRules);
|
|
959
|
-
const
|
|
960
|
+
const ctxWithServices = {
|
|
961
|
+
...ctx,
|
|
962
|
+
backupManager,
|
|
963
|
+
configWriter
|
|
964
|
+
};
|
|
965
|
+
const installer = new Installer(ctxWithServices, validator, backupManager);
|
|
960
966
|
if (options.install === false) {
|
|
961
967
|
console.log();
|
|
962
|
-
console.log(
|
|
963
|
-
console.log(
|
|
968
|
+
console.log(pc3.yellow("\u2699\uFE0F Mode configuration uniquement (--no-install)"));
|
|
969
|
+
console.log(pc3.gray("Les packages ne seront PAS install\xE9s"));
|
|
964
970
|
console.log();
|
|
965
971
|
}
|
|
966
972
|
const spinner = new SpinnerManager();
|
|
@@ -998,37 +1004,55 @@ ${t.installation.error}`);
|
|
|
998
1004
|
*/
|
|
999
1005
|
async execute(options) {
|
|
1000
1006
|
try {
|
|
1001
|
-
|
|
1007
|
+
if (options.silent) {
|
|
1008
|
+
logger.setLevel(4 /* SILENT */);
|
|
1009
|
+
} else if (options.debug) {
|
|
1010
|
+
logger.setLevel(0 /* DEBUG */);
|
|
1011
|
+
} else {
|
|
1012
|
+
logger.setLevel(1 /* INFO */);
|
|
1013
|
+
}
|
|
1014
|
+
if (!options.silent) {
|
|
1015
|
+
displayLogo();
|
|
1016
|
+
}
|
|
1017
|
+
const language = options.silent ? "en" : await promptLanguage();
|
|
1002
1018
|
const t = getTranslations(language);
|
|
1003
|
-
|
|
1004
|
-
|
|
1019
|
+
if (!options.silent) {
|
|
1020
|
+
console.log();
|
|
1021
|
+
console.log(pc3.bold(pc3.cyan(`\u{1F50D} ${t.detection.detecting}`)));
|
|
1022
|
+
}
|
|
1005
1023
|
const projectRoot = process.cwd();
|
|
1006
1024
|
const ctx = await this.getOrCreateContext(projectRoot, language);
|
|
1007
1025
|
if (!this.validateFramework(ctx)) {
|
|
1008
|
-
this.displayFrameworkMismatchWarning(ctx, t);
|
|
1026
|
+
this.displayFrameworkMismatchWarning(ctx, t, Boolean(options.silent));
|
|
1009
1027
|
return;
|
|
1010
1028
|
}
|
|
1011
|
-
this.displayDetectedContext(ctx, t);
|
|
1029
|
+
this.displayDetectedContext(ctx, t, Boolean(options.silent));
|
|
1012
1030
|
const selectedPlugins = await this.selectPlugins(ctx, language, options);
|
|
1013
1031
|
if (selectedPlugins.length === 0) {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1032
|
+
if (!options.silent) {
|
|
1033
|
+
console.log();
|
|
1034
|
+
console.log(pc3.yellow(`\u26A0\uFE0F ${t.common.selected(0)}`));
|
|
1035
|
+
console.log(pc3.gray("Exiting..."));
|
|
1036
|
+
}
|
|
1017
1037
|
return;
|
|
1018
1038
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1039
|
+
if (!options.silent) {
|
|
1040
|
+
console.log();
|
|
1041
|
+
console.log(
|
|
1042
|
+
pc3.bold(pc3.green(`\u2713 ${t.common.selected(selectedPlugins.length)}`))
|
|
1043
|
+
);
|
|
1044
|
+
console.log();
|
|
1045
|
+
}
|
|
1024
1046
|
const confirmed = await this.confirmInstallation(
|
|
1025
1047
|
selectedPlugins,
|
|
1026
1048
|
language,
|
|
1027
1049
|
options
|
|
1028
1050
|
);
|
|
1029
1051
|
if (!confirmed) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1052
|
+
if (!options.silent) {
|
|
1053
|
+
console.log();
|
|
1054
|
+
console.log(pc3.gray(t.common.cancel));
|
|
1055
|
+
}
|
|
1032
1056
|
return;
|
|
1033
1057
|
}
|
|
1034
1058
|
if (this.handleDryRun(selectedPlugins, options)) {
|
|
@@ -1038,7 +1062,9 @@ ${t.installation.error}`);
|
|
|
1038
1062
|
} catch (error) {
|
|
1039
1063
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1040
1064
|
logger.error(`Fatal error: ${errorMessage}`);
|
|
1041
|
-
|
|
1065
|
+
if (!options.silent) {
|
|
1066
|
+
console.error("Fatal error:", errorMessage);
|
|
1067
|
+
}
|
|
1042
1068
|
process.exit(1);
|
|
1043
1069
|
}
|
|
1044
1070
|
}
|