@solvro/config 2.1.0 → 2.2.0

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.
@@ -13,7 +13,7 @@ var adonisPreset = () => {
13
13
  return [
14
14
  ...builtinAdonisConfig,
15
15
  ...node(),
16
- ...imports(),
16
+ ...imports({ forbidDefaultExport: false }),
17
17
  {
18
18
  rules: {
19
19
  "@typescript-eslint/naming-convention": [
@@ -49,4 +49,4 @@ var adonisPreset = () => {
49
49
  export {
50
50
  adonisPreset
51
51
  };
52
- //# sourceMappingURL=adonis-IGPNFIOR.js.map
52
+ //# sourceMappingURL=adonis-TD3FMQKC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eslint/presets/adonis.ts"],"sourcesContent":["import type { ConfigWithExtends } from \"@eslint/config-helpers\";\n\nimport { configApp } from \"@adonisjs/eslint-config\";\n\nimport { imports } from \"../configs/imports\";\nimport { node } from \"../configs/node\";\n\nexport const adonisPreset = (): ConfigWithExtends[] => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call\n const builtinAdonisConfig: ConfigWithExtends[] = configApp();\n\n return [\n ...builtinAdonisConfig,\n ...node(),\n ...imports({ forbidDefaultExport: false }),\n {\n rules: {\n \"@typescript-eslint/naming-convention\": [\n \"error\",\n {\n selector: [\"enum\", \"enumMember\", \"class\", \"interface\", \"typeLike\"],\n format: [\"PascalCase\"],\n leadingUnderscore: \"allow\",\n trailingUnderscore: \"allow\",\n },\n {\n selector: [\n \"classProperty\",\n \"classMethod\",\n \"method\",\n \"variableLike\",\n ],\n format: [\"camelCase\"],\n leadingUnderscore: \"allow\",\n trailingUnderscore: \"allow\",\n },\n {\n selector: \"variable\",\n format: [\"camelCase\", \"UPPER_CASE\", \"PascalCase\"],\n leadingUnderscore: \"allow\",\n trailingUnderscore: \"allow\",\n },\n ],\n },\n },\n ];\n};\n"],"mappings":";;;;;;;;;AAEA,SAAS,iBAAiB;AAKnB,IAAM,eAAe,MAA2B;AAErD,QAAM,sBAA2C,UAAU;AAE3D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG,KAAK;AAAA,IACR,GAAG,QAAQ,EAAE,qBAAqB,MAAM,CAAC;AAAA,IACzC;AAAA,MACE,OAAO;AAAA,QACL,wCAAwC;AAAA,UACtC;AAAA,UACA;AAAA,YACE,UAAU,CAAC,QAAQ,cAAc,SAAS,aAAa,UAAU;AAAA,YACjE,QAAQ,CAAC,YAAY;AAAA,YACrB,mBAAmB;AAAA,YACnB,oBAAoB;AAAA,UACtB;AAAA,UACA;AAAA,YACE,UAAU;AAAA,cACR;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,YACA,QAAQ,CAAC,WAAW;AAAA,YACpB,mBAAmB;AAAA,YACnB,oBAAoB;AAAA,UACtB;AAAA,UACA;AAAA,YACE,UAAU;AAAA,YACV,QAAQ,CAAC,aAAa,cAAc,YAAY;AAAA,YAChD,mBAAmB;AAAA,YACnB,oBAAoB;AAAA,UACtB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -23,15 +23,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  ));
24
24
 
25
25
  // src/cli/index.ts
26
- var p6 = __toESM(require("@clack/prompts"), 1);
26
+ var p8 = __toESM(require("@clack/prompts"), 1);
27
27
  var import_commander = require("commander");
28
28
  var import_detect = require("package-manager-detector/detect");
29
- var import_picocolors = __toESM(require("picocolors"), 1);
29
+ var import_picocolors2 = __toESM(require("picocolors"), 1);
30
30
 
31
31
  // package.json
32
32
  var package_default = {
33
33
  name: "@solvro/config",
34
- version: "2.0.7",
34
+ version: "2.1.1",
35
35
  description: "Solvro's engineering style guide",
36
36
  keywords: [
37
37
  "eslint",
@@ -90,15 +90,15 @@ var package_default = {
90
90
  },
91
91
  prettier: "./dist/prettier/index.js",
92
92
  dependencies: {
93
- "@adonisjs/eslint-config": "^2.1.2",
94
- "@clack/prompts": "^0.11.0",
93
+ "@adonisjs/eslint-config": "^3.0.0",
94
+ "@clack/prompts": "^1.1.0",
95
95
  "@commitlint/config-conventional": "^20.4.3",
96
- "@darraghor/eslint-plugin-nestjs-typed": "^6.18.0",
96
+ "@darraghor/eslint-plugin-nestjs-typed": "^7.1.26",
97
97
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
98
98
  "@eslint/config-helpers": "^0.4.2",
99
99
  "@eslint/js": "^9.37.0",
100
100
  "@tanstack/eslint-plugin-query": "^5.91.4",
101
- "@trivago/prettier-plugin-sort-imports": "^5.2.2",
101
+ "@trivago/prettier-plugin-sort-imports": "^6.0.2",
102
102
  "@typescript-eslint/eslint-plugin": "^8.46.0",
103
103
  commander: "^14.0.3",
104
104
  "eslint-config-flat-gitignore": "^2.2.1",
@@ -110,18 +110,18 @@ var package_default = {
110
110
  "eslint-plugin-n": "^17.24.0",
111
111
  "eslint-plugin-react": "^7.37.5",
112
112
  "eslint-plugin-react-hooks": "^7.0.1",
113
- "eslint-plugin-react-refresh": "^0.4.26",
114
- "eslint-plugin-react-you-might-not-need-an-effect": "^0.6.1",
115
- "eslint-plugin-unicorn": "^61.0.2",
113
+ "eslint-plugin-react-refresh": "^0.5.2",
114
+ "eslint-plugin-react-you-might-not-need-an-effect": "^0.9.2",
115
+ "eslint-plugin-unicorn": "^63.0.0",
116
116
  "eslint-plugin-unused-imports": "^4.4.1",
117
117
  execa: "^9.6.1",
118
118
  "find-up-simple": "^1.0.1",
119
- globals: "^16.5.0",
119
+ globals: "^17.4.0",
120
120
  "is-interactive": "^2.0.0",
121
121
  "local-pkg": "^1.1.2",
122
122
  "package-manager-detector": "^1.6.0",
123
123
  picocolors: "^1.1.1",
124
- "prettier-plugin-packagejson": "^2.5.22",
124
+ "prettier-plugin-packagejson": "^3.0.2",
125
125
  "prettier-plugin-tailwindcss": "^0.7.2",
126
126
  semver: "^7.7.4",
127
127
  "typescript-eslint": "^8.56.1"
@@ -130,25 +130,25 @@ var package_default = {
130
130
  "@commitlint/cli": "^20.4.3",
131
131
  "@commitlint/types": "^20.4.3",
132
132
  "@eslint/config-inspector": "^1.5.0",
133
- "@next/eslint-plugin-next": "^15.5.12",
133
+ "@next/eslint-plugin-next": "^16.1.6",
134
134
  "@semantic-release/git": "^10.0.1",
135
135
  "@types/node": "^25.3.5",
136
136
  "@types/semver": "^7.7.1",
137
137
  "@typescript-eslint/utils": "^8.56.1",
138
138
  "@typescript/native-preview": "^7.0.0-dev.20251012.1",
139
- "@vitest/coverage-v8": "^3.2.4",
140
- "@vitest/ui": "^3.2.4",
139
+ "@vitest/coverage-v8": "^4.0.18",
140
+ "@vitest/ui": "^4.0.18",
141
141
  eslint: "^9.39.4",
142
142
  husky: "^9.1.7",
143
143
  knip: "^5.86.0",
144
144
  "lint-staged": "^16.3.2",
145
- "pkg-pr-new": "^0.0.60",
145
+ "pkg-pr-new": "^0.0.65",
146
146
  prettier: "^3.8.1",
147
147
  "semantic-release": "^25.0.3",
148
148
  tsup: "^8.5.1",
149
149
  tsx: "^4.21.0",
150
150
  typescript: "^5.9.3",
151
- vitest: "^3.2.4"
151
+ vitest: "^4.0.18"
152
152
  },
153
153
  peerDependencies: {
154
154
  "@next/eslint-plugin-next": ">=12.3.0",
@@ -166,6 +166,44 @@ var package_default = {
166
166
  }
167
167
  };
168
168
 
169
+ // src/constants/index.ts
170
+ var REPO_URL = "https://github.com/Solvro/lib-web-solvro-config";
171
+ var BUG_TRACKER_URL = `${REPO_URL}/issues/new`;
172
+
173
+ // src/utils/confirm-project-type.ts
174
+ var p2 = __toESM(require("@clack/prompts"), 1);
175
+
176
+ // src/utils/polish-confirm.ts
177
+ var p = __toESM(require("@clack/prompts"), 1);
178
+ var import_is_interactive = __toESM(require("is-interactive"), 1);
179
+ var polishConfirm = async (props) => {
180
+ if (!(0, import_is_interactive.default)()) {
181
+ return true;
182
+ }
183
+ return p.confirm({
184
+ active: "Tak",
185
+ inactive: "Nie",
186
+ ...props
187
+ });
188
+ };
189
+
190
+ // src/utils/confirm-project-type.ts
191
+ var confirmProjectType = async (projectType) => {
192
+ const isConfirmed = await polishConfirm({
193
+ message: `Wygl\u0105da jakby\u015B u\u017Cywa\u0142 ${projectType}'a. Czy to si\u0119 zgadza?`
194
+ });
195
+ if (p2.isCancel(isConfirmed)) {
196
+ p2.cancel("\u{1F621}");
197
+ process.exit(1);
198
+ }
199
+ if (!isConfirmed) {
200
+ p2.cancel(
201
+ `:( Zg\u0142o\u015B b\u0142\u0105d na GitHubie, a my spr\xF3bujemy pom\xF3c: ${BUG_TRACKER_URL}`
202
+ );
203
+ process.exit(1);
204
+ }
205
+ };
206
+
169
207
  // src/utils/is-git-clean.ts
170
208
  var import_node_child_process = require("child_process");
171
209
  function isGitClean() {
@@ -178,11 +216,12 @@ function isGitClean() {
178
216
  }
179
217
 
180
218
  // src/utils/package-json.ts
181
- var p = __toESM(require("@clack/prompts"), 1);
219
+ var p4 = __toESM(require("@clack/prompts"), 1);
182
220
  var import_local_pkg = require("local-pkg");
183
221
  var import_node_assert = __toESM(require("assert"), 1);
184
222
  var import_promises = require("fs/promises");
185
223
  var import_node_path2 = __toESM(require("path"), 1);
224
+ var import_picocolors = __toESM(require("picocolors"), 1);
186
225
  var import_semver = __toESM(require("semver"), 1);
187
226
 
188
227
  // src/utils/git-root.ts
@@ -219,23 +258,45 @@ var $$ = (async (...arguments_) => {
219
258
  return cachedExeca(...arguments_);
220
259
  });
221
260
 
261
+ // src/utils/run-with-spinner.ts
262
+ var p3 = __toESM(require("@clack/prompts"), 1);
263
+
222
264
  // src/utils/run-if-interactive.ts
223
- var import_is_interactive = __toESM(require("is-interactive"), 1);
265
+ var import_is_interactive2 = __toESM(require("is-interactive"), 1);
224
266
  var runIfInteractive = (function_) => {
225
- if ((0, import_is_interactive.default)()) {
267
+ if ((0, import_is_interactive2.default)()) {
226
268
  return function_();
227
269
  }
228
270
  return void 0;
229
271
  };
230
272
 
273
+ // src/utils/run-with-spinner.ts
274
+ var runWithSpinner = async (options2) => {
275
+ const spinner2 = p3.spinner();
276
+ runIfInteractive(() => {
277
+ spinner2.start(options2.start);
278
+ });
279
+ try {
280
+ await options2.callback();
281
+ } catch (error) {
282
+ runIfInteractive(() => {
283
+ spinner2.error(options2.error);
284
+ });
285
+ throw error;
286
+ }
287
+ runIfInteractive(() => {
288
+ spinner2.stop(options2.stop);
289
+ });
290
+ };
291
+
231
292
  // src/utils/package-json.ts
232
293
  var PackageJson = class {
233
294
  json = null;
234
295
  async load() {
235
296
  const json = await (0, import_local_pkg.loadPackageJSON)(projectRoot());
236
297
  if (json === null) {
237
- p.cancel(
238
- "Nie znaleziono package.json. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu."
298
+ p4.cancel(
299
+ `Nie znaleziono pliku ${import_picocolors.default.cyan("package.json")}. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu.`
239
300
  );
240
301
  process.exit(1);
241
302
  }
@@ -247,10 +308,13 @@ var PackageJson = class {
247
308
  async isNextJs() {
248
309
  return this.hasPackage("next");
249
310
  }
250
- async doesSatisfies(package_, version) {
311
+ async getPackageInfo(package_) {
312
+ return (0, import_local_pkg.getPackageInfo)(package_);
313
+ }
314
+ async doesSatisfy(package_, version) {
251
315
  await this.load();
252
316
  import_node_assert.default.ok(this.json !== null);
253
- const packageInfo = await (0, import_local_pkg.getPackageInfo)(package_);
317
+ const packageInfo = await this.getPackageInfo(package_);
254
318
  if (packageInfo?.version === void 0) {
255
319
  return false;
256
320
  }
@@ -274,9 +338,10 @@ var PackageJson = class {
274
338
  const isReact = await (0, import_local_pkg.isPackageListed)("react");
275
339
  const isNestJs = await (0, import_local_pkg.isPackageListed)("@nestjs/core");
276
340
  if (isReact && isAdonis) {
277
- throw new Error(
278
- "You can't use both Adonis and React in the same project"
341
+ p4.cancel(
342
+ `Projekty korzystaj\u0105ce zar\xF3wno z ${import_picocolors.default.magenta("Adonis")}a jak i ${import_picocolors.default.cyan("React")}a nie s\u0105 wspierane.`
279
343
  );
344
+ process.exit(1);
280
345
  }
281
346
  if (isNestJs) {
282
347
  return "nestjs";
@@ -306,29 +371,29 @@ var PackageJson = class {
306
371
  this.json.scripts[name] = script;
307
372
  await this.save();
308
373
  }
309
- async install(package_, options2) {
374
+ async install(package_, options2 = {}) {
310
375
  const isInstalled = await this.hasPackage(package_);
376
+ const installVersion = options2.version ?? "latest";
311
377
  if (!isInstalled) {
312
- const spinner2 = p.spinner();
313
- runIfInteractive(() => {
314
- spinner2.start(`Instalowanie ${package_}`);
315
- });
316
- await $$`npm i ${options2?.dev === true ? "-D" : ""} ${package_}@latest`;
317
- runIfInteractive(() => {
318
- spinner2.stop(`${package_} zainstalowany \u{1F60D}`);
378
+ await runWithSpinner({
379
+ start: `Instalowanie pakietu ${package_}`,
380
+ stop: `${package_} zainstalowany \u{1F60D}`,
381
+ error: `Instalacja pakietu ${package_} nie powiod\u0142a si\u0119 \u{1F976}`,
382
+ callback: async () => {
383
+ await $$`npm i ${options2.dev === true ? "-D" : ""} ${package_}@${installVersion}`;
384
+ }
319
385
  });
320
386
  await this.load();
321
387
  return;
322
388
  }
323
- const info = await (0, import_local_pkg.getPackageInfo)(package_);
324
- if (info?.version !== void 0 && options2?.minVersion !== void 0 && !import_semver.default.satisfies(info.version, options2.minVersion) || options2?.alwaysUpdate === true) {
325
- const spinner2 = p.spinner();
326
- runIfInteractive(() => {
327
- spinner2.start(`Aktualizowanie ${package_}`);
328
- });
329
- await $$`npm i ${options2.dev === true ? "-D" : ""} ${package_}@latest`;
330
- runIfInteractive(() => {
331
- spinner2.stop(`${package_} zaktualizowany \u{1F60D}`);
389
+ if (options2.alwaysUpdate === true || options2.version != null && !await this.doesSatisfy(package_, options2.version)) {
390
+ await runWithSpinner({
391
+ start: `Aktualizowanie pakietu ${package_}`,
392
+ stop: `${package_} zaktualizowany \u{1F60D}`,
393
+ error: `Aktualizacja pakietu ${package_} nie powiod\u0142a si\u0119 \u{1F976}`,
394
+ callback: async () => {
395
+ await $$`npm i ${options2.dev === true ? "-D" : ""} ${package_}@${installVersion}`;
396
+ }
332
397
  });
333
398
  await this.load();
334
399
  }
@@ -338,20 +403,6 @@ var PackageJson = class {
338
403
  }
339
404
  };
340
405
 
341
- // src/utils/polish-confirm.ts
342
- var p2 = __toESM(require("@clack/prompts"), 1);
343
- var import_is_interactive2 = __toESM(require("is-interactive"), 1);
344
- var polishConfirm = async (props) => {
345
- if (!(0, import_is_interactive2.default)()) {
346
- return true;
347
- }
348
- return p2.confirm({
349
- active: "Tak",
350
- inactive: "Nie",
351
- ...props
352
- });
353
- };
354
-
355
406
  // src/cli/install-commitlint.ts
356
407
  var import_promises2 = require("fs/promises");
357
408
  var import_node_path3 = __toESM(require("path"), 1);
@@ -391,7 +442,7 @@ var installCommitLint = async () => {
391
442
  };
392
443
 
393
444
  // src/cli/install-eslint.ts
394
- var p3 = __toESM(require("@clack/prompts"), 1);
445
+ var p5 = __toESM(require("@clack/prompts"), 1);
395
446
  var import_node_fs = require("fs");
396
447
  var fs = __toESM(require("fs/promises"), 1);
397
448
  var import_node_path4 = __toESM(require("path"), 1);
@@ -413,12 +464,15 @@ var packageJson3 = new PackageJson();
413
464
  var installEslint = async (isNonInteractive2 = false) => {
414
465
  const root2 = projectRoot();
415
466
  await packageJson3.load();
416
- await packageJson3.install("eslint", { dev: true, minVersion: ">=9" });
467
+ await packageJson3.install("eslint", {
468
+ dev: true,
469
+ version: "^9"
470
+ });
417
471
  const type = await packageJson3.getProjectType();
418
472
  if (type === "react" && await packageJson3.isNextJs()) {
419
- const is15 = await packageJson3.doesSatisfies("next", ">=15");
473
+ const is15 = await packageJson3.doesSatisfy("next", ">=15");
420
474
  if (!is15) {
421
- p3.cancel(
475
+ p5.cancel(
422
476
  "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"
423
477
  );
424
478
  process.exit(1);
@@ -434,7 +488,7 @@ var installEslint = async (isNonInteractive2 = false) => {
434
488
  "utf8"
435
489
  );
436
490
  if (eslintContent.includes("export default solvro(")) {
437
- p3.note("Eslint jest ju\u017C skonfigurowany. Pomijam.");
491
+ p5.note("Eslint jest ju\u017C skonfigurowany. Pomijam.");
438
492
  return;
439
493
  } else {
440
494
  if (isNonInteractive2) {
@@ -443,8 +497,8 @@ var installEslint = async (isNonInteractive2 = false) => {
443
497
  const isConfirmed = await polishConfirm({
444
498
  message: `Znaleziono plik konfiguracyjny Eslint. Czy chcesz go nadpisa\u0107?`
445
499
  });
446
- if (p3.isCancel(isConfirmed) || !isConfirmed) {
447
- p3.cancel("Nadpisz plik konfiguracyjny Eslint i spr\xF3buj ponownie.");
500
+ if (p5.isCancel(isConfirmed) || !isConfirmed) {
501
+ p5.cancel("Nadpisz plik konfiguracyjny Eslint i spr\xF3buj ponownie.");
448
502
  process.exit(1);
449
503
  }
450
504
  await fs.rm(import_node_path4.default.join(root2, eslintConfig));
@@ -460,11 +514,11 @@ var installEslint = async (isNonInteractive2 = false) => {
460
514
  export default solvro();
461
515
  `
462
516
  );
463
- p3.note("Plik konfiguracyjny Eslint zosta\u0142 utworzony.");
517
+ p5.note("Plik konfiguracyjny Eslint zosta\u0142 utworzony.");
464
518
  };
465
519
 
466
520
  // src/cli/install-ga.ts
467
- var p4 = __toESM(require("@clack/prompts"), 1);
521
+ var p6 = __toESM(require("@clack/prompts"), 1);
468
522
  var import_node_fs2 = require("fs");
469
523
  var fs2 = __toESM(require("fs/promises"), 1);
470
524
  var import_node_path5 = __toESM(require("path"), 1);
@@ -717,7 +771,7 @@ var installGithubActions = async () => {
717
771
  const withCommitlint = await packageJson4.hasPackage("@commitlint/cli");
718
772
  if (type === "adonis") {
719
773
  if (!(0, import_node_fs2.existsSync)(import_node_path5.default.join(projectDirectory, ".env.example"))) {
720
- p4.cancel(
774
+ p6.cancel(
721
775
  "Nie znaleziono pliku .env.example. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu Adonisa."
722
776
  );
723
777
  process.exit(1);
@@ -767,7 +821,7 @@ var installGithubActions = async () => {
767
821
  await packageJson4.addScriptIfNotExists("lint", "eslint . --max-warnings=0");
768
822
  await packageJson4.addScriptIfNotExists("format", "prettier --write .");
769
823
  await packageJson4.addScriptIfNotExists("types:check", "tsc --noEmit");
770
- p4.note("Dodano konfiguracj\u0119 CI i skrypty.");
824
+ p6.note("Dodano konfiguracj\u0119 CI i skrypty.");
771
825
  };
772
826
 
773
827
  // src/cli/install-lint-staged.ts
@@ -787,7 +841,7 @@ var installLintStaged = async () => {
787
841
  };
788
842
 
789
843
  // src/cli/install-prettier.ts
790
- var p5 = __toESM(require("@clack/prompts"), 1);
844
+ var p7 = __toESM(require("@clack/prompts"), 1);
791
845
  var import_node_assert4 = __toESM(require("assert"), 1);
792
846
  var import_node_fs3 = require("fs");
793
847
  var fs3 = __toESM(require("fs/promises"), 1);
@@ -811,14 +865,17 @@ var installPrettier = async (isNonInteractive2 = false) => {
811
865
  const root2 = projectRoot();
812
866
  await packageJson6.load();
813
867
  import_node_assert4.default.ok(packageJson6.json !== null);
814
- await packageJson6.install("prettier", { dev: true, minVersion: ">=3" });
868
+ await packageJson6.install("prettier", {
869
+ dev: true,
870
+ version: ">=3"
871
+ });
815
872
  const prettierConfig = prettierConfigNames.find(
816
873
  (configName) => (0, import_node_fs3.existsSync)(import_node_path6.default.join(root2, configName))
817
874
  );
818
875
  const solvroPrettierPath = "@solvro/config/prettier";
819
876
  if (prettierConfig !== void 0 || packageJson6.json.prettier !== void 0) {
820
877
  if (packageJson6.json.prettier === solvroPrettierPath) {
821
- p5.note("Konfiguracja Prettiera jest ju\u017C ustawiona. Pomijam.");
878
+ p7.note("Konfiguracja Prettiera jest ju\u017C ustawiona. Pomijam.");
822
879
  return;
823
880
  }
824
881
  if (isNonInteractive2) {
@@ -829,8 +886,8 @@ var installPrettier = async (isNonInteractive2 = false) => {
829
886
  const isConfirmed = await polishConfirm({
830
887
  message: `Znaleziono konfiguracj\u0119 Prettiera. Czy chcesz j\u0105 nadpisa\u0107?`
831
888
  });
832
- if (p5.isCancel(isConfirmed) || !isConfirmed) {
833
- p5.cancel("Usu\u0144 konfiguracje Prettiera i spr\xF3buj ponownie.");
889
+ if (p7.isCancel(isConfirmed) || !isConfirmed) {
890
+ p7.cancel("Usu\u0144 konfiguracje Prettiera i spr\xF3buj ponownie.");
834
891
  process.exit(1);
835
892
  }
836
893
  for (const configName of prettierConfigNames) {
@@ -840,7 +897,7 @@ var installPrettier = async (isNonInteractive2 = false) => {
840
897
  }
841
898
  packageJson6.json.prettier = solvroPrettierPath;
842
899
  await packageJson6.save();
843
- p5.note("Konfiguracja Prettiera zosta\u0142a dodana.");
900
+ p7.note("Konfiguracja Prettiera zosta\u0142a dodana.");
844
901
  };
845
902
 
846
903
  // src/cli/index.ts
@@ -851,27 +908,28 @@ var options = program.opts();
851
908
  var isNonInteractive = process.argv.length > 2;
852
909
  async function main() {
853
910
  if (!isNonInteractive) {
854
- p6.intro(import_picocolors.default.bold(import_picocolors.default.bgBlue(" @solvro/config ")));
911
+ p8.intro(import_picocolors2.default.bold(import_picocolors2.default.bgBlue(" @solvro/config ")));
855
912
  }
856
913
  const userAgent = (0, import_detect.getUserAgent)();
857
914
  if (userAgent !== "npm") {
858
915
  const packageManager = userAgent ?? "unknown";
859
- const warningMessage = `
860
- ${import_picocolors.default.red(import_picocolors.default.bold(`\u26A0\uFE0F OSTRZE\u017BENIE: ${packageManager} nie jest obs\u0142ugiwany \u26A0\uFE0F`))}
916
+ const warningMessage = `${import_picocolors2.default.red(import_picocolors2.default.bold(`\u26A0\uFE0F OSTRZE\u017BENIE: ${packageManager} nie jest obs\u0142ugiwany \u26A0\uFE0F`))}
861
917
 
862
- Pr\xF3bujesz uruchomi\u0107 ten skrypt z ${import_picocolors.default.yellow(packageManager)}'em, ale @solvro/config dzia\u0142a tylko z ${import_picocolors.default.yellow("npm'em")}.
918
+ Pr\xF3bujesz uruchomi\u0107 ten skrypt ${import_picocolors2.default.yellow(packageManager)}'em, ale @solvro/config obecnie dzia\u0142a tylko z ${import_picocolors2.default.green("npm")}'em.
863
919
 
864
- Support dla innych mened\u017Cer\xF3w pakiet\xF3w nie jest planowany - chcemy jednolitego stacku technologicznego dla projekt\xF3w w naszym kochanym kole Solvro.
920
+ ${import_picocolors2.default.white(`Support dla innych mened\u017Cer\xF3w pakiet\xF3w jest planowany w nadchodz\u0105cych wersjach - ${import_picocolors2.default.yellow("zagwiazdkuj i spr\xF3buj ponownie wkr\xF3tce")}!`)}
865
921
 
866
- U\u017Cyj zamiast tego npm'a:
867
- ${import_picocolors.default.cyan("npx @solvro/config")}`;
922
+ ${import_picocolors2.default.white(`W mi\u0119dzyczasie u\u017Cyj ${import_picocolors2.default.green("npm")}'a:`)}
923
+ ${import_picocolors2.default.cyan("npx @solvro/config")}`;
868
924
  if (isNonInteractive) {
869
925
  console.error(warningMessage);
870
926
  } else {
871
- p6.cancel(warningMessage);
927
+ p8.cancel(warningMessage);
872
928
  }
873
929
  process.exit(1);
874
930
  }
931
+ const packageJson7 = new PackageJson();
932
+ await packageJson7.load();
875
933
  if (options.force !== true && !isGitClean()) {
876
934
  if (isNonInteractive) {
877
935
  console.error(
@@ -882,48 +940,44 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
882
940
  const isConfirmed = await polishConfirm({
883
941
  message: `Masz niezapisane zmiany w Git. Czy chcesz kontynuowa\u0107?`
884
942
  });
885
- if (p6.isCancel(isConfirmed) || !isConfirmed) {
886
- p6.cancel("Zapisz zmiany w Git i spr\xF3buj ponownie.");
943
+ if (p8.isCancel(isConfirmed) || !isConfirmed) {
944
+ p8.cancel("Zapisz zmiany w Git i spr\xF3buj ponownie.");
887
945
  process.exit(1);
888
946
  }
889
947
  }
890
- const packageJson7 = new PackageJson();
948
+ if (await packageJson7.hasPackage("eslint") && !await packageJson7.doesSatisfy("eslint", "<10")) {
949
+ const eslint = await packageJson7.getPackageInfo("eslint");
950
+ const versionInfo = eslint?.version == null ? "" : ` Obecnie zainstalowana jest wersja ${import_picocolors2.default.yellow(eslint.version)}.`;
951
+ const errorMessage = `ESLint w wersji powy\u017Cej 9 ${import_picocolors2.default.red("nie jest jeszcze wspierany")}.${versionInfo}`;
952
+ const errorRetry = "Prosz\u0119 zainstalowa\u0107 wersj\u0119 9 i spr\xF3bowa\u0107 ponownie.";
953
+ if (isNonInteractive) {
954
+ console.error(errorMessage);
955
+ console.error(errorRetry);
956
+ process.exit(1);
957
+ }
958
+ const isConfirmed = await polishConfirm({
959
+ message: `${errorMessage} Zainstalowa\u0107 starsz\u0105 wersj\u0119 ${import_picocolors2.default.magenta("ESLint")}'a? (Wymagane by kontynuowa\u0107)`
960
+ });
961
+ if (p8.isCancel(isConfirmed) || !isConfirmed) {
962
+ p8.cancel(errorRetry);
963
+ process.exit(1);
964
+ }
965
+ await packageJson7.install("eslint", { dev: true, version: "^9" });
966
+ }
891
967
  const projectType = await packageJson7.getProjectType();
892
968
  if (!isNonInteractive) {
893
969
  if (projectType === "adonis") {
894
- const isConfirmed = await polishConfirm({
895
- message: `Wygl\u0105da jakby\u015B u\u017Cywa\u0142 Adonisa. Czy to si\u0119 zgadza?`
896
- });
897
- if (p6.isCancel(isConfirmed) || !isConfirmed) {
898
- p6.cancel("Zg\u0142o\u015B b\u0142\u0105d na GitHubie :(, a my spr\xF3bujemy pom\xF3c.");
899
- process.exit(1);
900
- }
970
+ await confirmProjectType(import_picocolors2.default.magenta("Adonis"));
901
971
  }
902
972
  if (projectType === "react") {
903
- const isConfirmed = await polishConfirm({
904
- message: `Wygl\u0105da jakby\u015B u\u017Cywa\u0142 Reacta. Czy to si\u0119 zgadza?`
905
- });
906
- if (p6.isCancel(isConfirmed)) {
907
- p6.cancel("\u{1F621}");
908
- process.exit(1);
909
- }
910
- if (!isConfirmed) {
911
- p6.cancel("Zg\u0142o\u015B b\u0142\u0105d na GitHubie :(, a my spr\xF3bujemy pom\xF3c.");
912
- process.exit(1);
913
- }
973
+ await confirmProjectType(import_picocolors2.default.cyan("React"));
914
974
  }
915
975
  if (projectType === "nestjs") {
916
- const isConfirmed = await polishConfirm({
917
- message: `Wygl\u0105da jakby\u015B u\u017Cywa\u0142 NestJsa. Czy to si\u0119 zgadza?`
918
- });
919
- if (p6.isCancel(isConfirmed)) {
920
- p6.cancel("\u{1F621}");
921
- process.exit(1);
922
- }
976
+ await confirmProjectType(import_picocolors2.default.red("NestJS"));
923
977
  }
924
978
  if (projectType === "node") {
925
- p6.cancel(
926
- "Nie znaleziono ani Adonisa, Reacta, ani NestJsa. Musisz r\u0119cznie konfigurowa\u0107 projekt."
979
+ p8.cancel(
980
+ `Nie znaleziono ani ${import_picocolors2.default.magenta("Adonis")}'a, ${import_picocolors2.default.cyan("React")}'a, ani ${import_picocolors2.default.white("NestJS")}'a. Musisz r\u0119cznie konfigurowa\u0107 projekt.`
927
981
  );
928
982
  process.exit(1);
929
983
  }
@@ -936,8 +990,8 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
936
990
  const isConfirmed = await polishConfirm({
937
991
  message: `Tw\xF3j projekt nie u\u017Cywa ESM (brak type: "module" w package.json). Czy chcesz to doda\u0107? (Wymagane by kontynuowa\u0107)`
938
992
  });
939
- if (p6.isCancel(isConfirmed) || !isConfirmed) {
940
- p6.cancel("Zmie\u0144 projekt na ESM i spr\xF3buj ponownie.");
993
+ if (p8.isCancel(isConfirmed) || !isConfirmed) {
994
+ p8.cancel("Zmie\u0144 projekt na ESM i spr\xF3buj ponownie.");
941
995
  process.exit(1);
942
996
  }
943
997
  await packageJson7.ensureESM();
@@ -967,35 +1021,35 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
967
1021
  process.exit(1);
968
1022
  }
969
1023
  } else {
970
- const additionalTools = await p6.multiselect({
971
- message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${import_picocolors.default.gray("zaznacz spacj\u0105, potwierd\u017A enterem")}`,
1024
+ const additionalTools = await p8.multiselect({
1025
+ message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${import_picocolors2.default.gray("zaznacz spacj\u0105, potwierd\u017A enterem")}`,
972
1026
  initialValues: ["eslint", "prettier", "gh-action", "commitlint"],
973
1027
  options: [
974
1028
  {
975
1029
  value: "eslint",
976
- label: import_picocolors.default.bold(import_picocolors.default.blueBright("ESLint")),
1030
+ label: import_picocolors2.default.bold(import_picocolors2.default.blueBright("ESLint")),
977
1031
  hint: "sprawdzanie jako\u015Bci kodu"
978
1032
  },
979
1033
  {
980
1034
  value: "prettier",
981
- label: import_picocolors.default.bold(import_picocolors.default.yellowBright("Prettier")),
1035
+ label: import_picocolors2.default.bold(import_picocolors2.default.yellowBright("Prettier")),
982
1036
  hint: "formatowanie"
983
1037
  },
984
1038
  {
985
1039
  value: "gh-action",
986
- label: import_picocolors.default.bold("GitHub Actions"),
1040
+ label: import_picocolors2.default.bold("GitHub Actions"),
987
1041
  hint: "automatyczne testy na Githubie"
988
1042
  },
989
1043
  {
990
1044
  value: "commitlint",
991
- label: import_picocolors.default.bold("Commitlint"),
1045
+ label: import_picocolors2.default.bold("Commitlint"),
992
1046
  hint: "walidacja tre\u015Bci commit\xF3w"
993
1047
  }
994
1048
  ],
995
1049
  required: false
996
1050
  });
997
- if (p6.isCancel(additionalTools) || additionalTools.length === 0) {
998
- p6.cancel("Nie wybrano \u017Cadnych narz\u0119dzi.");
1051
+ if (p8.isCancel(additionalTools) || additionalTools.length === 0) {
1052
+ p8.cancel("Nie wybrano \u017Cadnych narz\u0119dzi.");
999
1053
  process.exit(1);
1000
1054
  }
1001
1055
  toolsToInstall = additionalTools;
@@ -1018,16 +1072,29 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
1018
1072
  await installGithubActions();
1019
1073
  }
1020
1074
  await packageJson7.clearInstall();
1021
- if (isNonInteractive) {
1022
- console.log("\u2705 Konfiguracja zako\u0144czona pomy\u015Blnie!");
1023
- } else {
1024
- p6.outro("\u2705 Konfiguracja zako\u0144czona pomy\u015Blnie!");
1025
- }
1075
+ const printSuccess = isNonInteractive ? console.info : p8.outro;
1076
+ printSuccess("\u2705 Konfiguracja zako\u0144czona pomy\u015Blnie!");
1026
1077
  }
1027
- try {
1028
- void main();
1029
- } catch (error) {
1030
- console.error("Wyst\u0105pi\u0142 b\u0142\u0105d:", error);
1031
- process.exit(1);
1078
+ async function mainWrapper() {
1079
+ try {
1080
+ await main();
1081
+ } catch (error) {
1082
+ if (process.env.NODE_ENV === "development") {
1083
+ console.error(
1084
+ import_picocolors2.default.red("Unhandled error in main:"),
1085
+ error instanceof Error ? error.message : error
1086
+ );
1087
+ } else {
1088
+ const errorMessage = "Wyst\u0105pi\u0142 nieoczekiwany b\u0142\u0105d :( Prosz\u0119 zg\u0142osi\u0107 go tw\xF3rcom:";
1089
+ if (isNonInteractive) {
1090
+ console.error(errorMessage);
1091
+ console.error(BUG_TRACKER_URL);
1092
+ } else {
1093
+ p8.cancel(`${errorMessage} ${BUG_TRACKER_URL}`);
1094
+ }
1095
+ }
1096
+ process.exit(1);
1097
+ }
1032
1098
  }
1099
+ void mainWrapper();
1033
1100
  //# sourceMappingURL=index.cjs.map