-
-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathclearUnnecessaryFiles.ts
37 lines (34 loc) · 1013 Bytes
/
clearUnnecessaryFiles.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
import * as fs from "node:fs/promises";
const globPaths = [
...extensions(".babelrc", "cjs", "cts", "js", "json", "mjs"),
...extensions(".eslintrc", "js", "json", "yml"),
...extensions(".prettierrc", "json", "json5", "yaml", "yml"),
...extensions("prettier.config", "js", "mjs", "cjs"),
...extensions("babel.config", "cjs", "cts", "js", "json", "mjs"),
...extensions("jest.config", "cjs", "js", "json", "mjs", "ts"),
"./src/**/*.js",
".circleci/config.yml",
".github/codecov.yml",
".babelrc",
".npmignore",
".eslintignore",
".eslintrc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
".npmpackagejsonlintrc.json",
"codecov.yml",
"DEVELOPMENT.md",
"dist",
"lib",
"package-lock.json",
"travis.yml",
"yarn.lock",
];
function extensions(base: string, ...extensions: string[]) {
return extensions.map((extension) => [base, extension].join("."));
}
export async function clearUnnecessaryFiles() {
for (const globPath of globPaths) {
await fs.rm(globPath, { force: true, recursive: true });
}
}