-
-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathfinalizeDependencies.ts
79 lines (74 loc) · 2.06 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
78
79
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 = [
"@types/eslint",
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"eslint",
"eslint-config-prettier",
"eslint-plugin-deprecation",
"eslint-plugin-eslint-comments",
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"eslint-plugin-n",
"eslint-plugin-regexp",
"husky",
"lint-staged",
"prettier",
"prettier-plugin-curly",
"prettier-plugin-packagejson",
"tsup",
"typescript",
...(options.excludeContributors ? [] : ["all-contributors-cli"]),
...(options.excludeLintJson
? []
: ["eslint-plugin-jsonc", "jsonc-eslint-parser"]),
...(options.excludeLintKnip ? [] : ["knip"]),
...(options.excludeLintMd
? []
: [
"eslint-plugin-markdown",
"markdownlint",
"markdownlint-cli",
"sentences-per-line",
]),
...(options.excludeLintPackageJson
? []
: ["npm-package-json-lint", "npm-package-json-lint-config-default"]),
...(options.excludeLintPerfectionist
? []
: ["eslint-plugin-perfectionist"]),
...(options.excludeLintSpelling ? [] : ["cspell"]),
...(options.excludeLintYml
? []
: ["eslint-plugin-yml", "yaml-eslint-parser"]),
...(options.excludeReleases
? []
: ["release-it", "should-semantic-release"]),
...(options.excludeTests
? []
: [
"@vitest/coverage-v8",
"console-fail-test",
"eslint-plugin-no-only-tests",
"eslint-plugin-vitest",
"vitest",
]),
]
.filter(Boolean)
.sort()
.map((packageName) => `${packageName}@latest`)
.join(" ");
await execaCommand(`pnpm add ${devDependencies} -D`);
if (!options.excludeContributors) {
await execaCommand(`npx all-contributors-cli generate`);
await removeDependencies(
["all-contributors-cli", "all-contributors-for-repository"],
(await readPackageData()).devDependencies,
"-D",
);
}
await execaCommand("pnpm run format:write");
}