@solvro/config 3.0.0-beta.3 → 3.0.0-beta.5

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,10 +1,10 @@
1
1
  import {
2
2
  node
3
- } from "./chunk-YZ6XWZKU.js";
3
+ } from "./chunk-SSIOPEBQ.js";
4
4
  import {
5
5
  imports
6
- } from "./chunk-2FFRTMKL.js";
7
- import "./chunk-GO7SIG7Y.js";
6
+ } from "./chunk-Q35N55YW.js";
7
+ import "./chunk-SCLJ7FJW.js";
8
8
 
9
9
  // src/eslint/presets/adonis.ts
10
10
  import { configApp } from "@adonisjs/eslint-config";
@@ -49,4 +49,4 @@ var adonisPreset = () => {
49
49
  export {
50
50
  adonisPreset
51
51
  };
52
- //# sourceMappingURL=adonis-5T6VA5IU.js.map
52
+ //# sourceMappingURL=adonis-LA5LM6WX.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  default2,
3
- default5 as default3
4
- } from "./chunk-GO7SIG7Y.js";
3
+ default6 as default3
4
+ } from "./chunk-SCLJ7FJW.js";
5
5
 
6
6
  // src/eslint/configs/typescript-strict.ts
7
7
  import tseslint from "typescript-eslint";
@@ -182,4 +182,4 @@ export {
182
182
  typescriptStrict,
183
183
  unicorn
184
184
  };
185
- //# sourceMappingURL=chunk-NCPWMNFM.js.map
185
+ //# sourceMappingURL=chunk-2KQN4OEE.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  default2,
3
3
  default3
4
- } from "./chunk-GO7SIG7Y.js";
4
+ } from "./chunk-SCLJ7FJW.js";
5
5
 
6
6
  // src/eslint/configs/imports.ts
