-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathfinalizeDependencies.ts
77 lines (72 loc) · 2.07 KB
/
finalizeDependencies.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { execaCommand } from "execa";
import { readPackageData, removeDependencies } from "../shared/packages.js";
import { Options } from "../shared/types.js";
export async function finalizeDependencies(options: Options) {
const devDependencies = [
"@eslint/js",
"@eslint-community/eslint-plugin-eslint-comments",
"@types/eslint-plugin-markdown",
"@types/eslint__js",
"@types/node",
"eslint",
"eslint-plugin-jsdoc",
"eslint-plugin-n",
"eslint-plugin-regexp",
"husky",
"lint-staged",
"prettier",
"prettier-plugin-curly",
"prettier-plugin-sh",
"prettier-plugin-packagejson",
"tsup",
"typescript",
"typescript-eslint",
...(options.excludeAllContributors ? [] : ["all-contributors-cli"]),
...(options.excludeLintJson ? [] : ["eslint-plugin-jsonc"]),
...(options.excludeLintJson && options.excludeLintPackageJson
? []
: ["jsonc-eslint-parser"]),
...(options.excludeLintKnip ? [] : ["knip"]),
...(options.excludeLintMd
? []
: [
"eslint-plugin-markdown",
"markdownlint",
"markdownlint-cli",
"sentences-per-line",
]),
...(options.excludeLintPackageJson ? [] : ["eslint-plugin-package-json"]),
...(options.excludeLintPerfectionist
? []
: ["eslint-plugin-perfectionist"]),
...(options.excludeLintSpelling ? [] : ["cspell"]),
...(options.excludeLintYml ? [] : ["eslint-plugin-yml"]),
...(options.excludeReleases
? []
: ["@release-it/conventional-changelog", "release-it"]),
...(options.excludeTests
? []
: [
"@vitest/coverage-v8",
"console-fail-test",
"eslint-plugin-vitest",
"vitest",
]),
]
.filter(Boolean)
.sort()
.map((packageName) => `${packageName}@latest`)
.join(" ");
await execaCommand(
`pnpm add ${devDependencies} -D${options.offline ? " --offline" : ""}`,
);
if (!options.excludeAllContributors) {
await execaCommand(`npx all-contributors-cli generate`);
await removeDependencies(
["all-contributors-cli", "all-contributors-for-repository"],
(await readPackageData()).devDependencies,
"-D",
);
}
await execaCommand(`pnpm dedupe --offline`);
}