@configjs/cli 1.0.6 → 1.0.8

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.
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  CompatibilityValidator,
3
3
  compatibilityRules
4
- } from "./chunk-G5QBS6TL.js";
4
+ } from "./chunk-VJ254HJY.js";
5
5
  import {
6
6
  pluginRegistry
7
- } from "./chunk-UB6NBZEM.js";
7
+ } from "./chunk-EFP4AZE6.js";
8
8
  import {
9
9
  logger
10
- } from "./chunk-5S5KGCVY.js";
10
+ } from "./chunk-QRFLHLFE.js";
11
11
  import "./chunk-QGM4M3NI.js";
12
12
 
13
13
  // src/cli/commands/check.ts
@@ -8,7 +8,7 @@ import {
8
8
  readPackageJson,
9
9
  writeFileContent,
10
10
  writePackageJson
11
- } from "./chunk-5S5KGCVY.js";
11
+ } from "./chunk-QRFLHLFE.js";
12
12
 
13
13
  // src/types/index.ts
14
14
  var Category = /* @__PURE__ */ ((Category2) => {
@@ -6,7 +6,7 @@ import {
6
6
  readPackageJson,
7
7
  readTsConfig,
8
8
  writeFileContent
9
- } from "./chunk-5S5KGCVY.js";
9
+ } from "./chunk-QRFLHLFE.js";
10
10
 
11
11
  // src/core/detector.ts
12
12
  import { resolve, join } from "path";
@@ -12,7 +12,7 @@ var Logger = class {
12
12
  }
13
13
  info(message, ...args) {
14
14
  if (this.level <= 1 /* INFO */) {
15
- console.log(pc.blue(`\u2139 ${message}`), ...args);
15
+ console.log(pc.cyan(`\u2139 ${message}`), ...args);
16
16
  }
17
17
  }
18
18
  success(message, ...args) {
@@ -22,7 +22,7 @@ var Logger = class {
22
22
  }
23
23
  warn(message, ...args) {
24
24
  if (this.level <= 2 /* WARN */) {
25
- console.warn(pc.yellow(`\u26A0 ${message}`), ...args);
25
+ console.warn(pc.yellow(`\u26A0\uFE0F ${message}`), ...args);
26
26
  }
27
27
  }
28
28
  error(message, ...args) {
@@ -30,6 +30,30 @@ var Logger = class {
30
30
  console.error(pc.red(`\u2716 ${message}`), ...args);
31
31
  }
32
32
  }
33
+ header(message) {
34
+ if (this.level <= 1 /* INFO */) {
35
+ console.log();
36
+ console.log(pc.bold(pc.magenta(`\u25C6 ${message}`)));
37
+ console.log();
38
+ }
39
+ }
40
+ section(title) {
41
+ if (this.level <= 1 /* INFO */) {
42
+ console.log();
43
+ console.log(pc.bold(pc.cyan(`\u25B8 ${title}`)));
44
+ }
45
+ }
46
+ item(message, color = "gray") {
47
+ if (this.level <= 1 /* INFO */) {
48
+ const colorFn = pc[color];
49
+ console.log(colorFn(` \u2022 ${message}`));
50
+ }
51
+ }
52
+ dim(message) {
53
+ if (this.level <= 1 /* INFO */) {
54
+ console.log(pc.gray(` ${message}`));
55
+ }
56
+ }
33
57
  step(message) {
34
58
  if (this.level <= 1 /* INFO */) {
35
59
  console.log(pc.cyan(`
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-5S5KGCVY.js";
3
+ } from "./chunk-QRFLHLFE.js";
4
4
 
5
5
  // src/core/validator.ts
6
6
  var CompatibilityValidator = class {
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import "./chunk-QGM4M3NI.js";
5
5
  import { Command } from "commander";
6
6
 
7
7
  // package.json
8
- var version = "1.0.6";
8
+ var version = "1.0.8";
9
9
 
10
10
  // src/cli.ts
11
11
  var program = new Command();
@@ -13,7 +13,7 @@ program.name("confjs").description("Configure your frontend stack, instantly").v
13
13
  program.command("react").description("Configure a React project").option("-y, --yes", "Accept all defaults").option("-d, --dry-run", "Simulate without writing to disk").option("-s, --silent", "Non-interactive mode").option("--debug", "Enable debug logs").option("-c, --config <file>", "Use configuration file").option("-f, --force", "Force installation (overwrite configs)").option("--no-install", "Generate configs only, skip package installation").action(
14
14
  async (options) => {
15
15
  try {
16
- const { installReact } = await import("./install-GBC5BFJA.js");
16
+ const { installReact } = await import("./install-J2GB2RDX.js");
17
17
  await installReact(options);
18
18
  } catch (error) {
19
19
  console.error("Error:", error);
@@ -23,7 +23,7 @@ program.command("react").description("Configure a React project").option("-y, --
23
23
  );
24
24
  program.command("list").description("List available libraries").option("-c, --category <category>", "Filter by category").action(async (options) => {
25
25
  try {
26
- const { listLibraries } = await import("./list-HKDWBO2I.js");
26
+ const { listLibraries } = await import("./list-KFWAHR6Z.js");
27
27
  listLibraries(options);
28
28
  } catch (error) {
29
29
  console.error("Error:", error);
@@ -32,7 +32,7 @@ program.command("list").description("List available libraries").option("-c, --ca
32
32
  });
33
33
  program.command("check").description("Check compatibility without installing").option("-c, --config <file>", "Configuration file to check").action(async (options) => {
34
34
  try {
35
- const { checkCompatibility } = await import("./check-4Y5YGVVD.js");
35
+ const { checkCompatibility } = await import("./check-2TRO5TLL.js");
36
36
  await checkCompatibility(options);
37
37
  } catch (error) {
38
38
  console.error("Error:", error);
@@ -41,7 +41,7 @@ program.command("check").description("Check compatibility without installing").o
41
41
  });
42
42
  program.command("installed").description("List installed plugins").action(async () => {
43
43
  try {
44
- const { installedCommand } = await import("./installed-BXP7ZWOU.js");
44
+ const { installedCommand } = await import("./installed-G2RXXXZ6.js");
45
45
  await installedCommand();
46
46
  } catch (error) {
47
47
  console.error("Error:", error);
@@ -50,7 +50,7 @@ program.command("installed").description("List installed plugins").action(async
50
50
  });
51
51
  program.command("remove <plugin>").description("Remove an installed plugin").action(async (plugin) => {
52
52
  try {
53
- const { removeCommand } = await import("./remove-ZZD67W4M.js");
53
+ const { removeCommand } = await import("./remove-QDF5BA6U.js");
54
54
  await removeCommand(plugin);
55
55
  } catch (error) {
56
56
  console.error("Error:", error);
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  CompatibilityValidator,
3
3
  compatibilityRules
4
- } from "./chunk-G5QBS6TL.js";
4
+ } from "./chunk-VJ254HJY.js";
5
5
  import {
6
6
  BackupManager,
7
7
  ConfigWriter,
8
8
  getPluginsByCategory,
9
9
  pluginRegistry
10
- } from "./chunk-UB6NBZEM.js";
10
+ } from "./chunk-EFP4AZE6.js";
11
11
  import {
12
12
  PluginTracker,
13
13
  detectContext
14
- } from "./chunk-AMLNK7QR.js";
14
+ } from "./chunk-QDVUNUTK.js";
15
15
  import {
16
16
  installPackages,
17
17
  logger
18
- } from "./chunk-5S5KGCVY.js";
18
+ } from "./chunk-QRFLHLFE.js";
19
19
  import "./chunk-QGM4M3NI.js";
20
20
 
21
21
  // src/cli/prompts/language.ts
@@ -558,15 +558,16 @@ var Installer = class {
558
558
  */
559
559
  async installPackages(plugins) {
560
560
  const results = [];
561
- const installPromises = plugins.map(async (plugin) => {
561
+ for (const plugin of plugins) {
562
562
  try {
563
563
  if (plugin.detect && await plugin.detect(this.ctx)) {
564
564
  logger.debug(`${plugin.displayName} is already installed`);
565
- return {
565
+ results.push({
566
566
  packages: {},
567
567
  success: true,
568
568
  message: "Already installed"
569
- };
569
+ });
570
+ continue;
570
571
  }
571
572
  if (plugin.preInstall) {
572
573
  await plugin.preInstall(this.ctx);
@@ -575,22 +576,20 @@ var Installer = class {
575
576
  if (plugin.postInstall) {
576
577
  await plugin.postInstall(this.ctx);
577
578
  }
578
- return result;
579
+ results.push(result);
579
580
  } catch (error) {
580
581
  const errorMessage = error instanceof Error ? error.message : String(error);
581
582
  logger.error(`Failed to install ${plugin.displayName}: ${errorMessage}`);
582
- return {
583
+ results.push({
583
584
  packages: {},
584
585
  success: false,
585
586
  message: errorMessage
586
- };
587
+ });
587
588
  }
588
- });
589
- const installResults = await Promise.all(installPromises);
590
- results.push(...installResults);
589
+ }
591
590
  const allDependencies = [];
592
591
  const allDevDependencies = [];
593
- for (const result of installResults) {
592
+ for (const result of results) {
594
593
  if (result.success && result.packages) {
595
594
  if (result.packages.dependencies) {
596
595
  allDependencies.push(...result.packages.dependencies);
@@ -611,7 +610,6 @@ var Installer = class {
611
610
  dev: false,
612
611
  silent: false
613
612
  });
614
- await new Promise((resolve) => setTimeout(resolve, 500));
615
613
  }
616
614
  if (devDepsToInstall.length > 0) {
617
615
  await installPackages(devDepsToInstall, {
@@ -620,7 +618,6 @@ var Installer = class {
620
618
  dev: true,
621
619
  silent: false
622
620
  });
623
- await new Promise((resolve) => setTimeout(resolve, 500));
624
621
  }
625
622
  }
626
623
  return results;
@@ -791,85 +788,95 @@ var SpinnerManager = class {
791
788
  };
792
789
 
793
790
  // src/cli/ui/report.ts
791
+ import pc from "picocolors";
794
792
  function displayInstallationReport(report, plugins, lang) {
795
793
  const t = getTranslations(lang);
796
- console.log(`
797
- ${t.report.title}`);
794
+ console.log();
795
+ console.log(pc.bold(pc.green("\u2501".repeat(60))));
796
+ console.log(pc.bold(pc.green(`\u2728 ${t.report.title}`)));
798
797
  if (report.duration > 0) {
799
798
  const durationSeconds = (report.duration / 1e3).toFixed(1);
800
- console.log(` (${durationSeconds}s)
801
- `);
802
- } else {
803
- console.log("");
799
+ console.log(pc.gray(` Temps d'installation: ${durationSeconds}s`));
804
800
  }
801
+ console.log(pc.bold(pc.green("\u2501".repeat(60))));
802
+ console.log();
805
803
  if (report.installed.length > 0) {
806
- console.log(`${t.report.packagesInstalled}:`);
804
+ console.log(pc.bold(pc.cyan(`\u{1F4E6} ${t.report.packagesInstalled}:`)));
807
805
  for (const pluginName of report.installed) {
808
806
  const plugin = plugins.find((p) => p.name === pluginName);
809
- const version = plugin?.version ? ` (${plugin.version})` : "";
810
- console.log(` \u2713 ${plugin?.displayName || pluginName}${version}`);
807
+ const version = plugin?.version ? pc.gray(` (${plugin.version})`) : "";
808
+ console.log(
809
+ pc.green(` \u2713 ${plugin?.displayName || pluginName}`) + version
810
+ );
811
811
  }
812
- console.log("");
812
+ console.log();
813
813
  }
814
814
  const createdFiles = report.filesCreated.filter((f) => f.type === "create");
815
815
  if (createdFiles.length > 0) {
816
- console.log(`${t.report.filesCreated}:`);
816
+ console.log(pc.bold(pc.cyan(`\u{1F4DD} ${t.report.filesCreated}:`)));
817
817
  for (const file of createdFiles) {
818
- console.log(` \u2022 ${file.path}`);
818
+ console.log(pc.blue(` \u2022 ${file.path}`));
819
819
  }
820
- console.log("");
820
+ console.log();
821
821
  }
822
822
  const modifiedFiles = report.filesCreated.filter((f) => f.type === "modify");
823
823
  if (modifiedFiles.length > 0) {
824
- console.log(`${t.report.filesModified}:`);
824
+ console.log(pc.bold(pc.cyan(`\u{1F4DD} ${t.report.filesModified}:`)));
825
825
  for (const file of modifiedFiles) {
826
- console.log(` \u2022 ${file.path}`);
826
+ console.log(pc.yellow(` \u2022 ${file.path}`));
827
827
  }
828
- console.log("");
828
+ console.log();
829
829
  }
830
830
  if (report.warnings.length > 0) {
831
- console.log(`\u26A0\uFE0F ${report.warnings.length} warning(s):`);
831
+ console.log(pc.bold(pc.yellow(`\u26A0\uFE0F ${report.warnings.length} warning(s):`)));
832
832
  for (const warning of report.warnings) {
833
- console.log(` \u26A0 ${warning.message}`);
833
+ console.log(pc.yellow(` \u26A0\uFE0F ${warning.message}`));
834
834
  if (warning.plugins && warning.plugins.length > 0) {
835
- console.log(` Plugins: ${warning.plugins.join(", ")}`);
835
+ console.log(pc.gray(` Plugins: ${warning.plugins.join(", ")}`));
836
836
  }
837
837
  }
838
- console.log("");
838
+ console.log();
839
839
  }
840
840
  displayNextSteps(lang);
841
841
  }
842
842
  function displayNextSteps(lang) {
843
843
  const t = getTranslations(lang);
844
- console.log(`${t.report.nextSteps}:`);
845
- console.log(" 1. npm run dev");
846
- console.log(" 2. Visitez http://localhost:5173");
847
- console.log(" 3. Consultez la documentation dans src/");
848
- console.log("");
844
+ console.log(pc.bold(pc.magenta(`\u{1F680} ${t.report.nextSteps}:`)));
845
+ console.log(pc.cyan(" 1. ") + pc.bold("npm run dev"));
846
+ console.log(
847
+ pc.cyan(" 2. ") + "Visitez " + pc.underline(pc.blue("http://localhost:5173"))
848
+ );
849
+ console.log(
850
+ pc.cyan(" 3. ") + "Consultez la documentation dans " + pc.italic("src/")
851
+ );
852
+ console.log();
849
853
  }
850
854
 
851
855
  // src/cli/commands/install.ts
856
+ import pc2 from "picocolors";
852
857
  async function installReact(options) {
853
858
  try {
854
859
  const language = await promptLanguage();
855
860
  const t = getTranslations(language);
856
- console.log(`
857
- ${t.detection.detecting}`);
861
+ console.log();
862
+ console.log(pc2.bold(pc2.cyan(`\u{1F50D} ${t.detection.detecting}`)));
858
863
  const projectRoot = process.cwd();
859
864
  const ctx = await detectContext(projectRoot);
860
865
  console.log(
861
- ` \u2713 ${t.detection.framework}: ${ctx.framework} ${ctx.frameworkVersion}`
866
+ pc2.green(` \u2713 ${t.detection.framework}: `) + pc2.bold(`${ctx.framework} ${pc2.gray(ctx.frameworkVersion)}`)
862
867
  );
863
868
  console.log(
864
- ` \u2713 ${t.detection.typescript}: ${ctx.typescript ? "Oui" : "Non"}`
869
+ pc2.green(` \u2713 ${t.detection.typescript}: `) + pc2.bold(ctx.typescript ? "Oui" : "Non")
865
870
  );
866
871
  if (ctx.bundler) {
867
872
  console.log(
868
- ` \u2713 ${t.detection.bundler}: ${ctx.bundler} ${ctx.bundlerVersion || ""}`
873
+ pc2.green(` \u2713 ${t.detection.bundler}: `) + pc2.bold(`${ctx.bundler} ${pc2.gray(ctx.bundlerVersion || "")}`)
869
874
  );
870
875
  }
871
- console.log(` \u2713 ${t.detection.packageManager}: ${ctx.packageManager}
872
- `);
876
+ console.log(
877
+ pc2.green(` \u2713 ${t.detection.packageManager}: `) + pc2.bold(ctx.packageManager)
878
+ );
879
+ console.log();
873
880
  let selectedPlugins = [];
874
881
  if (options.yes) {
875
882
  logger.info("Using default recommendations (--yes mode)");
@@ -881,13 +888,16 @@ ${t.detection.detecting}`);
881
888
  );
882
889
  }
883
890
  if (selectedPlugins.length === 0) {
884
- console.log(`
885
- ${t.common.selected(0)}`);
886
- console.log("Exiting...");
891
+ console.log();
892
+ console.log(pc2.yellow(`\u26A0\uFE0F ${t.common.selected(0)}`));
893
+ console.log(pc2.gray("Exiting..."));
887
894
  return;
888
895
  }
889
- console.log(`
890
- ${t.common.selected(selectedPlugins.length)}`);
896
+ console.log();
897
+ console.log(
898
+ pc2.bold(pc2.green(`\u2713 ${t.common.selected(selectedPlugins.length)}`))
899
+ );
900
+ console.log();
891
901
  if (!options.yes && !options.silent) {
892
902
  const confirmed = await promptConfirmation(selectedPlugins, language);
893
903
  if (!confirmed) {
@@ -896,20 +906,32 @@ ${t.common.selected(selectedPlugins.length)}`);
896
906
  }
897
907
  }
898
908
  if (options.dryRun) {
899
- console.log("\n\u{1F50D} MODE DRY-RUN (simulation uniquement)");
900
- console.log("\u2501".repeat(50));
901
- console.log("\n\u{1F4E6} Packages \xE0 installer :");
909
+ console.log();
910
+ console.log(pc2.bold(pc2.yellow("\u2501".repeat(60))));
911
+ console.log(pc2.bold(pc2.yellow("\u{1F50D} MODE DRY-RUN (simulation uniquement)")));
912
+ console.log(pc2.bold(pc2.yellow("\u2501".repeat(60))));
913
+ console.log();
914
+ console.log(pc2.bold(pc2.cyan("\u{1F4E6} Packages \xE0 installer :")));
902
915
  for (const plugin of selectedPlugins) {
903
916
  console.log(
904
- ` ${plugin.name}${plugin.version ? `@${plugin.version}` : ""}`
917
+ pc2.blue(` \u2022 ${plugin.displayName}`) + pc2.gray(
918
+ ` (${plugin.name}${plugin.version ? `@${plugin.version}` : ""})`
919
+ )
905
920
  );
906
921
  }
907
- console.log("\n\u{1F4DD} Fichiers qui seraient cr\xE9\xE9s/modifi\xE9s :");
922
+ console.log();
923
+ console.log(pc2.bold(pc2.cyan("\u{1F4DD} Fichiers qui seraient cr\xE9\xE9s/modifi\xE9s :")));
908
924
  for (const plugin of selectedPlugins) {
909
- console.log(` ${plugin.displayName} configuration`);
925
+ console.log(pc2.gray(` \u2022 ${plugin.displayName} configuration`));
910
926
  }
911
- console.log("\n\u26A0\uFE0F Aucune modification n'a \xE9t\xE9 effectu\xE9e (dry-run)");
912
- console.log("\u{1F4A1} Ex\xE9cutez sans --dry-run pour appliquer les changements");
927
+ console.log();
928
+ console.log(
929
+ pc2.yellow("\u26A0\uFE0F Aucune modification n'a \xE9t\xE9 effectu\xE9e (dry-run)")
930
+ );
931
+ console.log(
932
+ pc2.cyan("\u{1F4A1} Ex\xE9cutez sans --dry-run pour appliquer les changements")
933
+ );
934
+ console.log();
913
935
  return;
914
936
  }
915
937
  const backupManager = new BackupManager();
@@ -917,8 +939,10 @@ ${t.common.selected(selectedPlugins.length)}`);
917
939
  const validator = new CompatibilityValidator(compatibilityRules);
918
940
  const installer = new Installer(ctx, validator, configWriter, backupManager);
919
941
  if (options.install === false) {
920
- console.log("\n\u2699\uFE0F Mode configuration uniquement (--no-install)");
921
- console.log("Les packages ne seront PAS install\xE9s\n");
942
+ console.log();
943
+ console.log(pc2.yellow("\u2699\uFE0F Mode configuration uniquement (--no-install)"));
944
+ console.log(pc2.gray("Les packages ne seront PAS install\xE9s"));
945
+ console.log();
922
946
  }
923
947
  const spinner = new SpinnerManager();
924
948
  spinner.start(t.installation.installing);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  PluginTracker,
3
3
  detectContext
4
- } from "./chunk-AMLNK7QR.js";
4
+ } from "./chunk-QDVUNUTK.js";
5
5
  import {
6
6
  logger
7
- } from "./chunk-5S5KGCVY.js";
7
+ } from "./chunk-QRFLHLFE.js";
8
8
  import "./chunk-QGM4M3NI.js";
9
9
 
10
10
  // src/cli/commands/installed.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  pluginRegistry
3
- } from "./chunk-UB6NBZEM.js";
4
- import "./chunk-5S5KGCVY.js";
3
+ } from "./chunk-EFP4AZE6.js";
4
+ import "./chunk-QRFLHLFE.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
 
7
7
  // src/cli/commands/list.ts
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  PluginTracker,
3
3
  detectContext
4
- } from "./chunk-AMLNK7QR.js";
4
+ } from "./chunk-QDVUNUTK.js";
5
5
  import {
6
6
  logger
7
- } from "./chunk-5S5KGCVY.js";
7
+ } from "./chunk-QRFLHLFE.js";
8
8
  import {
9
9
  __commonJS,
10
10
  __require,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configjs/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "description": "Configure your frontend stack, instantly - Utilitaire CLI d'installation modulaire de bibliothèques frontend",
6
6
  "keywords": [