7
7
  var forbiddenUiLibraries = [
@@ -81,4 +81,4 @@ function imports({
81
81
  export {
82
82
  imports
83
83
  };
84
- //# sourceMappingURL=chunk-2FFRTMKL.js.map
84
+ //# sourceMappingURL=chunk-Q35N55YW.js.map
@@ -3,8 +3,9 @@ import { default as default2 } from "@eslint-community/eslint-plugin-eslint-comm
3
3
  import { default as default3 } from "eslint-plugin-antfu";
4
4
  import { default as default4 } from "eslint-plugin-import";
5
5
  import { default as default5 } from "eslint-plugin-n";
6
- import { default as default6 } from "eslint-plugin-unicorn";
7
- import { default as default7 } from "eslint-plugin-unused-imports";
6
+ import { default as default6 } from "eslint-plugin-regexp";
7
+ import { default as default7 } from "eslint-plugin-unicorn";
8
+ import { default as default8 } from "eslint-plugin-unused-imports";
8
9
 
9
10
  export {
10
11
  default2 as default,
@@ -12,6 +13,7 @@ export {
12
13
  default4 as default3,
13
14
  default5 as default4,
14
15
  default6 as default5,
15
- default7 as default6
16
+ default7 as default6,
17
+ default8 as default7
16
18
  };
17
- //# sourceMappingURL=chunk-GO7SIG7Y.js.map
19
+ //# sourceMappingURL=chunk-SCLJ7FJW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eslint/plugins.ts"],"sourcesContent":["export { default as pluginComments } from \"@eslint-community/eslint-plugin-eslint-comments\";\nexport { default as pluginAntfu } from \"eslint-plugin-antfu\";\nexport { default as pluginImport } from \"eslint-plugin-import\";\nexport { default as pluginNode } from \"eslint-plugin-n\";\nexport { default as pluginRegexp } from \"eslint-plugin-regexp\";\nexport { default as pluginUnicorn } from \"eslint-plugin-unicorn\";\nexport { default as pluginUnusedImports } from \"eslint-plugin-unused-imports\";\n"],"mappings":";AAAA,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAA8B;AACvC,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,gBAAsC;","names":["default"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  default4 as default2
3
- } from "./chunk-GO7SIG7Y.js";
3
+ } from "./chunk-SCLJ7FJW.js";
4
4
 
5
5
  // src/eslint/configs/node.ts
6
6
  function node() {
@@ -27,4 +27,4 @@ function node() {
27
27
  export {
28
28
  node
29
29
  };
30
- //# sourceMappingURL=chunk-YZ6XWZKU.js.map
30
+ //# sourceMappingURL=chunk-SSIOPEBQ.js.map
@@ -22,15 +22,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  mod
23
23
  ));
24
24
 
25
+ // node_modules/tsup/assets/cjs_shims.js
26
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
27
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
28
+
25
29
  // src/cli/index.ts
26
- var p11 = __toESM(require("@clack/prompts"), 1);
30
+ var p13 = __toESM(require("@clack/prompts"), 1);
27
31
  var import_commander = require("commander");
28
- var import_picocolors5 = __toESM(require("picocolors"), 1);
32
+ var import_picocolors8 = __toESM(require("picocolors"), 1);
29
33
 
30
34
  // package.json
31
35
  var package_default = {
32
36
  name: "@solvro/config",
33
- version: "3.0.0-beta.2",
37
+ version: "3.0.0-beta.4",
34
38
  description: "Solvro's engineering style guide",
35
39
  keywords: [
36
40
  "eslint",
@@ -115,6 +119,7 @@ var package_default = {
115
119
  "eslint-plugin-react-hooks": "^7.1.1",
116
120
  "eslint-plugin-react-refresh": "^0.5.2",
117
121
  "eslint-plugin-react-you-might-not-need-an-effect": "^0.10.1",
122
+ "eslint-plugin-regexp": "^3.1.0",
118
123
  "eslint-plugin-unicorn": "^64.0.0",
119
124
  "eslint-plugin-unused-imports": "^4.4.1",
120
125
  execa: "^9.6.1",
@@ -241,9 +246,9 @@ var confirmProjectType = async (projectType) => {
241
246
 
242
247
  // src/utils/is-git-clean.ts
243
248
  var import_node_child_process = require("child_process");
244
- function isGitClean() {
249
+ function isGitClean(options2) {
245
250
  try {
246
- (0, import_node_child_process.execSync)("git diff-index --quiet HEAD --");
251
+ (0, import_node_child_process.execSync)("git diff-index --quiet HEAD --", options2);
247
252
  return true;
248
253
  } catch {
249
254
  return false;
@@ -257,7 +262,7 @@ var import_node_assert = __toESM(require("assert"), 1);
257
262
  var import_promises = require("fs/promises");
258
263
  var import_node_path2 = __toESM(require("path"), 1);
259
264
  var import_detect = require("package-manager-detector/detect");
260
- var import_picocolors4 = __toESM(require("picocolors"), 1);
265
+ var import_picocolors5 = __toESM(require("picocolors"), 1);
261
266
  var import_semver = __toESM(require("semver"), 1);
262
267
 
263
268
  // src/utils/git-root.ts
@@ -349,11 +354,7 @@ var warnInconsistentUserAgent = ({
349
354
 
350
355
  Pr\xF3bujesz uruchomi\u0107 ten skrypt ${import_picocolors.default.yellow(userAgent.name)}-em, ale w tym projekcie wykryto mened\u017Cer pakiet\xF3w ${import_picocolors.default.yellow(detectedPackageManager)}.
351
356
  ${isSupportedPackageManager(detectedPackageManager) ? hintInstallWithDetected(PACKAGE_MANAGER_CONFIGS[detectedPackageManager]) : warnUnsupported(detectedPackageManager)}`;
352
- if (checkIsNonInteractive()) {
353
- console.error(warningMessage);
354
- } else {
355
- p4.cancel(warningMessage);
356
- }
357
+ p4.cancel(warningMessage);
357
358
  };
358
359
 
359
360
  // src/utils/warn-missing-lockfile.ts
@@ -371,37 +372,35 @@ ${import_picocolors2.default.white("Je\u015Bli to si\u0119 zgadza, zainstaluj na
371
372
 
372
373
  ${import_picocolors2.default.cyan(manager.installDependencies)}
373
374
  ${import_picocolors2.default.cyan(`${manager.downloadExecute} @solvro/config@latest`)}`;
374
- if (checkIsNonInteractive()) {
375
- console.error(warningMessage);
376
- } else {
377
- p5.cancel(warningMessage);
378
- }
375
+ p5.cancel(warningMessage);
379
376
  };
380
377
 
381
378
  // src/utils/warn-unsupported-package-manager.ts
382
379
  var p6 = __toESM(require("@clack/prompts"), 1);
380
+ var import_picocolors4 = __toESM(require("picocolors"), 1);
381
+
382
+ // src/utils/format-log.ts
383
383
  var import_picocolors3 = __toESM(require("picocolors"), 1);
384
+ var formatLink = (link) => import_picocolors3.default.white(import_picocolors3.default.underline(link));
385
+
386
+ // src/utils/warn-unsupported-package-manager.ts
384
387
  var warnUnsupportedPackageManager = ({
385
388
  userAgent
386
389
  }) => {
387
390
  const packageManager = userAgent ?? "<nieznany>";
388
- const warningMessage = `${import_picocolors3.default.red(import_picocolors3.default.bold(`\u26A0\uFE0F OSTRZE\u017BENIE: ${packageManager} nie jest obs\u0142ugiwany \u26A0\uFE0F`))}
391
+ const warningMessage = `${import_picocolors4.default.red(import_picocolors4.default.bold(`\u26A0\uFE0F OSTRZE\u017BENIE: ${packageManager} nie jest obs\u0142ugiwany \u26A0\uFE0F`))}
389
392
 
390
- Pr\xF3bujesz uruchomi\u0107 ten skrypt ${import_picocolors3.default.yellow(packageManager)}-em, ale @solvro/config obecnie dzia\u0142a tylko z nast\u0119puj\u0105cymi mened\u017Cerami pakiet\xF3w:
393
+ Pr\xF3bujesz uruchomi\u0107 ten skrypt ${import_picocolors4.default.yellow(packageManager)}-em, ale @solvro/config obecnie dzia\u0142a tylko z nast\u0119puj\u0105cymi mened\u017Cerami pakiet\xF3w:
391
394
 
392
- ${SUPPORTED_PACKAGE_MANAGERS.map((manager) => import_picocolors3.default.white(`- ${import_picocolors3.default.cyan(manager)}`)).join("\n")}
395
+ ${SUPPORTED_PACKAGE_MANAGERS.map((manager) => import_picocolors4.default.white(`- ${import_picocolors4.default.cyan(manager)}`)).join("\n")}
393
396
 
394
- ${import_picocolors3.default.white(`Chcesz, aby dodano wsparcie dla ${import_picocolors3.default.yellow(packageManager)}-a? Daj nam zna\u0107!`)}
395
- ${import_picocolors3.default.white(import_picocolors3.default.underline(BUG_TRACKER_URL))}
397
+ ${import_picocolors4.default.white(`Chcesz, aby dodano wsparcie dla ${import_picocolors4.default.yellow(packageManager)}-a? Daj nam zna\u0107!`)}
398
+ ${formatLink(BUG_TRACKER_URL)}
396
399
 
397
- ${import_picocolors3.default.white(`W mi\u0119dzyczasie u\u017Cyj innego mened\u017Cera:`)}
400
+ ${import_picocolors4.default.white(`W mi\u0119dzyczasie u\u017Cyj innego mened\u017Cera:`)}
398
401
 
399
- ${Object.values(PACKAGE_MANAGER_CONFIGS).map((config) => import_picocolors3.default.cyan(`${config.downloadExecute} @solvro/config`)).join(import_picocolors3.default.white("\nlub\n"))}`;
400
- if (checkIsNonInteractive()) {
401
- console.error(warningMessage);
402
- } else {
403
- p6.cancel(warningMessage);
404
- }
402
+ ${Object.values(PACKAGE_MANAGER_CONFIGS).map((config) => import_picocolors4.default.cyan(`${config.downloadExecute} @solvro/config`)).join(import_picocolors4.default.white("\nlub\n"))}`;
403
+ p6.cancel(warningMessage);
405
404
  };
406
405
 
407
406
  // src/utils/package-json.ts
@@ -449,7 +448,7 @@ var PackageJson = class {
449
448
  const json = await (0, import_local_pkg.loadPackageJSON)(projectRoot());
450
449
  if (json === null) {
451
450
  p7.cancel(
452
- `Nie znaleziono pliku ${import_picocolors4.default.cyan("package.json")}. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu.`
451
+ `Nie znaleziono pliku ${import_picocolors5.default.cyan("package.json")}. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu.`
453
452
  );
454
453
  process.exit(1);
455
454
  }
@@ -492,7 +491,7 @@ var PackageJson = class {
492
491
  const isNestJs = await (0, import_local_pkg.isPackageListed)("@nestjs/core");
493
492
  if (isReact && isAdonis) {
494
493
  p7.cancel(
495
- `Projekty korzystaj\u0105ce zar\xF3wno z ${import_picocolors4.default.magenta("Adonis")}a jak i ${import_picocolors4.default.cyan("React")}a nie s\u0105 wspierane.`
494
+ `Projekty korzystaj\u0105ce zar\xF3wno z ${import_picocolors5.default.magenta("Adonis")}a jak i ${import_picocolors5.default.cyan("React")}a nie s\u0105 wspierane.`
496
495
  );
497
496
  process.exit(1);
498
497
  }
@@ -586,7 +585,14 @@ var PackageJson = class {
586
585
  }
587
586
  async clearInstall() {
588
587
  const [command, ...options2] = this.manager.cleanInstall.split(" ");
589
- await $$(command, options2);
588
+ await runWithSpinner({
589
+ start: "Instalowanie pakiet\xF3w na \u015Bwie\u017Co",
590
+ stop: "Wszystkie pakiety zainstalowane \u{1F60D}",
591
+ error: "Instalacja pakiet\xF3w na \u015Bwie\u017Co nie powiod\u0142a si\u0119 \u{1F976}",
592
+ callback: async () => {
593
+ await $$(command, options2);
594
+ }
595
+ });
590
596
  }
591
597
  /**
592
598
  * Gets the pnpm major version from package.json packageManager field or user agent.
@@ -613,6 +619,38 @@ var PackageJson = class {
613
619
  }
614
620
  };
615
621
 
622
+ // src/utils/print-intro.ts
623
+ var p8 = __toESM(require("@clack/prompts"), 1);
624
+ var import_node_fs = require("fs");
625
+ var import_picocolors6 = __toESM(require("picocolors"), 1);
626
+ var printIntro = () => {
627
+ const packageJsonUrl = new URL("../../package.json", importMetaUrl);
628
+ const packageJson7 = JSON.parse((0, import_node_fs.readFileSync)(packageJsonUrl, "utf8"));
629
+ const packageRoot = new URL("../", packageJsonUrl);
630
+ const clean = isGitClean({ cwd: packageRoot, stdio: "ignore" });
631
+ const version = packageJson7.version == null || packageJson7.version.trim() === "" ? import_picocolors6.default.red("(unknown version)") : import_picocolors6.default.green(import_picocolors6.default.bold(`v${packageJson7.version}`));
632
+ const dirtyStatus = clean ? "" : import_picocolors6.default.white(" (dirty)");
633
+ p8.intro(
634
+ ` ${import_picocolors6.default.blueBright(import_picocolors6.default.bold("@solvro/config"))} ${version}${dirtyStatus} `
635
+ );
636
+ };
637
+
638
+ // src/utils/print-outro.ts
639
+ var p9 = __toESM(require("@clack/prompts"), 1);
640
+ var import_picocolors7 = __toESM(require("picocolors"), 1);
641
+ var PROJECT_DOCS_URL = "https://docs.solvro.pl/projects/creating#konfiguracja-repozytorium";
642
+ var printOutro = () => {
643
+ p9.log.success("Konfiguracja zako\u0144czona pomy\u015Blnie!");
644
+ p9.note(
645
+ `1. ${import_picocolors7.default.white(`${import_picocolors7.default.bold("Obowi\u0105zkowo")} zapoznaj si\u0119 z ${import_picocolors7.default.cyan("dokumentacj\u0105 tworzenia projekt\xF3w")}:`)}
646
+ ${formatLink(PROJECT_DOCS_URL)}
647
+ 2. ${import_picocolors7.default.white(`Pami\u0119taj o zostawianiu nam ${import_picocolors7.default.yellow("gwiazdek na GitHubie")}! \u2B50`)}
648
+ ${formatLink(REPO_URL)}`,
649
+ "Kolejne kroki"
650
+ );
651
+ p9.outro("Mi\u0142ego dnia! \u{1F44B}");
652
+ };
653
+
616
654
  // src/cli/install-commitlint.ts
617
655
  var import_promises2 = require("fs/promises");
618
656
  var import_node_path3 = __toESM(require("path"), 1);
@@ -653,8 +691,8 @@ var installCommitLint = async () => {
653
691
  };
654
692
 
655
693
  // src/cli/install-eslint.ts
656
- var p8 = __toESM(require("@clack/prompts"), 1);
657
- var import_node_fs = require("fs");
694
+ var p10 = __toESM(require("@clack/prompts"), 1);
695
+ var import_node_fs2 = require("fs");
658
696
  var fs = __toESM(require("fs/promises"), 1);
659
697
  var import_node_path4 = __toESM(require("path"), 1);
660
698
  var eslintConfigNames = [
@@ -683,15 +721,15 @@ var installEslint = async (isNonInteractive2 = false) => {
683
721
  if (type === "react" && await packageJson3.isNextJs()) {
684
722
  const is15 = await packageJson3.doesSatisfy("next", ">=15");
685
723
  if (!is15) {
686
- p8.cancel(
687
- "Next.js musi by\u0107 w conajmniej wersji 15. Zaktualizuj Next.js i spr\xF3buj ponownie.\nWi\u0119cej informacji tutaj: https://nextjs.org/docs/app/building-your-application/upgrading/version-15"
724
+ p10.cancel(
725
+ "Next.js musi by\u0107 w co najmniej wersji 15. Zaktualizuj Next.js i spr\xF3buj ponownie.\nWi\u0119cej informacji tutaj: https://nextjs.org/docs/app/building-your-application/upgrading/version-15"
688
726
  );
689
727
  process.exit(1);
690
728
  }
691
729
  await packageJson3.install("@next/eslint-plugin-next", { dev: true });
692
730
  }
693
731
  const eslintConfig = eslintConfigNames.find(
694
- (configName) => (0, import_node_fs.existsSync)(import_node_path4.default.join(root2, configName))
732
+ (configName) => (0, import_node_fs2.existsSync)(import_node_path4.default.join(root2, configName))
695
733
  );
696
734
  if (eslintConfig !== void 0) {
697
735
  const eslintContent = await fs.readFile(
@@ -699,17 +737,17 @@ var installEslint = async (isNonInteractive2 = false) => {
699
737
  "utf8"
700
738
  );
701
739
  if (eslintContent.includes("export default solvro(")) {
702
- p8.note("Eslint jest ju\u017C skonfigurowany. Pomijam.");
740
+ p10.log.warning("ESLint jest ju\u017C skonfigurowany. Pomijam.");
703
741
  return;
704
742
  } else {
705
743
  if (isNonInteractive2) {
706
744
  await fs.rm(import_node_path4.default.join(root2, eslintConfig));
707
745
  } else {
708
746
  const isConfirmed = await polishConfirm({
709
- message: `Znaleziono plik konfiguracyjny Eslint. Czy chcesz go nadpisa\u0107?`
747
+ message: `Znaleziono plik konfiguracyjny ESLint. Czy chcesz go nadpisa\u0107?`
710
748
  });
711
- if (p8.isCancel(isConfirmed) || !isConfirmed) {
712
- p8.cancel("Nadpisz plik konfiguracyjny Eslint i spr\xF3buj ponownie.");
749
+ if (p10.isCancel(isConfirmed) || !isConfirmed) {
750
+ p10.cancel("Nadpisz plik konfiguracyjny ESLint i spr\xF3buj ponownie.");
713
751
  process.exit(1);
714
752
  }
715
753
  await fs.rm(import_node_path4.default.join(root2, eslintConfig));
@@ -725,12 +763,12 @@ var installEslint = async (isNonInteractive2 = false) => {
725
763
  export default solvro();
726
764
  `
727
765
  );
728
- p8.note("Plik konfiguracyjny Eslint zosta\u0142 utworzony.");
766
+ p10.log.step("Plik konfiguracyjny ESLint zosta\u0142 utworzony.");
729
767
  };
730
768
 
731
769
  // src/cli/install-ga.ts
732
- var p9 = __toESM(require("@clack/prompts"), 1);
733
- var import_node_fs2 = require("fs");
770
+ var p11 = __toESM(require("@clack/prompts"), 1);
771
+ var import_node_fs3 = require("fs");
734
772
  var fs2 = __toESM(require("fs/promises"), 1);
735
773
  var import_node_path5 = __toESM(require("path"), 1);
736
774
 
@@ -993,8 +1031,8 @@ var installGithubActions = async () => {
993
1031
  const pnpmVersion = manager.name === "pnpm" ? await packageJson4.getPnpmVersion() : void 0;
994
1032
  const withCommitlint = await packageJson4.hasPackage("@commitlint/cli");
995
1033
  if (type === "adonis") {
996
- if (!(0, import_node_fs2.existsSync)(import_node_path5.default.join(projectDirectory, ".env.example"))) {
997
- p9.cancel(
1034
+ if (!(0, import_node_fs3.existsSync)(import_node_path5.default.join(projectDirectory, ".env.example"))) {
1035
+ p11.cancel(
998
1036
  "Nie znaleziono pliku .env.example. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu Adonisa."
999
1037
  );
1000
1038
  process.exit(1);
@@ -1045,12 +1083,12 @@ var installGithubActions = async () => {
1045
1083
  'prettier --write "src/**/*.ts" "test/**/*.ts"'
1046
1084
  );
1047
1085
  if (!formatScriptUpdated) {
1048
- p9.log.warn(
1086
+ p11.log.warning(
1049
1087
  "Aktualizacja skryptu format zosta\u0142a pomini\u0119ta, poniewa\u017C zosta\u0142 on zmieniony lub nie istnieje. R\u0119cznie zaktualizuj skrypt format w package.json, aby formatowa\u0142 wszystkie pliki projektu, a nie tylko te w katalogach src i test."
1050
1088
  );
1051
1089
  }
1052
1090
  }
1053
- if (!(0, import_node_fs2.existsSync)(import_node_path5.default.join(gitDirectory, ".github/dependabot.yml"))) {
1091
+ if (!(0, import_node_fs3.existsSync)(import_node_path5.default.join(gitDirectory, ".github/dependabot.yml"))) {
1054
1092
  await fs2.writeFile(
1055
1093
  import_node_path5.default.join(gitDirectory, ".github/dependabot.yml"),
1056
1094
  dependabot()
@@ -1060,7 +1098,7 @@ var installGithubActions = async () => {
1060
1098
  await packageJson4.addScriptIfNotExists("format:check", "prettier --check .");
1061
1099
  await packageJson4.addScriptIfNotExists("lint", "eslint . --max-warnings=0");
1062
1100
  await packageJson4.addScriptIfNotExists("types:check", "tsc --noEmit");
1063
- p9.note("Dodano konfiguracj\u0119 CI i skrypty.");
1101
+ p11.log.step("Dodano konfiguracj\u0119 CI i skrypty.");
1064
1102
  };
1065
1103
 
1066
1104
  // src/cli/install-lint-staged.ts
@@ -1085,9 +1123,9 @@ var installLintStaged = async () => {
1085
1123
  };
1086
1124
 
1087
1125
  // src/cli/install-prettier.ts
1088
- var p10 = __toESM(require("@clack/prompts"), 1);
1126
+ var p12 = __toESM(require("@clack/prompts"), 1);
1089
1127
  var import_node_assert4 = __toESM(require("assert"), 1);
1090
- var import_node_fs3 = require("fs");
1128
+ var import_node_fs4 = require("fs");
1091
1129
  var fs3 = __toESM(require("fs/promises"), 1);
1092
1130
  var import_node_path7 = __toESM(require("path"), 1);
1093
1131
  var prettierConfigNames = [
@@ -1114,12 +1152,12 @@ var installPrettier = async (isNonInteractive2 = false) => {
1114
1152
  version: ">=3"
1115
1153
  });
1116
1154
  const prettierConfig = prettierConfigNames.find(
1117
- (configName) => (0, import_node_fs3.existsSync)(import_node_path7.default.join(root2, configName))
1155
+ (configName) => (0, import_node_fs4.existsSync)(import_node_path7.default.join(root2, configName))
1118
1156
  );
1119
1157
  const solvroPrettierPath = "@solvro/config/prettier";
1120
1158
  if (prettierConfig !== void 0 || packageJson6.json.prettier !== void 0) {
1121
1159
  if (packageJson6.json.prettier === solvroPrettierPath) {
1122
- p10.note("Konfiguracja Prettiera jest ju\u017C ustawiona. Pomijam.");
1160
+ p12.log.warning("Konfiguracja Prettiera jest ju\u017C ustawiona. Pomijam.");
1123
1161
  return;
1124
1162
  }
1125
1163
  if (isNonInteractive2) {
@@ -1130,8 +1168,8 @@ var installPrettier = async (isNonInteractive2 = false) => {
1130
1168
  const isConfirmed = await polishConfirm({
1131
1169
  message: `Znaleziono konfiguracj\u0119 Prettiera. Czy chcesz j\u0105 nadpisa\u0107?`
1132
1170
  });
1133
- if (p10.isCancel(isConfirmed) || !isConfirmed) {
1134
- p10.cancel("Usu\u0144 konfiguracje Prettiera i spr\xF3buj ponownie.");
1171
+ if (p12.isCancel(isConfirmed) || !isConfirmed) {
1172
+ p12.cancel("Usu\u0144 konfiguracje Prettiera i spr\xF3buj ponownie.");
1135
1173
  process.exit(1);
1136
1174
  }
1137
1175
  for (const configName of prettierConfigNames) {
@@ -1141,7 +1179,7 @@ var installPrettier = async (isNonInteractive2 = false) => {
1141
1179
  }
1142
1180
  packageJson6.json.prettier = solvroPrettierPath;
1143
1181
  await packageJson6.save();
1144
- p10.note("Konfiguracja Prettiera zosta\u0142a dodana.");
1182
+ p12.log.step("Konfiguracja Prettiera zosta\u0142a dodana.");
1145
1183
  };
1146
1184
 
1147
1185
  // src/cli/index.ts
@@ -1151,43 +1189,40 @@ program.parse();
1151
1189
  var options = program.opts();
1152
1190
  var isNonInteractive = checkIsNonInteractive();
1153
1191
  async function main() {
1154
- if (!isNonInteractive) {
1155
- p11.intro(import_picocolors5.default.bold(import_picocolors5.default.bgBlue(" @solvro/config ")));
1156
- }
1192
+ printIntro();
1157
1193
  const packageJson7 = new PackageJson();
1158
1194
  packageJson7.verifyPackageManager();
1159
1195
  await packageJson7.load();
1160
1196
  await packageJson7.validateUserAgentConsistency();
1161
1197
  if (options.force !== true && !isGitClean()) {
1162
1198
  if (isNonInteractive) {
1163
- console.error(
1164
- "Repozytorium Git ma niezatwierdzone zmiany. U\u017Cyj --force, aby pomin\u0105\u0107 to sprawdzenie."
1165
- );
1199
+ p13.log.error("Repozytorium Git ma niezatwierdzone zmiany.");
1200
+ p13.cancel("U\u017Cyj --force, aby pomin\u0105\u0107 to sprawdzenie.");
1166
1201
  process.exit(1);
1167
1202
  }
1168
1203
  const isConfirmed = await polishConfirm({
1169
1204
  message: `Masz niezapisane zmiany w Git. Czy chcesz kontynuowa\u0107?`
1170
1205
  });
1171
- if (p11.isCancel(isConfirmed) || !isConfirmed) {
1172
- p11.cancel("Zapisz zmiany w Git i spr\xF3buj ponownie.");
1206
+ if (p13.isCancel(isConfirmed) || !isConfirmed) {
1207
+ p13.cancel("Zapisz zmiany w Git i spr\xF3buj ponownie.");
1173
1208
  process.exit(1);
1174
1209
  }
1175
1210
  }
1176
1211
  if (await packageJson7.hasPackage("eslint") && !await packageJson7.doesSatisfy("eslint", "<10")) {
1177
1212
  const eslint = await packageJson7.getPackageInfo("eslint");
1178
- const versionInfo = eslint?.version == null ? "" : ` Obecnie zainstalowana jest wersja ${import_picocolors5.default.yellow(eslint.version)}.`;
1179
- const errorMessage = `ESLint w wersji powy\u017Cej 9 ${import_picocolors5.default.red("nie jest jeszcze wspierany")}.${versionInfo}`;
1213
+ const versionInfo = eslint?.version == null ? "" : ` Obecnie zainstalowana jest wersja ${import_picocolors8.default.yellow(eslint.version)}.`;
1214
+ const errorMessage = `ESLint w wersji powy\u017Cej 9 nie jest jeszcze wspierany.${versionInfo}`;
1180
1215
  const errorRetry = "Prosz\u0119 zainstalowa\u0107 wersj\u0119 9 i spr\xF3bowa\u0107 ponownie.";
1181
1216
  if (isNonInteractive) {
1182
- console.error(errorMessage);
1183
- console.error(errorRetry);
1217
+ p13.log.error(errorMessage);
1218
+ p13.cancel(errorRetry);
1184
1219
  process.exit(1);
1185
1220
  }
1186
1221
  const isConfirmed = await polishConfirm({
1187
- message: `${errorMessage} Zainstalowa\u0107 starsz\u0105 wersj\u0119 ${import_picocolors5.default.magenta("ESLint")}'a? (Wymagane by kontynuowa\u0107)`
1222
+ message: `${errorMessage} Zainstalowa\u0107 starsz\u0105 wersj\u0119 ${import_picocolors8.default.magenta("ESLint")}'a? (Wymagane by kontynuowa\u0107)`
1188
1223
  });
1189
- if (p11.isCancel(isConfirmed) || !isConfirmed) {
1190
- p11.cancel(errorRetry);
1224
+ if (p13.isCancel(isConfirmed) || !isConfirmed) {
1225
+ p13.cancel(errorRetry);
1191
1226
  process.exit(1);
1192
1227
  }
1193
1228
  await packageJson7.install("eslint", { dev: true, version: "^9" });
@@ -1195,17 +1230,17 @@ async function main() {
1195
1230
  const projectType = await packageJson7.getProjectType();
1196
1231
  if (!isNonInteractive) {
1197
1232
  if (projectType === "adonis") {
1198
- await confirmProjectType(import_picocolors5.default.magenta("Adonis"));
1233
+ await confirmProjectType(import_picocolors8.default.magenta("Adonis"));
1199
1234
  }
1200
1235
  if (projectType === "react") {
1201
- await confirmProjectType(import_picocolors5.default.cyan("React"));
1236
+ await confirmProjectType(import_picocolors8.default.cyan("React"));
1202
1237
  }
1203
1238
  if (projectType === "nestjs") {
1204
- await confirmProjectType(import_picocolors5.default.red("NestJS"));
1239
+ await confirmProjectType(import_picocolors8.default.red("NestJS"));
1205
1240
  }
1206
1241
  if (projectType === "node") {
1207
- p11.cancel(
1208
- `Nie znaleziono ani ${import_picocolors5.default.magenta("Adonis")}-a, ${import_picocolors5.default.cyan("React")}-a, ani ${import_picocolors5.default.white("NestJS")}-a. Musisz r\u0119cznie konfigurowa\u0107 projekt.`
1242
+ p13.cancel(
1243
+ `Nie znaleziono ani ${import_picocolors8.default.magenta("Adonis")}-a, ${import_picocolors8.default.cyan("React")}-a, ani ${import_picocolors8.default.white("NestJS")}-a. Musisz r\u0119cznie konfigurowa\u0107 projekt.`
1209
1244
  );
1210
1245
  process.exit(1);
1211
1246
  }
@@ -1218,8 +1253,8 @@ async function main() {
1218
1253
  const isConfirmed = await polishConfirm({
1219
1254
  message: `Tw\xF3j projekt nie u\u017Cywa ESM (brak "type": "module" w package.json). Czy chcesz to doda\u0107? (Wymagane by kontynuowa\u0107)`
1220
1255
  });
1221
- if (p11.isCancel(isConfirmed) || !isConfirmed) {
1222
- p11.cancel("Zmie\u0144 projekt na ESM i spr\xF3buj ponownie.");
1256
+ if (p13.isCancel(isConfirmed) || !isConfirmed) {
1257
+ p13.cancel("Zmie\u0144 projekt na ESM i spr\xF3buj ponownie.");
1223
1258
  process.exit(1);
1224
1259
  }
1225
1260
  await packageJson7.ensureESM();
@@ -1243,41 +1278,42 @@ async function main() {
1243
1278
  toolsToInstall.push("commitlint");
1244
1279
  }
1245
1280
  if (toolsToInstall.length === 0) {
1246
- console.error(
1247
- "Nie wybrano \u017Cadnych narz\u0119dzi. U\u017Cyj --eslint, --prettier, --gh-action, --commitlint, lub --all"
1281
+ p13.log.error("Nie wybrano \u017Cadnych narz\u0119dzi.");
1282
+ p13.cancel(
1283
+ "U\u017Cyj --eslint, --prettier, --gh-action, --commitlint, lub --all"
1248
1284
  );
1249
1285
  process.exit(1);
1250
1286
  }
1251
1287
  } else {
1252
- const additionalTools = await p11.multiselect({
1253
- message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${import_picocolors5.default.gray("zaznacz spacj\u0105, potwierd\u017A enterem")}`,
1288
+ const additionalTools = await p13.multiselect({
1289
+ message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${import_picocolors8.default.gray("zaznacz spacj\u0105, potwierd\u017A enterem")}`,
1254
1290
  initialValues: ["eslint", "prettier", "gh-action", "commitlint"],
1255
1291
  options: [
1256
1292
  {
1257
1293
  value: "eslint",
1258
- label: import_picocolors5.default.bold(import_picocolors5.default.blueBright("ESLint")),
1294
+ label: import_picocolors8.default.bold(import_picocolors8.default.blueBright("ESLint")),
1259
1295
  hint: "sprawdzanie jako\u015Bci kodu"
1260
1296
  },
1261
1297
  {
1262
1298
  value: "prettier",
1263
- label: import_picocolors5.default.bold(import_picocolors5.default.yellowBright("Prettier")),
1299
+ label: import_picocolors8.default.bold(import_picocolors8.default.yellowBright("Prettier")),
1264
1300
  hint: "formatowanie"
1265
1301
  },
1266
1302
  {
1267
1303
  value: "gh-action",
1268
- label: import_picocolors5.default.bold("GitHub Actions"),
1304
+ label: import_picocolors8.default.bold("GitHub Actions"),
1269
1305
  hint: "automatyczne testy na GitHubie"
1270
1306
  },
1271
1307
  {
1272
1308
  value: "commitlint",
1273
- label: import_picocolors5.default.bold("Commitlint"),
1309
+ label: import_picocolors8.default.bold("Commitlint"),
1274
1310
  hint: "walidacja tre\u015Bci commit\xF3w"
1275
1311
  }
1276
1312
  ],
1277
1313
  required: false
1278
1314
  });
1279
- if (p11.isCancel(additionalTools) || additionalTools.length === 0) {
1280
- p11.cancel("Nie wybrano \u017Cadnych narz\u0119dzi.");
1315
+ if (p13.isCancel(additionalTools) || additionalTools.length === 0) {
1316
+ p13.cancel("Nie wybrano \u017Cadnych narz\u0119dzi.");
1281
1317
  process.exit(1);
1282
1318
  }
1283
1319
  toolsToInstall = additionalTools;
@@ -1303,26 +1339,18 @@ async function main() {
1303
1339
  if (toolsToInstall.includes("prettier")) {
1304
1340
  await packageJson7.localExecute("prettier", "--write", "package.json");
1305
1341
  }
1306
- const printSuccess = isNonInteractive ? console.info : p11.outro;
1307
- printSuccess("\u2705 Konfiguracja zako\u0144czona pomy\u015Blnie!");
1342
+ printOutro();
1308
1343
  }
1309
1344
  async function mainWrapper() {
1310
1345
  try {
1311
1346
  await main();
1312
1347
  } catch (error) {
1313
1348
  if (process.env.NODE_ENV === "development") {
1314
- console.error(
1315
- import_picocolors5.default.red("Unhandled error in main:"),
1316
- error instanceof Error ? error.message : error
1317
- );
1349
+ p13.cancel("Unhandled error in main:");
1350
+ console.error(error instanceof Error ? error.message : error);
1318
1351
  } else {
1319
- const errorMessage = "Wyst\u0105pi\u0142 nieoczekiwany b\u0142\u0105d :( Prosz\u0119 zg\u0142osi\u0107 go tw\xF3rcom:";
1320
- if (isNonInteractive) {
1321
- console.error(errorMessage);
1322
- console.error(BUG_TRACKER_URL);
1323
- } else {
1324
- p11.cancel(`${errorMessage} ${BUG_TRACKER_URL}`);
1325
- }
1352
+ p13.log.error("Wyst\u0105pi\u0142 nieoczekiwany b\u0142\u0105d :(");
1353
+ p13.cancel(`Prosz\u0119 zg\u0142osi\u0107 go tw\xF3rcom: ${BUG_TRACKER_URL}`);
1326
1354
  }
1327
1355
  process.exit(1);
1328
1356
  }