@solvro/config 1.6.0 → 1.7.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/bin/index.js +2 -0
- package/dist/cli/index.js +521 -0
- package/dist/eslint/index.cjs +39 -43
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.js +39 -43
- package/dist/eslint/index.js.map +1 -1
- package/dist/prettier/index.js +4 -2
- package/package.json +23 -13
package/bin/index.js
ADDED
@@ -0,0 +1,521 @@
|
|
1
|
+
// src/cli/index.ts
|
2
|
+
import * as p6 from "@clack/prompts";
|
3
|
+
import { $ as $4 } from "execa";
|
4
|
+
import { isPackageListed as isPackageListed2 } from "local-pkg";
|
5
|
+
import c from "picocolors";
|
6
|
+
|
7
|
+
// src/utils/get-project-type.ts
|
8
|
+
import { isPackageExists } from "local-pkg";
|
9
|
+
var getProjectType = () => {
|
10
|
+
const isAdonis = isPackageExists("@adonisjs/core");
|
11
|
+
const isNext = isPackageExists("next");
|
12
|
+
if (isNext && isAdonis) {
|
13
|
+
throw new Error(
|
14
|
+
"You can't use both Adonis and Next.js in the same project"
|
15
|
+
);
|
16
|
+
}
|
17
|
+
if (isAdonis) {
|
18
|
+
return "adonis";
|
19
|
+
}
|
20
|
+
if (isNext) {
|
21
|
+
return "next";
|
22
|
+
}
|
23
|
+
return "node";
|
24
|
+
};
|
25
|
+
|
26
|
+
// src/utils/git-root.ts
|
27
|
+
import { execSync } from "node:child_process";
|
28
|
+
var gitRoot = () => {
|
29
|
+
const root = execSync("git rev-parse --show-toplevel").toString().trim();
|
30
|
+
return root;
|
31
|
+
};
|
32
|
+
|
33
|
+
// src/utils/is-git-clean.ts
|
34
|
+
import { execSync as execSync2 } from "node:child_process";
|
35
|
+
function isGitClean() {
|
36
|
+
try {
|
37
|
+
execSync2("git diff-index --quiet HEAD --");
|
38
|
+
return true;
|
39
|
+
} catch {
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
// src/utils/polish-confirm.ts
|
45
|
+
import * as p from "@clack/prompts";
|
46
|
+
var polishConfirm = async (props) => {
|
47
|
+
return p.confirm({
|
48
|
+
active: "Tak",
|
49
|
+
inactive: "Nie",
|
50
|
+
...props
|
51
|
+
});
|
52
|
+
};
|
53
|
+
|
54
|
+
// src/cli/install-eslint.ts
|
55
|
+
import * as p2 from "@clack/prompts";
|
56
|
+
import { $ } from "execa";
|
57
|
+
import { getPackageInfo } from "local-pkg";
|
58
|
+
import { existsSync } from "node:fs";
|
59
|
+
import * as fs from "node:fs/promises";
|
60
|
+
import path from "node:path";
|
61
|
+
import semver from "semver";
|
62
|
+
var $$ = $({
|
63
|
+
cwd: gitRoot(),
|
64
|
+
stdout: ["pipe", "inherit"]
|
65
|
+
});
|
66
|
+
var eslintConfigNames = [
|
67
|
+
".eslintrc.js",
|
68
|
+
".eslintrc.cjs",
|
69
|
+
".eslintrc.yaml",
|
70
|
+
".eslintrc.yml",
|
71
|
+
".eslintrc.json",
|
72
|
+
".eslintrc",
|
73
|
+
"eslint.config.js",
|
74
|
+
"eslint.config.mjs",
|
75
|
+
"eslint.config.cjs",
|
76
|
+
"eslint.config.ts",
|
77
|
+
"eslint.config.mts",
|
78
|
+
"eslint.config.cts"
|
79
|
+
];
|
80
|
+
var installEslint = async () => {
|
81
|
+
const root = gitRoot();
|
82
|
+
const eslint = await getPackageInfo("eslint");
|
83
|
+
if (typeof eslint?.version !== "string") {
|
84
|
+
const isConfirmed = await polishConfirm({
|
85
|
+
message: `Eslint nie jest zainstalowany. Czy chcesz go zainstalowa\u0107?`
|
86
|
+
});
|
87
|
+
if (!isConfirmed || p2.isCancel(isConfirmed)) {
|
88
|
+
p2.cancel("Zainstaluj Eslint i spr\xF3buj ponownie.");
|
89
|
+
process.exit(1);
|
90
|
+
}
|
91
|
+
const spinner4 = p2.spinner();
|
92
|
+
spinner4.start("Instalowanie Eslint");
|
93
|
+
await $$`npm i -D eslint`;
|
94
|
+
spinner4.stop("Eslint zainstalowany");
|
95
|
+
} else if (!semver.satisfies(eslint.version, ">=9")) {
|
96
|
+
const isConfirmed = await polishConfirm({
|
97
|
+
message: `Eslint jest zainstalowany, ale trzeba go zaktualizowa\u0107. Czy chcesz zaktualizowa\u0107?`
|
98
|
+
});
|
99
|
+
if (!isConfirmed || p2.isCancel(isConfirmed)) {
|
100
|
+
p2.cancel("Zaktualizuj Eslint i spr\xF3buj ponownie.");
|
101
|
+
process.exit(1);
|
102
|
+
}
|
103
|
+
const spinner4 = p2.spinner();
|
104
|
+
spinner4.start("Aktualizowanie Eslinta");
|
105
|
+
await $$`npm i -D eslint@latest`;
|
106
|
+
spinner4.stop("Eslint zaktualizowany");
|
107
|
+
}
|
108
|
+
const eslintConfig = eslintConfigNames.find(
|
109
|
+
(configName) => existsSync(path.join(root, configName))
|
110
|
+
);
|
111
|
+
if (eslintConfig) {
|
112
|
+
const eslintContent = await fs.readFile(
|
113
|
+
path.join(root, eslintConfig),
|
114
|
+
"utf-8"
|
115
|
+
);
|
116
|
+
if (eslintContent.includes("export default solvro(")) {
|
117
|
+
p2.note("Eslint jest ju\u017C skonfigurowany. Pomijam.");
|
118
|
+
return;
|
119
|
+
} else {
|
120
|
+
const isConfirmed = await polishConfirm({
|
121
|
+
message: `Znaleziono plik konfiguracyjny Eslint. Czy chcesz go nadpisa\u0107?`
|
122
|
+
});
|
123
|
+
if (!isConfirmed || p2.isCancel(isConfirmed)) {
|
124
|
+
p2.cancel("Nadpisz plik konfiguracyjny Eslint i spr\xF3buj ponownie.");
|
125
|
+
process.exit(1);
|
126
|
+
}
|
127
|
+
await fs.rm(path.join(root, eslintConfig));
|
128
|
+
}
|
129
|
+
}
|
130
|
+
await fs.writeFile(
|
131
|
+
path.join(gitRoot(), "eslint.config.js"),
|
132
|
+
`import { solvro } from "@solvro/config/eslint";
|
133
|
+
|
134
|
+
export default solvro();
|
135
|
+
`
|
136
|
+
);
|
137
|
+
p2.note("Plik konfiguracyjny Eslint zosta\u0142 utworzony.");
|
138
|
+
};
|
139
|
+
|
140
|
+
// src/cli/install-ga.ts
|
141
|
+
import * as p3 from "@clack/prompts";
|
142
|
+
import { loadPackageJSON } from "local-pkg";
|
143
|
+
import { existsSync as existsSync2 } from "node:fs";
|
144
|
+
import * as fs2 from "node:fs/promises";
|
145
|
+
import path2 from "node:path";
|
146
|
+
|
147
|
+
// src/cli/templates/adonis-ci.ts
|
148
|
+
var adonisCi = ({ nodeVersion }) => `name: CI
|
149
|
+
|
150
|
+
on:
|
151
|
+
push:
|
152
|
+
branches: ["main"]
|
153
|
+
pull_request:
|
154
|
+
|
155
|
+
jobs:
|
156
|
+
lint:
|
157
|
+
runs-on: ubuntu-latest
|
158
|
+
steps:
|
159
|
+
- name: Checkout
|
160
|
+
uses: actions/checkout@v4
|
161
|
+
|
162
|
+
- name: Setup node
|
163
|
+
uses: actions/setup-node@v4
|
164
|
+
with:
|
165
|
+
node-version: ${nodeVersion}
|
166
|
+
cache: 'npm'
|
167
|
+
|
168
|
+
- name: Install dependencies
|
169
|
+
run: npm ci
|
170
|
+
|
171
|
+
- name: Set up AdonisJS environment
|
172
|
+
run: |
|
173
|
+
cp .env.example .env
|
174
|
+
node ace generate:key
|
175
|
+
|
176
|
+
- name: Run prettier
|
177
|
+
run: npm run format:check
|
178
|
+
if: always()
|
179
|
+
|
180
|
+
- name: Run Lint
|
181
|
+
run: npm run lint
|
182
|
+
if: always()
|
183
|
+
|
184
|
+
- name: Check types
|
185
|
+
run: npm run typecheck
|
186
|
+
if: always()
|
187
|
+
|
188
|
+
- name: Run tests
|
189
|
+
run: npm test
|
190
|
+
if: always()
|
191
|
+
|
192
|
+
- name: Build
|
193
|
+
run: npm run build
|
194
|
+
if: always()`;
|
195
|
+
|
196
|
+
// src/cli/templates/dependabot.ts
|
197
|
+
var dependabot = () => `version: 2
|
198
|
+
updates:
|
199
|
+
- package-ecosystem: "npm"
|
200
|
+
directory: "/"
|
201
|
+
schedule:
|
202
|
+
interval: "daily"
|
203
|
+
allow:
|
204
|
+
- dependency-name: "@solvro/config"
|
205
|
+
`;
|
206
|
+
|
207
|
+
// src/cli/templates/next-ci.ts
|
208
|
+
var nextCi = ({ nodeVersion }) => `name: CI
|
209
|
+
|
210
|
+
on:
|
211
|
+
push:
|
212
|
+
branches: ["main"]
|
213
|
+
pull_request:
|
214
|
+
|
215
|
+
jobs:
|
216
|
+
lint:
|
217
|
+
runs-on: ubuntu-latest
|
218
|
+
steps:
|
219
|
+
- name: Checkout
|
220
|
+
uses: actions/checkout@v4
|
221
|
+
|
222
|
+
- name: Setup node
|
223
|
+
uses: actions/setup-node@v4
|
224
|
+
with:
|
225
|
+
node-version: ${nodeVersion}
|
226
|
+
cache: 'npm'
|
227
|
+
|
228
|
+
- name: Install dependencies
|
229
|
+
run: npm ci
|
230
|
+
|
231
|
+
- name: Format check
|
232
|
+
run: npm run format:check
|
233
|
+
if: always()
|
234
|
+
|
235
|
+
- name: Build
|
236
|
+
run: npm run build
|
237
|
+
if: always()`;
|
238
|
+
|
239
|
+
// src/cli/install-ga.ts
|
240
|
+
var installGithubActions = async () => {
|
241
|
+
const root = gitRoot();
|
242
|
+
const ghWorkflowsDir = path2.join(root, ".github/workflows");
|
243
|
+
await fs2.mkdir(ghWorkflowsDir, { recursive: true });
|
244
|
+
const type = getProjectType();
|
245
|
+
if (type === "adonis") {
|
246
|
+
if (!existsSync2(path2.join(root, ".env.example"))) {
|
247
|
+
p3.cancel(
|
248
|
+
"Nie znaleziono pliku .env.example. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu Adonisa."
|
249
|
+
);
|
250
|
+
process.exit(1);
|
251
|
+
}
|
252
|
+
await fs2.writeFile(
|
253
|
+
path2.join(ghWorkflowsDir, "ci.yml"),
|
254
|
+
adonisCi({
|
255
|
+
nodeVersion: "22"
|
256
|
+
})
|
257
|
+
);
|
258
|
+
}
|
259
|
+
if (type === "next") {
|
260
|
+
await fs2.writeFile(
|
261
|
+
path2.join(ghWorkflowsDir, "ci.yml"),
|
262
|
+
nextCi({
|
263
|
+
nodeVersion: "22"
|
264
|
+
})
|
265
|
+
);
|
266
|
+
}
|
267
|
+
p3.note("Dodano konfiguracj\u0119 CI.");
|
268
|
+
if (!existsSync2(path2.join(root, ".github/depenabot.yml"))) {
|
269
|
+
await fs2.writeFile(path2.join(root, ".github/depenabot.yml"), dependabot());
|
270
|
+
}
|
271
|
+
p3.note("Dodano automatyczne aktualizacje configu.");
|
272
|
+
const packageJson = await loadPackageJSON(root);
|
273
|
+
if (!packageJson) {
|
274
|
+
p3.cancel(
|
275
|
+
"Nie znaleziono package.json. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu."
|
276
|
+
);
|
277
|
+
process.exit(1);
|
278
|
+
}
|
279
|
+
packageJson.scripts = packageJson.scripts ?? {};
|
280
|
+
if (!packageJson.scripts["format:check"]) {
|
281
|
+
packageJson.scripts["format:check"] = "prettier --check .";
|
282
|
+
}
|
283
|
+
if (!packageJson.scripts.lint) {
|
284
|
+
packageJson.scripts.lint = "eslint .";
|
285
|
+
}
|
286
|
+
if (!packageJson.scripts.format) {
|
287
|
+
packageJson.scripts.format = "prettier --write .";
|
288
|
+
}
|
289
|
+
if (!packageJson.scripts.typecheck) {
|
290
|
+
packageJson.scripts.typecheck = "tsc --noEmit";
|
291
|
+
}
|
292
|
+
await fs2.writeFile(
|
293
|
+
path2.join(root, "package.json"),
|
294
|
+
JSON.stringify(packageJson, null, 2)
|
295
|
+
);
|
296
|
+
p3.note("Dodano skrypty do package.json.");
|
297
|
+
};
|
298
|
+
|
299
|
+
// src/cli/install-lint-staged.ts
|
300
|
+
import * as p4 from "@clack/prompts";
|
301
|
+
import { $ as $2 } from "execa";
|
302
|
+
import { writeFile as writeFile3 } from "fs/promises";
|
303
|
+
import { isPackageListed, loadPackageJSON as loadPackageJSON2 } from "local-pkg";
|
304
|
+
import path3 from "path";
|
305
|
+
var $$2 = $2({
|
306
|
+
cwd: gitRoot(),
|
307
|
+
stdout: ["pipe", "inherit"]
|
308
|
+
});
|
309
|
+
var installLintStaged = async () => {
|
310
|
+
const lintStaged = await isPackageListed("lint-staged");
|
311
|
+
const husky = await isPackageListed("husky");
|
312
|
+
if (!lintStaged) {
|
313
|
+
const spinner4 = p4.spinner();
|
314
|
+
spinner4.start("Instalowanie lint-staged");
|
315
|
+
await $$2`npm i -D lint-staged`;
|
316
|
+
spinner4.stop("lint-staged zainstalowany");
|
317
|
+
}
|
318
|
+
if (!husky) {
|
319
|
+
const spinner4 = p4.spinner();
|
320
|
+
spinner4.start("Instalowanie husky");
|
321
|
+
await $$2`npm i -D husky`;
|
322
|
+
await $2`npx husky init`;
|
323
|
+
spinner4.stop("husky zainstalowany");
|
324
|
+
}
|
325
|
+
await writeFile3(".husky/pre-commit", "npx lint-staged\n");
|
326
|
+
const packageJson = await loadPackageJSON2(gitRoot());
|
327
|
+
if (!packageJson) {
|
328
|
+
p4.cancel(
|
329
|
+
"Nie znaleziono package.json. Upewnij si\u0119, \u017Ce jeste\u015B w katalogu projektu."
|
330
|
+
);
|
331
|
+
process.exit(1);
|
332
|
+
}
|
333
|
+
packageJson["lint-staged"] = {
|
334
|
+
"*": "prettier -w --ignore-unknown"
|
335
|
+
};
|
336
|
+
await writeFile3(
|
337
|
+
path3.join(gitRoot(), "package.json"),
|
338
|
+
JSON.stringify(packageJson, null, 2)
|
339
|
+
);
|
340
|
+
p4.note("Dodano automatyczne formatowanie przy commicie.");
|
341
|
+
};
|
342
|
+
|
343
|
+
// src/cli/install-prettier.ts
|
344
|
+
import * as p5 from "@clack/prompts";
|
345
|
+
import { $ as $3 } from "execa";
|
346
|
+
import { getPackageInfo as getPackageInfo2, loadPackageJSON as loadPackageJSON3 } from "local-pkg";
|
347
|
+
import { existsSync as existsSync3 } from "node:fs";
|
348
|
+
import * as fs3 from "node:fs/promises";
|
349
|
+
import path4 from "node:path";
|
350
|
+
import semver2 from "semver";
|
351
|
+
var $$3 = $3({
|
352
|
+
cwd: gitRoot(),
|
353
|
+
stdout: ["pipe", "inherit"]
|
354
|
+
});
|
355
|
+
var prettierConfigNames = [
|
356
|
+
".prettierrc.js",
|
357
|
+
".prettierrc.cjs",
|
358
|
+
".prettierrc.yaml",
|
359
|
+
".prettierrc.yml",
|
360
|
+
".prettierrc.json",
|
361
|
+
".prettierrc",
|
362
|
+
"prettier.config.js",
|
363
|
+
"prettier.config.mjs",
|
364
|
+
"prettier.config.cjs",
|
365
|
+
"prettier.config.ts",
|
366
|
+
"prettier.config.mts",
|
367
|
+
"prettier.config.cts"
|
368
|
+
];
|
369
|
+
var installPrettier = async () => {
|
370
|
+
const root = gitRoot();
|
371
|
+
const packageJsonPath = path4.join(root, "package.json");
|
372
|
+
const prettier = await getPackageInfo2("prettier");
|
373
|
+
if (typeof prettier?.version !== "string") {
|
374
|
+
const isConfirmed = await polishConfirm({
|
375
|
+
message: `Prettier nie jest zainstalowany. Czy chcesz go zainstalowa\u0107?`
|
376
|
+
});
|
377
|
+
if (!isConfirmed || p5.isCancel(isConfirmed)) {
|
378
|
+
p5.cancel("Zainstaluj Prettiera i spr\xF3buj ponownie.");
|
379
|
+
process.exit(1);
|
380
|
+
}
|
381
|
+
const spinner4 = p5.spinner();
|
382
|
+
spinner4.start("Instalowanie Prettiera");
|
383
|
+
await $$3`npm i -D prettier`;
|
384
|
+
spinner4.stop("Prettiera zainstalowany");
|
385
|
+
} else if (!semver2.satisfies(prettier.version, ">=3")) {
|
386
|
+
const isConfirmed = await polishConfirm({
|
387
|
+
message: `Prettier jest zainstalowany, ale trzeba go zaktualizowa\u0107. Czy chcesz zaktualizowa\u0107?`
|
388
|
+
});
|
389
|
+
if (p5.isCancel(isConfirmed) || !isConfirmed) {
|
390
|
+
p5.cancel("Zaktualizuj Prettiera i spr\xF3buj ponownie.");
|
391
|
+
process.exit(1);
|
392
|
+
}
|
393
|
+
const spinner4 = p5.spinner();
|
394
|
+
spinner4.start("Aktualizowanie Prettiera");
|
395
|
+
await $$3`npm i -D eslint@latest`;
|
396
|
+
spinner4.stop("Prettier zaktualizowany");
|
397
|
+
}
|
398
|
+
const prettierConfig = prettierConfigNames.find(
|
399
|
+
(configName) => existsSync3(path4.join(root, configName))
|
400
|
+
);
|
401
|
+
const packageJson = await loadPackageJSON3();
|
402
|
+
if (!packageJson) {
|
403
|
+
p5.cancel("Nie znaleziono pliku package.json.");
|
404
|
+
process.exit(1);
|
405
|
+
}
|
406
|
+
const solvroPrettierPath = "@solvro/config/prettier";
|
407
|
+
if (prettierConfig || packageJson.prettier) {
|
408
|
+
if (packageJson.prettier === solvroPrettierPath) {
|
409
|
+
p5.note("Konfiguracja Prettiera jest ju\u017C ustawiona. Pomijam.");
|
410
|
+
return;
|
411
|
+
}
|
412
|
+
const isConfirmed = await polishConfirm({
|
413
|
+
message: `Znaleziono konfiguracj\u0119 Prettiera. Czy chcesz j\u0105 nadpisa\u0107?`
|
414
|
+
});
|
415
|
+
if (!isConfirmed || p5.isCancel(isConfirmed)) {
|
416
|
+
p5.cancel("Usu\u0144 konfiguracje Prettiera i spr\xF3buj ponownie.");
|
417
|
+
process.exit(1);
|
418
|
+
}
|
419
|
+
for (const configName of prettierConfigNames) {
|
420
|
+
await fs3.rm(path4.join(root, configName)).catch(() => null);
|
421
|
+
}
|
422
|
+
}
|
423
|
+
const newPackageJson = await loadPackageJSON3();
|
424
|
+
if (!newPackageJson) {
|
425
|
+
p5.cancel("Nie znaleziono pliku package.json.");
|
426
|
+
process.exit(1);
|
427
|
+
}
|
428
|
+
newPackageJson.prettier = solvroPrettierPath;
|
429
|
+
await fs3.writeFile(packageJsonPath, JSON.stringify(newPackageJson, null, 2));
|
430
|
+
p5.note("Konfiguracja Prettiera zosta\u0142a dodana.");
|
431
|
+
};
|
432
|
+
|
433
|
+
// src/cli/index.ts
|
434
|
+
p6.intro(`${c.bold(c.bgBlue(" @solvro/config "))}`);
|
435
|
+
var projectType = getProjectType();
|
436
|
+
if (!isGitClean()) {
|
437
|
+
const isConfirmed = await polishConfirm({
|
438
|
+
message: `Masz niezapisane zmiany w Git. Czy chcesz kontynuowa\u0107?`
|
439
|
+
});
|
440
|
+
if (!isConfirmed || p6.isCancel(isConfirmed)) {
|
441
|
+
p6.cancel("Zapisz zmiany w Git i spr\xF3buj ponownie.");
|
442
|
+
process.exit(1);
|
443
|
+
}
|
444
|
+
}
|
445
|
+
if (projectType === "adonis") {
|
446
|
+
const isConfirmed = await polishConfirm({
|
447
|
+
message: `Wygl\u0105da jakby\u015B u\u017Cywa\u0142 Adonisa. Czy to si\u0119 zgadza?`
|
448
|
+
});
|
449
|
+
if (!isConfirmed || p6.isCancel(isConfirmed)) {
|
450
|
+
p6.cancel("Zg\u0142o\u015B b\u0142\u0105d na GitHubie :(, a my spr\xF3bujemy pom\xF3c.");
|
451
|
+
process.exit(1);
|
452
|
+
}
|
453
|
+
}
|
454
|
+
if (projectType === "next") {
|
455
|
+
const isConfirmed = await polishConfirm({
|
456
|
+
message: `Wygl\u0105da jakby\u015B u\u017Cywa\u0142 Next.js. Czy to si\u0119 zgadza?`
|
457
|
+
});
|
458
|
+
if (p6.isCancel(isConfirmed)) {
|
459
|
+
p6.cancel("\u{1F621}");
|
460
|
+
process.exit(1);
|
461
|
+
}
|
462
|
+
if (!isConfirmed) {
|
463
|
+
p6.cancel("Zg\u0142o\u015B b\u0142\u0105d na GitHubie :(, a my spr\xF3bujemy pom\xF3c.");
|
464
|
+
process.exit(1);
|
465
|
+
}
|
466
|
+
}
|
467
|
+
if (projectType === "node") {
|
468
|
+
p6.cancel(
|
469
|
+
"Nie znaleziono ani Adonisa, ani Next.js. Musisz r\u0119cznie konfigurowa\u0107 projekt."
|
470
|
+
);
|
471
|
+
process.exit(1);
|
472
|
+
}
|
473
|
+
var additionalTools = await p6.multiselect({
|
474
|
+
message: `Kt\xF3re rzeczy Ci\u0119 interesuj\u0105? ${c.gray("zaznacz spacj\u0105, potwierd\u017A enterem")}`,
|
475
|
+
initialValues: ["eslint", "prettier", "gh-action"],
|
476
|
+
options: [
|
477
|
+
{
|
478
|
+
value: "eslint",
|
479
|
+
label: `${c.bold(c.blueBright("ESLint"))}`,
|
480
|
+
hint: "sprawdzanie jako\u015Bci kodu"
|
481
|
+
},
|
482
|
+
{
|
483
|
+
value: "prettier",
|
484
|
+
label: `${c.bold(c.yellowBright("Prettier"))}`,
|
485
|
+
hint: "formatowanie"
|
486
|
+
},
|
487
|
+
{
|
488
|
+
value: "gh-action",
|
489
|
+
label: `${c.bold("GitHub Actions")}`,
|
490
|
+
hint: "automatyczne testy na Githubie"
|
491
|
+
}
|
492
|
+
],
|
493
|
+
required: false
|
494
|
+
});
|
495
|
+
var $$4 = $4({
|
496
|
+
cwd: gitRoot(),
|
497
|
+
stdout: ["pipe", "inherit"]
|
498
|
+
});
|
499
|
+
if (p6.isCancel(additionalTools)) {
|
500
|
+
p6.cancel("Nie wybrano \u017Cadnych narz\u0119dzi.");
|
501
|
+
process.exit(1);
|
502
|
+
}
|
503
|
+
await p6.tasks([
|
504
|
+
{
|
505
|
+
title: "Instalowanie @solvro/config",
|
506
|
+
enabled: !await isPackageListed2("@solvro/config"),
|
507
|
+
task: async () => {
|
508
|
+
await $$4`npm i -D @solvro/config`;
|
509
|
+
}
|
510
|
+
}
|
511
|
+
]);
|
512
|
+
if (additionalTools.includes("eslint")) {
|
513
|
+
await installEslint();
|
514
|
+
}
|
515
|
+
if (additionalTools.includes("prettier")) {
|
516
|
+
await installPrettier();
|
517
|
+
await installLintStaged();
|
518
|
+
}
|
519
|
+
if (additionalTools.includes("gh-action")) {
|
520
|
+
await installGithubActions();
|
521
|
+
}
|