@solvro/config 3.0.0-beta.4 → 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.
- package/dist/cli/index.cjs +127 -100
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +116 -93
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -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
|
|
30
|
+
var p13 = __toESM(require("@clack/prompts"), 1);
|
|
27
31
|
var import_commander = require("commander");
|
|
28
|
-
var
|
|
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.
|
|
37
|
+
version: "3.0.0-beta.4",
|
|
34
38
|
description: "Solvro's engineering style guide",
|
|
35
39
|
keywords: [
|
|
36
40
|
"eslint",
|
|
@@ -242,9 +246,9 @@ var confirmProjectType = async (projectType) => {
|
|
|
242
246
|
|
|
243
247
|
// src/utils/is-git-clean.ts
|
|
244
248
|
var import_node_child_process = require("child_process");
|
|
245
|
-
function isGitClean() {
|
|
249
|
+
function isGitClean(options2) {
|
|
246
250
|
try {
|
|
247
|
-
(0, import_node_child_process.execSync)("git diff-index --quiet HEAD --");
|
|
251
|
+
(0, import_node_child_process.execSync)("git diff-index --quiet HEAD --", options2);
|
|
248
252
|
return true;
|
|
249
253
|
} catch {
|
|
250
254
|
return false;
|
|
@@ -258,7 +262,7 @@ var import_node_assert = __toESM(require("assert"), 1);
|
|
|
258
262
|
var import_promises = require("fs/promises");
|
|
259
263
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
260
264
|
var import_detect = require("package-manager-detector/detect");
|
|
261
|
-
var
|
|
265
|
+
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
262
266
|
var import_semver = __toESM(require("semver"), 1);
|
|
263
267
|
|
|
264
268
|
// src/utils/git-root.ts
|
|
@@ -350,11 +354,7 @@ var warnInconsistentUserAgent = ({
|
|
|
350
354
|
|
|
351
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)}.
|
|
352
356
|
${isSupportedPackageManager(detectedPackageManager) ? hintInstallWithDetected(PACKAGE_MANAGER_CONFIGS[detectedPackageManager]) : warnUnsupported(detectedPackageManager)}`;
|
|
353
|
-
|
|
354
|
-
console.error(warningMessage);
|
|
355
|
-
} else {
|
|
356
|
-
p4.cancel(warningMessage);
|
|
357
|
-
}
|
|
357
|
+
p4.cancel(warningMessage);
|
|
358
358
|
};
|
|
359
359
|
|
|
360
360
|
// src/utils/warn-missing-lockfile.ts
|
|
@@ -372,37 +372,35 @@ ${import_picocolors2.default.white("Je\u015Bli to si\u0119 zgadza, zainstaluj na
|
|
|
372
372
|
|
|
373
373
|
${import_picocolors2.default.cyan(manager.installDependencies)}
|
|
374
374
|
${import_picocolors2.default.cyan(`${manager.downloadExecute} @solvro/config@latest`)}`;
|
|
375
|
-
|
|
376
|
-
console.error(warningMessage);
|
|
377
|
-
} else {
|
|
378
|
-
p5.cancel(warningMessage);
|
|
379
|
-
}
|
|
375
|
+
p5.cancel(warningMessage);
|
|
380
376
|
};
|
|
381
377
|
|
|
382
378
|
// src/utils/warn-unsupported-package-manager.ts
|
|
383
379
|
var p6 = __toESM(require("@clack/prompts"), 1);
|
|
380
|
+
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
381
|
+
|
|
382
|
+
// src/utils/format-log.ts
|
|
384
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
|
|
385
387
|
var warnUnsupportedPackageManager = ({
|
|
386
388
|
userAgent
|
|
387
389
|
}) => {
|
|
388
390
|
const packageManager = userAgent ?? "<nieznany>";
|
|
389
|
-
const warningMessage = `${
|
|
391
|
+
const warningMessage = `${import_picocolors4.default.red(import_picocolors4.default.bold(`\u26A0\uFE0F OSTRZE\u017BENIE: ${packageManager} nie jest obs\u0142ugiwany \u26A0\uFE0F`))}
|
|
390
392
|
|
|
391
|
-
Pr\xF3bujesz uruchomi\u0107 ten skrypt ${
|
|
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:
|
|
392
394
|
|
|
393
|
-
${SUPPORTED_PACKAGE_MANAGERS.map((manager) =>
|
|
395
|
+
${SUPPORTED_PACKAGE_MANAGERS.map((manager) => import_picocolors4.default.white(`- ${import_picocolors4.default.cyan(manager)}`)).join("\n")}
|
|
394
396
|
|
|
395
|
-
${
|
|
396
|
-
${
|
|
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)}
|
|
397
399
|
|
|
398
|
-
${
|
|
400
|
+
${import_picocolors4.default.white(`W mi\u0119dzyczasie u\u017Cyj innego mened\u017Cera:`)}
|
|
399
401
|
|
|
400
|
-
${Object.values(PACKAGE_MANAGER_CONFIGS).map((config) =>
|
|
401
|
-
|
|
402
|
-
console.error(warningMessage);
|
|
403
|
-
} else {
|
|
404
|
-
p6.cancel(warningMessage);
|
|
405
|
-
}
|
|
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);
|
|
406
404
|
};
|
|
407
405
|
|
|
408
406
|
// src/utils/package-json.ts
|
|
@@ -450,7 +448,7 @@ var PackageJson = class {
|
|
|
450
448
|
const json = await (0, import_local_pkg.loadPackageJSON)(projectRoot());
|
|
451
449
|
if (json === null) {
|
|
452
450
|
p7.cancel(
|
|
453
|
-
`Nie znaleziono pliku ${
|
|
451
|
+
`Nie znaleziono pliku ${import_picocolors5.default.cyan("package.json")}. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu.`
|
|
454
452
|
);
|
|
455
453
|
process.exit(1);
|
|
456
454
|
}
|
|
@@ -493,7 +491,7 @@ var PackageJson = class {
|
|
|
493
491
|
const isNestJs = await (0, import_local_pkg.isPackageListed)("@nestjs/core");
|
|
494
492
|
if (isReact && isAdonis) {
|
|
495
493
|
p7.cancel(
|
|
496
|
-
`Projekty korzystaj\u0105ce zar\xF3wno z ${
|
|
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.`
|
|
497
495
|
);
|
|
498
496
|
process.exit(1);
|
|
499
497
|
}
|
|
@@ -587,7 +585,14 @@ var PackageJson = class {
|
|
|
587
585
|
}
|
|
588
586
|
async clearInstall() {
|
|
589
587
|
const [command, ...options2] = this.manager.cleanInstall.split(" ");
|
|
590
|
-
await
|
|
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
|
+
});
|
|
591
596
|
}
|
|
592
597
|
/**
|
|
593
598
|
* Gets the pnpm major version from package.json packageManager field or user agent.
|
|
@@ -614,6 +619,38 @@ var PackageJson = class {
|
|
|
614
619
|
}
|
|
615
620
|
};
|
|
616
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
|
+
|
|
617
654
|
// src/cli/install-commitlint.ts
|
|
618
655
|
var import_promises2 = require("fs/promises");
|
|
619
656
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
@@ -654,8 +691,8 @@ var installCommitLint = async () => {
|
|
|
654
691
|
};
|
|
655
692
|
|
|
656
693
|
// src/cli/install-eslint.ts
|
|
657
|
-
var
|
|
658
|
-
var
|
|
694
|
+
var p10 = __toESM(require("@clack/prompts"), 1);
|
|
695
|
+
var import_node_fs2 = require("fs");
|
|
659
696
|
var fs = __toESM(require("fs/promises"), 1);
|
|
660
697
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
661
698
|
var eslintConfigNames = [
|
|
@@ -684,15 +721,15 @@ var installEslint = async (isNonInteractive2 = false) => {
|
|
|
684
721
|
if (type === "react" && await packageJson3.isNextJs()) {
|
|
685
722
|
const is15 = await packageJson3.doesSatisfy("next", ">=15");
|
|
686
723
|
if (!is15) {
|
|
687
|
-
|
|
688
|
-
"Next.js musi by\u0107 w
|
|
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"
|
|
689
726
|
);
|
|
690
727
|
process.exit(1);
|
|
691
728
|
}
|
|
692
729
|
await packageJson3.install("@next/eslint-plugin-next", { dev: true });
|
|
693
730
|
}
|
|
694
731
|
const eslintConfig = eslintConfigNames.find(
|
|
695
|
-
(configName) => (0,
|
|
732
|
+
(configName) => (0, import_node_fs2.existsSync)(import_node_path4.default.join(root2, configName))
|
|
696
733
|
);
|
|
697
734
|
if (eslintConfig !== void 0) {
|
|
698
735
|
const eslintContent = await fs.readFile(
|
|
@@ -700,17 +737,17 @@ var installEslint = async (isNonInteractive2 = false) => {
|
|
|
700
737
|
"utf8"
|
|
701
738
|
);
|
|
702
739
|
if (eslintContent.includes("export default solvro(")) {
|
|
703
|
-
|
|
740
|
+
p10.log.warning("ESLint jest ju\u017C skonfigurowany. Pomijam.");
|
|
704
741
|
return;
|
|
705
742
|
} else {
|
|
706
743
|
if (isNonInteractive2) {
|
|
707
744
|
await fs.rm(import_node_path4.default.join(root2, eslintConfig));
|
|
708
745
|
} else {
|
|
709
746
|
const isConfirmed = await polishConfirm({
|
|
710
|
-
message: `Znaleziono plik konfiguracyjny
|
|
747
|
+
message: `Znaleziono plik konfiguracyjny ESLint. Czy chcesz go nadpisa\u0107?`
|
|
711
748
|
});
|
|
712
|
-
if (
|
|
713
|
-
|
|
749
|
+
if (p10.isCancel(isConfirmed) || !isConfirmed) {
|
|
750
|
+
p10.cancel("Nadpisz plik konfiguracyjny ESLint i spr\xF3buj ponownie.");
|
|
714
751
|
process.exit(1);
|
|
715
752
|
}
|
|
716
753
|
await fs.rm(import_node_path4.default.join(root2, eslintConfig));
|
|
@@ -726,12 +763,12 @@ var installEslint = async (isNonInteractive2 = false) => {
|
|
|
726
763
|
export default solvro();
|
|
727
764
|
`
|
|
728
765
|
);
|
|
729
|
-
|
|
766
|
+
p10.log.step("Plik konfiguracyjny ESLint zosta\u0142 utworzony.");
|
|
730
767
|
};
|
|
731
768
|
|
|
732
769
|
// src/cli/install-ga.ts
|
|
733
|
-
var
|
|
734
|
-
var
|
|
770
|
+
var p11 = __toESM(require("@clack/prompts"), 1);
|
|
771
|
+
var import_node_fs3 = require("fs");
|
|
735
772
|
var fs2 = __toESM(require("fs/promises"), 1);
|
|
736
773
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
737
774
|
|
|
@@ -994,8 +1031,8 @@ var installGithubActions = async () => {
|
|
|
994
1031
|
const pnpmVersion = manager.name === "pnpm" ? await packageJson4.getPnpmVersion() : void 0;
|
|
995
1032
|
const withCommitlint = await packageJson4.hasPackage("@commitlint/cli");
|
|
996
1033
|
if (type === "adonis") {
|
|
997
|
-
if (!(0,
|
|
998
|
-
|
|
1034
|
+
if (!(0, import_node_fs3.existsSync)(import_node_path5.default.join(projectDirectory, ".env.example"))) {
|
|
1035
|
+
p11.cancel(
|
|
999
1036
|
"Nie znaleziono pliku .env.example. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu Adonisa."
|
|
1000
1037
|
);
|
|
1001
1038
|
process.exit(1);
|
|
@@ -1046,12 +1083,12 @@ var installGithubActions = async () => {
|
|
|
1046
1083
|
'prettier --write "src/**/*.ts" "test/**/*.ts"'
|
|
1047
1084
|
);
|
|
1048
1085
|
if (!formatScriptUpdated) {
|
|
1049
|
-
|
|
1086
|
+
p11.log.warning(
|
|
1050
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."
|
|
1051
1088
|
);
|
|
1052
1089
|
}
|
|
1053
1090
|
}
|
|
1054
|
-
if (!(0,
|
|
1091
|
+
if (!(0, import_node_fs3.existsSync)(import_node_path5.default.join(gitDirectory, ".github/dependabot.yml"))) {
|
|
1055
1092
|
await fs2.writeFile(
|
|
1056
1093
|
import_node_path5.default.join(gitDirectory, ".github/dependabot.yml"),
|
|
1057
1094
|
dependabot()
|
|
@@ -1061,7 +1098,7 @@ var installGithubActions = async () => {
|
|
|
1061
1098
|
await packageJson4.addScriptIfNotExists("format:check", "prettier --check .");
|
|
1062
1099
|
await packageJson4.addScriptIfNotExists("lint", "eslint . --max-warnings=0");
|
|
1063
1100
|
await packageJson4.addScriptIfNotExists("types:check", "tsc --noEmit");
|
|
1064
|
-
|
|
1101
|
+
p11.log.step("Dodano konfiguracj\u0119 CI i skrypty.");
|
|
1065
1102
|
};
|
|
1066
1103
|
|
|
1067
1104
|
// src/cli/install-lint-staged.ts
|
|
@@ -1086,9 +1123,9 @@ var installLintStaged = async () => {
|
|
|
1086
1123
|
};
|
|
1087
1124
|
|
|
1088
1125
|
// src/cli/install-prettier.ts
|
|
1089
|
-
var
|
|
1126
|
+
var p12 = __toESM(require("@clack/prompts"), 1);
|
|
1090
1127
|
var import_node_assert4 = __toESM(require("assert"), 1);
|
|
1091
|
-
var
|
|
1128
|
+
var import_node_fs4 = require("fs");
|
|
1092
1129
|
var fs3 = __toESM(require("fs/promises"), 1);
|
|
1093
1130
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
1094
1131
|
var prettierConfigNames = [
|
|
@@ -1115,12 +1152,12 @@ var installPrettier = async (isNonInteractive2 = false) => {
|
|
|
1115
1152
|
version: ">=3"
|
|
1116
1153
|
});
|
|
1117
1154
|
const prettierConfig = prettierConfigNames.find(
|
|
1118
|
-
(configName) => (0,
|
|
1155
|
+
(configName) => (0, import_node_fs4.existsSync)(import_node_path7.default.join(root2, configName))
|
|
1119
1156
|
);
|
|
1120
1157
|
const solvroPrettierPath = "@solvro/config/prettier";
|
|
1121
1158
|
if (prettierConfig !== void 0 || packageJson6.json.prettier !== void 0) {
|
|
1122
1159
|
if (packageJson6.json.prettier === solvroPrettierPath) {
|
|
1123
|
-
|
|
1160
|
+
p12.log.warning("Konfiguracja Prettiera jest ju\u017C ustawiona. Pomijam.");
|
|
1124
1161
|
return;
|
|
1125
1162
|
}
|
|
1126
1163
|
if (isNonInteractive2) {
|
|
@@ -1131,8 +1168,8 @@ var installPrettier = async (isNonInteractive2 = false) => {
|
|
|
1131
1168
|
const isConfirmed = await polishConfirm({
|
|
1132
1169
|
message: `Znaleziono konfiguracj\u0119 Prettiera. Czy chcesz j\u0105 nadpisa\u0107?`
|
|
1133
1170
|
});
|
|
1134
|
-
if (
|
|
1135
|
-
|
|
1171
|
+
if (p12.isCancel(isConfirmed) || !isConfirmed) {
|
|
1172
|
+
p12.cancel("Usu\u0144 konfiguracje Prettiera i spr\xF3buj ponownie.");
|
|
1136
1173
|
process.exit(1);
|
|
1137
1174
|
}
|
|
1138
1175
|
for (const configName of prettierConfigNames) {
|
|
@@ -1142,7 +1179,7 @@ var installPrettier = async (isNonInteractive2 = false) => {
|
|
|
1142
1179
|
}
|
|
1143
1180
|
packageJson6.json.prettier = solvroPrettierPath;
|
|
1144
1181
|
await packageJson6.save();
|
|
1145
|
-
|
|
1182
|
+
p12.log.step("Konfiguracja Prettiera zosta\u0142a dodana.");
|
|
1146
1183
|
};
|
|
1147
1184
|
|
|
1148
1185
|
// src/cli/index.ts
|
|
@@ -1152,43 +1189,40 @@ program.parse();
|
|
|
1152
1189
|
var options = program.opts();
|
|
1153
1190
|
var isNonInteractive = checkIsNonInteractive();
|
|
1154
1191
|
async function main() {
|
|
1155
|
-
|
|
1156
|
-
p11.intro(import_picocolors5.default.bold(import_picocolors5.default.bgBlue(" @solvro/config ")));
|
|
1157
|
-
}
|
|
1192
|
+
printIntro();
|
|
1158
1193
|
const packageJson7 = new PackageJson();
|
|
1159
1194
|
packageJson7.verifyPackageManager();
|
|
1160
1195
|
await packageJson7.load();
|
|
1161
1196
|
await packageJson7.validateUserAgentConsistency();
|
|
1162
1197
|
if (options.force !== true && !isGitClean()) {
|
|
1163
1198
|
if (isNonInteractive) {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
);
|
|
1199
|
+
p13.log.error("Repozytorium Git ma niezatwierdzone zmiany.");
|
|
1200
|
+
p13.cancel("U\u017Cyj --force, aby pomin\u0105\u0107 to sprawdzenie.");
|
|
1167
1201
|
process.exit(1);
|
|
1168
1202
|
}
|
|
1169
1203
|
const isConfirmed = await polishConfirm({
|
|
1170
1204
|
message: `Masz niezapisane zmiany w Git. Czy chcesz kontynuowa\u0107?`
|
|
1171
1205
|
});
|
|
1172
|
-
if (
|
|
1173
|
-
|
|
1206
|
+
if (p13.isCancel(isConfirmed) || !isConfirmed) {
|
|
1207
|
+
p13.cancel("Zapisz zmiany w Git i spr\xF3buj ponownie.");
|
|
1174
1208
|
process.exit(1);
|
|
1175
1209
|
}
|
|
1176
1210
|
}
|
|
1177
1211
|
if (await packageJson7.hasPackage("eslint") && !await packageJson7.doesSatisfy("eslint", "<10")) {
|
|
1178
1212
|
const eslint = await packageJson7.getPackageInfo("eslint");
|
|
1179
|
-
const versionInfo = eslint?.version == null ? "" : ` Obecnie zainstalowana jest wersja ${
|
|
1180
|
-
const errorMessage = `ESLint w wersji powy\u017Cej 9
|
|
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}`;
|
|
1181
1215
|
const errorRetry = "Prosz\u0119 zainstalowa\u0107 wersj\u0119 9 i spr\xF3bowa\u0107 ponownie.";
|
|
1182
1216
|
if (isNonInteractive) {
|
|
1183
|
-
|
|
1184
|
-
|
|
1217
|
+
p13.log.error(errorMessage);
|
|
1218
|
+
p13.cancel(errorRetry);
|
|
1185
1219
|
process.exit(1);
|
|
1186
1220
|
}
|
|
1187
1221
|
const isConfirmed = await polishConfirm({
|
|
1188
|
-
message: `${errorMessage} Zainstalowa\u0107 starsz\u0105 wersj\u0119 ${
|
|
1222
|
+
message: `${errorMessage} Zainstalowa\u0107 starsz\u0105 wersj\u0119 ${import_picocolors8.default.magenta("ESLint")}'a? (Wymagane by kontynuowa\u0107)`
|
|
1189
1223
|
});
|
|
1190
|
-
if (
|
|
1191
|
-
|
|
1224
|
+
if (p13.isCancel(isConfirmed) || !isConfirmed) {
|
|
1225
|
+
p13.cancel(errorRetry);
|
|
1192
1226
|
process.exit(1);
|
|
1193
1227
|
}
|
|
1194
1228
|
await packageJson7.install("eslint", { dev: true, version: "^9" });
|
|
@@ -1196,17 +1230,17 @@ async function main() {
|
|
|
1196
1230
|
const projectType = await packageJson7.getProjectType();
|
|
1197
1231
|
if (!isNonInteractive) {
|
|
1198
1232
|
if (projectType === "adonis") {
|
|
1199
|
-
await confirmProjectType(
|
|
1233
|
+
await confirmProjectType(import_picocolors8.default.magenta("Adonis"));
|
|
1200
1234
|
}
|
|
1201
1235
|
if (projectType === "react") {
|
|
1202
|
-
await confirmProjectType(
|
|
1236
|
+
await confirmProjectType(import_picocolors8.default.cyan("React"));
|
|
1203
1237
|
}
|
|
1204
1238
|
if (projectType === "nestjs") {
|
|
1205
|
-
await confirmProjectType(
|
|
1239
|
+
await confirmProjectType(import_picocolors8.default.red("NestJS"));
|
|
1206
1240
|
}
|
|
1207
1241
|
if (projectType === "node") {
|
|
1208
|
-
|
|
1209
|
-
`Nie znaleziono ani ${
|
|
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.`
|
|
1210
1244
|
);
|
|
1211
1245
|
process.exit(1);
|
|
1212
1246
|
}
|
|
@@ -1219,8 +1253,8 @@ async function main() {
|
|
|
1219
1253
|
const isConfirmed = await polishConfirm({
|
|
1220
1254
|
message: `Tw\xF3j projekt nie u\u017Cywa ESM (brak "type": "module" w package.json). Czy chcesz to doda\u0107? (Wymagane by kontynuowa\u0107)`
|
|
1221
1255
|
});
|
|
1222
|
-
if (
|
|
1223
|
-
|
|
1256
|
+
if (p13.isCancel(isConfirmed) || !isConfirmed) {
|
|
1257
|
+
p13.cancel("Zmie\u0144 projekt na ESM i spr\xF3buj ponownie.");
|
|
1224
1258
|
process.exit(1);
|
|
1225
1259
|
}
|
|
1226
1260
|
await packageJson7.ensureESM();
|
|
@@ -1244,41 +1278,42 @@ async function main() {
|
|
|
1244
1278
|
toolsToInstall.push("commitlint");
|
|
1245
1279
|
}
|
|
1246
1280
|
if (toolsToInstall.length === 0) {
|
|
1247
|
-
|
|
1248
|
-
|
|
1281
|
+
p13.log.error("Nie wybrano \u017Cadnych narz\u0119dzi.");
|
|
1282
|
+
p13.cancel(
|
|
1283
|
+
"U\u017Cyj --eslint, --prettier, --gh-action, --commitlint, lub --all"
|
|
1249
1284
|
);
|
|
1250
1285
|
process.exit(1);
|
|
1251
1286
|
}
|
|
1252
1287
|
} else {
|
|
1253
|
-
const additionalTools = await
|
|
1254
|
-
message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${
|
|
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")}`,
|
|
1255
1290
|
initialValues: ["eslint", "prettier", "gh-action", "commitlint"],
|
|
1256
1291
|
options: [
|
|
1257
1292
|
{
|
|
1258
1293
|
value: "eslint",
|
|
1259
|
-
label:
|
|
1294
|
+
label: import_picocolors8.default.bold(import_picocolors8.default.blueBright("ESLint")),
|
|
1260
1295
|
hint: "sprawdzanie jako\u015Bci kodu"
|
|
1261
1296
|
},
|
|
1262
1297
|
{
|
|
1263
1298
|
value: "prettier",
|
|
1264
|
-
label:
|
|
1299
|
+
label: import_picocolors8.default.bold(import_picocolors8.default.yellowBright("Prettier")),
|
|
1265
1300
|
hint: "formatowanie"
|
|
1266
1301
|
},
|
|
1267
1302
|
{
|
|
1268
1303
|
value: "gh-action",
|
|
1269
|
-
label:
|
|
1304
|
+
label: import_picocolors8.default.bold("GitHub Actions"),
|
|
1270
1305
|
hint: "automatyczne testy na GitHubie"
|
|
1271
1306
|
},
|
|
1272
1307
|
{
|
|
1273
1308
|
value: "commitlint",
|
|
1274
|
-
label:
|
|
1309
|
+
label: import_picocolors8.default.bold("Commitlint"),
|
|
1275
1310
|
hint: "walidacja tre\u015Bci commit\xF3w"
|
|
1276
1311
|
}
|
|
1277
1312
|
],
|
|
1278
1313
|
required: false
|
|
1279
1314
|
});
|
|
1280
|
-
if (
|
|
1281
|
-
|
|
1315
|
+
if (p13.isCancel(additionalTools) || additionalTools.length === 0) {
|
|
1316
|
+
p13.cancel("Nie wybrano \u017Cadnych narz\u0119dzi.");
|
|
1282
1317
|
process.exit(1);
|
|
1283
1318
|
}
|
|
1284
1319
|
toolsToInstall = additionalTools;
|
|
@@ -1304,26 +1339,18 @@ async function main() {
|
|
|
1304
1339
|
if (toolsToInstall.includes("prettier")) {
|
|
1305
1340
|
await packageJson7.localExecute("prettier", "--write", "package.json");
|
|
1306
1341
|
}
|
|
1307
|
-
|
|
1308
|
-
printSuccess("\u2705 Konfiguracja zako\u0144czona pomy\u015Blnie!");
|
|
1342
|
+
printOutro();
|
|
1309
1343
|
}
|
|
1310
1344
|
async function mainWrapper() {
|
|
1311
1345
|
try {
|
|
1312
1346
|
await main();
|
|
1313
1347
|
} catch (error) {
|
|
1314
1348
|
if (process.env.NODE_ENV === "development") {
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
error instanceof Error ? error.message : error
|
|
1318
|
-
);
|
|
1349
|
+
p13.cancel("Unhandled error in main:");
|
|
1350
|
+
console.error(error instanceof Error ? error.message : error);
|
|
1319
1351
|
} else {
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
console.error(errorMessage);
|
|
1323
|
-
console.error(BUG_TRACKER_URL);
|
|
1324
|
-
} else {
|
|
1325
|
-
p11.cancel(`${errorMessage} ${BUG_TRACKER_URL}`);
|
|
1326
|
-
}
|
|
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}`);
|
|
1327
1354
|
}
|
|
1328
1355
|
process.exit(1);
|
|
1329
1356
|
}
|