@solvro/config 2.1.1 → 2.2.1
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 +190 -121
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +190 -121
- 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/dist/prettier/index.cjs +11 -3
- package/dist/prettier/index.cjs.map +1 -1
- package/dist/prettier/index.d.cts +1 -1
- package/dist/prettier/index.d.ts +1 -1
- package/dist/prettier/index.js +5 -3
- package/dist/prettier/index.js.map +1 -1
- package/package.json +6 -4
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.
|
|
34
|
+
version: "2.2.0",
|
|
35
35
|
description: "Solvro's engineering style guide",
|
|
36
36
|
keywords: [
|
|
37
37
|
"eslint",
|
|
@@ -154,18 +154,58 @@ var package_default = {
|
|
|
154
154
|
"@next/eslint-plugin-next": ">=12.3.0",
|
|
155
155
|
eslint: ">=9.0.0 <10.0.0"
|
|
156
156
|
},
|
|
157
|
-
packageManager: "npm@11.11.
|
|
157
|
+
packageManager: "npm@11.11.1",
|
|
158
158
|
engines: {
|
|
159
|
-
node: "^20.19.0 || >=22.12.0"
|
|
159
|
+
node: "^20.19.0 || >=22.12.0",
|
|
160
|
+
npm: "^11.11.1"
|
|
160
161
|
},
|
|
161
162
|
volta: {
|
|
162
|
-
node: "22.
|
|
163
|
+
node: "22.22.1",
|
|
164
|
+
npm: "11.11.1"
|
|
163
165
|
},
|
|
164
166
|
publishConfig: {
|
|
165
167
|
access: "public"
|
|
166
168
|
}
|
|
167
169
|
};
|
|
168
170
|
|
|
171
|
+
// src/constants/index.ts
|
|
172
|
+
var REPO_URL = "https://github.com/Solvro/lib-web-solvro-config";
|
|
173
|
+
var BUG_TRACKER_URL = `${REPO_URL}/issues/new`;
|
|
174
|
+
|
|
175
|
+
// src/utils/confirm-project-type.ts
|
|
176
|
+
var p2 = __toESM(require("@clack/prompts"), 1);
|
|
177
|
+
|
|
178
|
+
// src/utils/polish-confirm.ts
|
|
179
|
+
var p = __toESM(require("@clack/prompts"), 1);
|
|
180
|
+
var import_is_interactive = __toESM(require("is-interactive"), 1);
|
|
181
|
+
var polishConfirm = async (props) => {
|
|
182
|
+
if (!(0, import_is_interactive.default)()) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
return p.confirm({
|
|
186
|
+
active: "Tak",
|
|
187
|
+
inactive: "Nie",
|
|
188
|
+
...props
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// src/utils/confirm-project-type.ts
|
|
193
|
+
var confirmProjectType = async (projectType) => {
|
|
194
|
+
const isConfirmed = await polishConfirm({
|
|
195
|
+
message: `Wygl\u0105da jakby\u015B u\u017Cywa\u0142 ${projectType}'a. Czy to si\u0119 zgadza?`
|
|
196
|
+
});
|
|
197
|
+
if (p2.isCancel(isConfirmed)) {
|
|
198
|
+
p2.cancel("\u{1F621}");
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
if (!isConfirmed) {
|
|
202
|
+
p2.cancel(
|
|
203
|
+
`:( Zg\u0142o\u015B b\u0142\u0105d na GitHubie, a my spr\xF3bujemy pom\xF3c: ${BUG_TRACKER_URL}`
|
|
204
|
+
);
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
169
209
|
// src/utils/is-git-clean.ts
|
|
170
210
|
var import_node_child_process = require("child_process");
|
|
171
211
|
function isGitClean() {
|
|
@@ -178,11 +218,12 @@ function isGitClean() {
|
|
|
178
218
|
}
|
|
179
219
|
|
|
180
220
|
// src/utils/package-json.ts
|
|
181
|
-
var
|
|
221
|
+
var p4 = __toESM(require("@clack/prompts"), 1);
|
|
182
222
|
var import_local_pkg = require("local-pkg");
|
|
183
223
|
var import_node_assert = __toESM(require("assert"), 1);
|
|
184
224
|
var import_promises = require("fs/promises");
|
|
185
225
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
226
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
186
227
|
var import_semver = __toESM(require("semver"), 1);
|
|
187
228
|
|
|
188
229
|
// src/utils/git-root.ts
|
|
@@ -219,23 +260,45 @@ var $$ = (async (...arguments_) => {
|
|
|
219
260
|
return cachedExeca(...arguments_);
|
|
220
261
|
});
|
|
221
262
|
|
|
263
|
+
// src/utils/run-with-spinner.ts
|
|
264
|
+
var p3 = __toESM(require("@clack/prompts"), 1);
|
|
265
|
+
|
|
222
266
|
// src/utils/run-if-interactive.ts
|
|
223
|
-
var
|
|
267
|
+
var import_is_interactive2 = __toESM(require("is-interactive"), 1);
|
|
224
268
|
var runIfInteractive = (function_) => {
|
|
225
|
-
if ((0,
|
|
269
|
+
if ((0, import_is_interactive2.default)()) {
|
|
226
270
|
return function_();
|
|
227
271
|
}
|
|
228
272
|
return void 0;
|
|
229
273
|
};
|
|
230
274
|
|
|
275
|
+
// src/utils/run-with-spinner.ts
|
|
276
|
+
var runWithSpinner = async (options2) => {
|
|
277
|
+
const spinner2 = p3.spinner();
|
|
278
|
+
runIfInteractive(() => {
|
|
279
|
+
spinner2.start(options2.start);
|
|
280
|
+
});
|
|
281
|
+
try {
|
|
282
|
+
await options2.callback();
|
|
283
|
+
} catch (error) {
|
|
284
|
+
runIfInteractive(() => {
|
|
285
|
+
spinner2.error(options2.error);
|
|
286
|
+
});
|
|
287
|
+
throw error;
|
|
288
|
+
}
|
|
289
|
+
runIfInteractive(() => {
|
|
290
|
+
spinner2.stop(options2.stop);
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
|
|
231
294
|
// src/utils/package-json.ts
|
|
232
295
|
var PackageJson = class {
|
|
233
296
|
json = null;
|
|
234
297
|
async load() {
|
|
235
298
|
const json = await (0, import_local_pkg.loadPackageJSON)(projectRoot());
|
|
236
299
|
if (json === null) {
|
|
237
|
-
|
|
238
|
-
|
|
300
|
+
p4.cancel(
|
|
301
|
+
`Nie znaleziono pliku ${import_picocolors.default.cyan("package.json")}. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu.`
|
|
239
302
|
);
|
|
240
303
|
process.exit(1);
|
|
241
304
|
}
|
|
@@ -247,10 +310,13 @@ var PackageJson = class {
|
|
|
247
310
|
async isNextJs() {
|
|
248
311
|
return this.hasPackage("next");
|
|
249
312
|
}
|
|
250
|
-
async
|
|
313
|
+
async getPackageInfo(package_) {
|
|
314
|
+
return (0, import_local_pkg.getPackageInfo)(package_);
|
|
315
|
+
}
|
|
316
|
+
async doesSatisfy(package_, version) {
|
|
251
317
|
await this.load();
|
|
252
318
|
import_node_assert.default.ok(this.json !== null);
|
|
253
|
-
const packageInfo = await
|
|
319
|
+
const packageInfo = await this.getPackageInfo(package_);
|
|
254
320
|
if (packageInfo?.version === void 0) {
|
|
255
321
|
return false;
|
|
256
322
|
}
|
|
@@ -274,9 +340,10 @@ var PackageJson = class {
|
|
|
274
340
|
const isReact = await (0, import_local_pkg.isPackageListed)("react");
|
|
275
341
|
const isNestJs = await (0, import_local_pkg.isPackageListed)("@nestjs/core");
|
|
276
342
|
if (isReact && isAdonis) {
|
|
277
|
-
|
|
278
|
-
|
|
343
|
+
p4.cancel(
|
|
344
|
+
`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
345
|
);
|
|
346
|
+
process.exit(1);
|
|
280
347
|
}
|
|
281
348
|
if (isNestJs) {
|
|
282
349
|
return "nestjs";
|
|
@@ -306,29 +373,29 @@ var PackageJson = class {
|
|
|
306
373
|
this.json.scripts[name] = script;
|
|
307
374
|
await this.save();
|
|
308
375
|
}
|
|
309
|
-
async install(package_, options2) {
|
|
376
|
+
async install(package_, options2 = {}) {
|
|
310
377
|
const isInstalled = await this.hasPackage(package_);
|
|
378
|
+
const installVersion = options2.version ?? "latest";
|
|
311
379
|
if (!isInstalled) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
380
|
+
await runWithSpinner({
|
|
381
|
+
start: `Instalowanie pakietu ${package_}`,
|
|
382
|
+
stop: `${package_} zainstalowany \u{1F60D}`,
|
|
383
|
+
error: `Instalacja pakietu ${package_} nie powiod\u0142a si\u0119 \u{1F976}`,
|
|
384
|
+
callback: async () => {
|
|
385
|
+
await $$`npm i ${options2.dev === true ? "-D" : ""} ${package_}@${installVersion}`;
|
|
386
|
+
}
|
|
319
387
|
});
|
|
320
388
|
await this.load();
|
|
321
389
|
return;
|
|
322
390
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
spinner2.stop(`${package_} zaktualizowany \u{1F60D}`);
|
|
391
|
+
if (options2.alwaysUpdate === true || options2.version != null && !await this.doesSatisfy(package_, options2.version)) {
|
|
392
|
+
await runWithSpinner({
|
|
393
|
+
start: `Aktualizowanie pakietu ${package_}`,
|
|
394
|
+
stop: `${package_} zaktualizowany \u{1F60D}`,
|
|
395
|
+
error: `Aktualizacja pakietu ${package_} nie powiod\u0142a si\u0119 \u{1F976}`,
|
|
396
|
+
callback: async () => {
|
|
397
|
+
await $$`npm i ${options2.dev === true ? "-D" : ""} ${package_}@${installVersion}`;
|
|
398
|
+
}
|
|
332
399
|
});
|
|
333
400
|
await this.load();
|
|
334
401
|
}
|
|
@@ -338,20 +405,6 @@ var PackageJson = class {
|
|
|
338
405
|
}
|
|
339
406
|
};
|
|
340
407
|
|
|
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
408
|
// src/cli/install-commitlint.ts
|
|
356
409
|
var import_promises2 = require("fs/promises");
|
|
357
410
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
@@ -391,7 +444,7 @@ var installCommitLint = async () => {
|
|
|
391
444
|
};
|
|
392
445
|
|
|
393
446
|
// src/cli/install-eslint.ts
|
|
394
|
-
var
|
|
447
|
+
var p5 = __toESM(require("@clack/prompts"), 1);
|
|
395
448
|
var import_node_fs = require("fs");
|
|
396
449
|
var fs = __toESM(require("fs/promises"), 1);
|
|
397
450
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
@@ -413,12 +466,15 @@ var packageJson3 = new PackageJson();
|
|
|
413
466
|
var installEslint = async (isNonInteractive2 = false) => {
|
|
414
467
|
const root2 = projectRoot();
|
|
415
468
|
await packageJson3.load();
|
|
416
|
-
await packageJson3.install("eslint", {
|
|
469
|
+
await packageJson3.install("eslint", {
|
|
470
|
+
dev: true,
|
|
471
|
+
version: "^9"
|
|
472
|
+
});
|
|
417
473
|
const type = await packageJson3.getProjectType();
|
|
418
474
|
if (type === "react" && await packageJson3.isNextJs()) {
|
|
419
|
-
const is15 = await packageJson3.
|
|
475
|
+
const is15 = await packageJson3.doesSatisfy("next", ">=15");
|
|
420
476
|
if (!is15) {
|
|
421
|
-
|
|
477
|
+
p5.cancel(
|
|
422
478
|
"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
479
|
);
|
|
424
480
|
process.exit(1);
|
|
@@ -434,7 +490,7 @@ var installEslint = async (isNonInteractive2 = false) => {
|
|
|
434
490
|
"utf8"
|
|
435
491
|
);
|
|
436
492
|
if (eslintContent.includes("export default solvro(")) {
|
|
437
|
-
|
|
493
|
+
p5.note("Eslint jest ju\u017C skonfigurowany. Pomijam.");
|
|
438
494
|
return;
|
|
439
495
|
} else {
|
|
440
496
|
if (isNonInteractive2) {
|
|
@@ -443,8 +499,8 @@ var installEslint = async (isNonInteractive2 = false) => {
|
|
|
443
499
|
const isConfirmed = await polishConfirm({
|
|
444
500
|
message: `Znaleziono plik konfiguracyjny Eslint. Czy chcesz go nadpisa\u0107?`
|
|
445
501
|
});
|
|
446
|
-
if (
|
|
447
|
-
|
|
502
|
+
if (p5.isCancel(isConfirmed) || !isConfirmed) {
|
|
503
|
+
p5.cancel("Nadpisz plik konfiguracyjny Eslint i spr\xF3buj ponownie.");
|
|
448
504
|
process.exit(1);
|
|
449
505
|
}
|
|
450
506
|
await fs.rm(import_node_path4.default.join(root2, eslintConfig));
|
|
@@ -460,11 +516,11 @@ var installEslint = async (isNonInteractive2 = false) => {
|
|
|
460
516
|
export default solvro();
|
|
461
517
|
`
|
|
462
518
|
);
|
|
463
|
-
|
|
519
|
+
p5.note("Plik konfiguracyjny Eslint zosta\u0142 utworzony.");
|
|
464
520
|
};
|
|
465
521
|
|
|
466
522
|
// src/cli/install-ga.ts
|
|
467
|
-
var
|
|
523
|
+
var p6 = __toESM(require("@clack/prompts"), 1);
|
|
468
524
|
var import_node_fs2 = require("fs");
|
|
469
525
|
var fs2 = __toESM(require("fs/promises"), 1);
|
|
470
526
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
@@ -717,7 +773,7 @@ var installGithubActions = async () => {
|
|
|
717
773
|
const withCommitlint = await packageJson4.hasPackage("@commitlint/cli");
|
|
718
774
|
if (type === "adonis") {
|
|
719
775
|
if (!(0, import_node_fs2.existsSync)(import_node_path5.default.join(projectDirectory, ".env.example"))) {
|
|
720
|
-
|
|
776
|
+
p6.cancel(
|
|
721
777
|
"Nie znaleziono pliku .env.example. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu Adonisa."
|
|
722
778
|
);
|
|
723
779
|
process.exit(1);
|
|
@@ -767,7 +823,7 @@ var installGithubActions = async () => {
|
|
|
767
823
|
await packageJson4.addScriptIfNotExists("lint", "eslint . --max-warnings=0");
|
|
768
824
|
await packageJson4.addScriptIfNotExists("format", "prettier --write .");
|
|
769
825
|
await packageJson4.addScriptIfNotExists("types:check", "tsc --noEmit");
|
|
770
|
-
|
|
826
|
+
p6.note("Dodano konfiguracj\u0119 CI i skrypty.");
|
|
771
827
|
};
|
|
772
828
|
|
|
773
829
|
// src/cli/install-lint-staged.ts
|
|
@@ -787,7 +843,7 @@ var installLintStaged = async () => {
|
|
|
787
843
|
};
|
|
788
844
|
|
|
789
845
|
// src/cli/install-prettier.ts
|
|
790
|
-
var
|
|
846
|
+
var p7 = __toESM(require("@clack/prompts"), 1);
|
|
791
847
|
var import_node_assert4 = __toESM(require("assert"), 1);
|
|
792
848
|
var import_node_fs3 = require("fs");
|
|
793
849
|
var fs3 = __toESM(require("fs/promises"), 1);
|
|
@@ -811,14 +867,17 @@ var installPrettier = async (isNonInteractive2 = false) => {
|
|
|
811
867
|
const root2 = projectRoot();
|
|
812
868
|
await packageJson6.load();
|
|
813
869
|
import_node_assert4.default.ok(packageJson6.json !== null);
|
|
814
|
-
await packageJson6.install("prettier", {
|
|
870
|
+
await packageJson6.install("prettier", {
|
|
871
|
+
dev: true,
|
|
872
|
+
version: ">=3"
|
|
873
|
+
});
|
|
815
874
|
const prettierConfig = prettierConfigNames.find(
|
|
816
875
|
(configName) => (0, import_node_fs3.existsSync)(import_node_path6.default.join(root2, configName))
|
|
817
876
|
);
|
|
818
877
|
const solvroPrettierPath = "@solvro/config/prettier";
|
|
819
878
|
if (prettierConfig !== void 0 || packageJson6.json.prettier !== void 0) {
|
|
820
879
|
if (packageJson6.json.prettier === solvroPrettierPath) {
|
|
821
|
-
|
|
880
|
+
p7.note("Konfiguracja Prettiera jest ju\u017C ustawiona. Pomijam.");
|
|
822
881
|
return;
|
|
823
882
|
}
|
|
824
883
|
if (isNonInteractive2) {
|
|
@@ -829,8 +888,8 @@ var installPrettier = async (isNonInteractive2 = false) => {
|
|
|
829
888
|
const isConfirmed = await polishConfirm({
|
|
830
889
|
message: `Znaleziono konfiguracj\u0119 Prettiera. Czy chcesz j\u0105 nadpisa\u0107?`
|
|
831
890
|
});
|
|
832
|
-
if (
|
|
833
|
-
|
|
891
|
+
if (p7.isCancel(isConfirmed) || !isConfirmed) {
|
|
892
|
+
p7.cancel("Usu\u0144 konfiguracje Prettiera i spr\xF3buj ponownie.");
|
|
834
893
|
process.exit(1);
|
|
835
894
|
}
|
|
836
895
|
for (const configName of prettierConfigNames) {
|
|
@@ -840,7 +899,7 @@ var installPrettier = async (isNonInteractive2 = false) => {
|
|
|
840
899
|
}
|
|
841
900
|
packageJson6.json.prettier = solvroPrettierPath;
|
|
842
901
|
await packageJson6.save();
|
|
843
|
-
|
|
902
|
+
p7.note("Konfiguracja Prettiera zosta\u0142a dodana.");
|
|
844
903
|
};
|
|
845
904
|
|
|
846
905
|
// src/cli/index.ts
|
|
@@ -851,27 +910,28 @@ var options = program.opts();
|
|
|
851
910
|
var isNonInteractive = process.argv.length > 2;
|
|
852
911
|
async function main() {
|
|
853
912
|
if (!isNonInteractive) {
|
|
854
|
-
|
|
913
|
+
p8.intro(import_picocolors2.default.bold(import_picocolors2.default.bgBlue(" @solvro/config ")));
|
|
855
914
|
}
|
|
856
915
|
const userAgent = (0, import_detect.getUserAgent)();
|
|
857
916
|
if (userAgent !== "npm") {
|
|
858
917
|
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`))}
|
|
918
|
+
const warningMessage = `${import_picocolors2.default.red(import_picocolors2.default.bold(`\u26A0\uFE0F OSTRZE\u017BENIE: ${packageManager} nie jest obs\u0142ugiwany \u26A0\uFE0F`))}
|
|
861
919
|
|
|
862
|
-
Pr\xF3bujesz uruchomi\u0107 ten skrypt
|
|
920
|
+
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
921
|
|
|
864
|
-
Support dla innych mened\u017Cer\xF3w pakiet\xF3w
|
|
922
|
+
${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
923
|
|
|
866
|
-
|
|
867
|
-
${
|
|
924
|
+
${import_picocolors2.default.white(`W mi\u0119dzyczasie u\u017Cyj ${import_picocolors2.default.green("npm")}'a:`)}
|
|
925
|
+
${import_picocolors2.default.cyan("npx @solvro/config")}`;
|
|
868
926
|
if (isNonInteractive) {
|
|
869
927
|
console.error(warningMessage);
|
|
870
928
|
} else {
|
|
871
|
-
|
|
929
|
+
p8.cancel(warningMessage);
|
|
872
930
|
}
|
|
873
931
|
process.exit(1);
|
|
874
932
|
}
|
|
933
|
+
const packageJson7 = new PackageJson();
|
|
934
|
+
await packageJson7.load();
|
|
875
935
|
if (options.force !== true && !isGitClean()) {
|
|
876
936
|
if (isNonInteractive) {
|
|
877
937
|
console.error(
|
|
@@ -882,48 +942,44 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
|
|
|
882
942
|
const isConfirmed = await polishConfirm({
|
|
883
943
|
message: `Masz niezapisane zmiany w Git. Czy chcesz kontynuowa\u0107?`
|
|
884
944
|
});
|
|
885
|
-
if (
|
|
886
|
-
|
|
945
|
+
if (p8.isCancel(isConfirmed) || !isConfirmed) {
|
|
946
|
+
p8.cancel("Zapisz zmiany w Git i spr\xF3buj ponownie.");
|
|
887
947
|
process.exit(1);
|
|
888
948
|
}
|
|
889
949
|
}
|
|
890
|
-
|
|
950
|
+
if (await packageJson7.hasPackage("eslint") && !await packageJson7.doesSatisfy("eslint", "<10")) {
|
|
951
|
+
const eslint = await packageJson7.getPackageInfo("eslint");
|
|
952
|
+
const versionInfo = eslint?.version == null ? "" : ` Obecnie zainstalowana jest wersja ${import_picocolors2.default.yellow(eslint.version)}.`;
|
|
953
|
+
const errorMessage = `ESLint w wersji powy\u017Cej 9 ${import_picocolors2.default.red("nie jest jeszcze wspierany")}.${versionInfo}`;
|
|
954
|
+
const errorRetry = "Prosz\u0119 zainstalowa\u0107 wersj\u0119 9 i spr\xF3bowa\u0107 ponownie.";
|
|
955
|
+
if (isNonInteractive) {
|
|
956
|
+
console.error(errorMessage);
|
|
957
|
+
console.error(errorRetry);
|
|
958
|
+
process.exit(1);
|
|
959
|
+
}
|
|
960
|
+
const isConfirmed = await polishConfirm({
|
|
961
|
+
message: `${errorMessage} Zainstalowa\u0107 starsz\u0105 wersj\u0119 ${import_picocolors2.default.magenta("ESLint")}'a? (Wymagane by kontynuowa\u0107)`
|
|
962
|
+
});
|
|
963
|
+
if (p8.isCancel(isConfirmed) || !isConfirmed) {
|
|
964
|
+
p8.cancel(errorRetry);
|
|
965
|
+
process.exit(1);
|
|
966
|
+
}
|
|
967
|
+
await packageJson7.install("eslint", { dev: true, version: "^9" });
|
|
968
|
+
}
|
|
891
969
|
const projectType = await packageJson7.getProjectType();
|
|
892
970
|
if (!isNonInteractive) {
|
|
893
971
|
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
|
-
}
|
|
972
|
+
await confirmProjectType(import_picocolors2.default.magenta("Adonis"));
|
|
901
973
|
}
|
|
902
974
|
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
|
-
}
|
|
975
|
+
await confirmProjectType(import_picocolors2.default.cyan("React"));
|
|
914
976
|
}
|
|
915
977
|
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
|
-
}
|
|
978
|
+
await confirmProjectType(import_picocolors2.default.red("NestJS"));
|
|
923
979
|
}
|
|
924
980
|
if (projectType === "node") {
|
|
925
|
-
|
|
926
|
-
|
|
981
|
+
p8.cancel(
|
|
982
|
+
`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
983
|
);
|
|
928
984
|
process.exit(1);
|
|
929
985
|
}
|
|
@@ -936,8 +992,8 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
|
|
|
936
992
|
const isConfirmed = await polishConfirm({
|
|
937
993
|
message: `Tw\xF3j projekt nie u\u017Cywa ESM (brak type: "module" w package.json). Czy chcesz to doda\u0107? (Wymagane by kontynuowa\u0107)`
|
|
938
994
|
});
|
|
939
|
-
if (
|
|
940
|
-
|
|
995
|
+
if (p8.isCancel(isConfirmed) || !isConfirmed) {
|
|
996
|
+
p8.cancel("Zmie\u0144 projekt na ESM i spr\xF3buj ponownie.");
|
|
941
997
|
process.exit(1);
|
|
942
998
|
}
|
|
943
999
|
await packageJson7.ensureESM();
|
|
@@ -967,35 +1023,35 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
|
|
|
967
1023
|
process.exit(1);
|
|
968
1024
|
}
|
|
969
1025
|
} else {
|
|
970
|
-
const additionalTools = await
|
|
971
|
-
message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${
|
|
1026
|
+
const additionalTools = await p8.multiselect({
|
|
1027
|
+
message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${import_picocolors2.default.gray("zaznacz spacj\u0105, potwierd\u017A enterem")}`,
|
|
972
1028
|
initialValues: ["eslint", "prettier", "gh-action", "commitlint"],
|
|
973
1029
|
options: [
|
|
974
1030
|
{
|
|
975
1031
|
value: "eslint",
|
|
976
|
-
label:
|
|
1032
|
+
label: import_picocolors2.default.bold(import_picocolors2.default.blueBright("ESLint")),
|
|
977
1033
|
hint: "sprawdzanie jako\u015Bci kodu"
|
|
978
1034
|
},
|
|
979
1035
|
{
|
|
980
1036
|
value: "prettier",
|
|
981
|
-
label:
|
|
1037
|
+
label: import_picocolors2.default.bold(import_picocolors2.default.yellowBright("Prettier")),
|
|
982
1038
|
hint: "formatowanie"
|
|
983
1039
|
},
|
|
984
1040
|
{
|
|
985
1041
|
value: "gh-action",
|
|
986
|
-
label:
|
|
1042
|
+
label: import_picocolors2.default.bold("GitHub Actions"),
|
|
987
1043
|
hint: "automatyczne testy na Githubie"
|
|
988
1044
|
},
|
|
989
1045
|
{
|
|
990
1046
|
value: "commitlint",
|
|
991
|
-
label:
|
|
1047
|
+
label: import_picocolors2.default.bold("Commitlint"),
|
|
992
1048
|
hint: "walidacja tre\u015Bci commit\xF3w"
|
|
993
1049
|
}
|
|
994
1050
|
],
|
|
995
1051
|
required: false
|
|
996
1052
|
});
|
|
997
|
-
if (
|
|
998
|
-
|
|
1053
|
+
if (p8.isCancel(additionalTools) || additionalTools.length === 0) {
|
|
1054
|
+
p8.cancel("Nie wybrano \u017Cadnych narz\u0119dzi.");
|
|
999
1055
|
process.exit(1);
|
|
1000
1056
|
}
|
|
1001
1057
|
toolsToInstall = additionalTools;
|
|
@@ -1018,16 +1074,29 @@ ${import_picocolors.default.cyan("npx @solvro/config")}`;
|
|
|
1018
1074
|
await installGithubActions();
|
|
1019
1075
|
}
|
|
1020
1076
|
await packageJson7.clearInstall();
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
} else {
|
|
1024
|
-
p6.outro("\u2705 Konfiguracja zako\u0144czona pomy\u015Blnie!");
|
|
1025
|
-
}
|
|
1077
|
+
const printSuccess = isNonInteractive ? console.info : p8.outro;
|
|
1078
|
+
printSuccess("\u2705 Konfiguracja zako\u0144czona pomy\u015Blnie!");
|
|
1026
1079
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1080
|
+
async function mainWrapper() {
|
|
1081
|
+
try {
|
|
1082
|
+
await main();
|
|
1083
|
+
} catch (error) {
|
|
1084
|
+
if (process.env.NODE_ENV === "development") {
|
|
1085
|
+
console.error(
|
|
1086
|
+
import_picocolors2.default.red("Unhandled error in main:"),
|
|
1087
|
+
error instanceof Error ? error.message : error
|
|
1088
|
+
);
|
|
1089
|
+
} else {
|
|
1090
|
+
const errorMessage = "Wyst\u0105pi\u0142 nieoczekiwany b\u0142\u0105d :( Prosz\u0119 zg\u0142osi\u0107 go tw\xF3rcom:";
|
|
1091
|
+
if (isNonInteractive) {
|
|
1092
|
+
console.error(errorMessage);
|
|
1093
|
+
console.error(BUG_TRACKER_URL);
|
|
1094
|
+
} else {
|
|
1095
|
+
p8.cancel(`${errorMessage} ${BUG_TRACKER_URL}`);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
process.exit(1);
|
|
1099
|
+
}
|
|
1032
1100
|
}
|
|
1101
|
+
void mainWrapper();
|
|
1033
1102
|
//# sourceMappingURL=index.cjs.map
|