@solvro/config 2.1.1 → 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.
- package/dist/cli/index.cjs +185 -118
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +185 -118
- package/dist/cli/index.js.map +1 -1
- package/dist/eslint/index.cjs +0 -1
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.js +0 -1
- package/dist/eslint/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -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
|
|
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
|
|
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.1.
|
|
34
|
+
version: "2.1.1",
|
|
35
35
|
description: "Solvro's engineering style guide",
|
|
36
36
|
keywords: [
|
|
37
37
|
"eslint",
|
|
@@ -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
|
|
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
|
|
265
|
+
var import_is_interactive2 = __toESM(require("is-interactive"), 1);
|
|
224
266
|
var runIfInteractive = (function_) => {
|
|
225
|
-
if ((0,
|
|
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
|
-
|
|
238
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
278
|
-
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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
|
|
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", {
|
|
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.
|
|
473
|
+
const is15 = await packageJson3.doesSatisfy("next", ">=15");
|
|
420
474
|
if (!is15) {
|
|
421
|
-
|
|
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
|
-
|
|
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 (
|
|
447
|
-
|
|
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
|
-
|
|
517
|
+
p5.note("Plik konfiguracyjny Eslint zosta\u0142 utworzony.");
|
|
464
518
|
};
|
|
465
519
|
|
|
466
520
|
// src/cli/install-ga.ts
|
|
467
|
-
var
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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", {
|
|
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
|
-
|
|
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 (
|
|
833
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
867
|
-
${
|
|
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
|
-
|
|
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 (
|
|
886
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
926
|
-
|
|
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 (
|
|
940
|
-
|
|
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
|
|
971
|
-
message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 (
|
|
998
|
-
|
|
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
|
-
|
|
1022
|
-
|
|
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
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
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
|