@twahaa/codefinder 1.0.1 → 1.0.2
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/build/client.js +1 -1
- package/build/server.js +1 -1
- package/build/tools/listFile.js +2 -13
- package/build/utils/ignoreList.js +41 -0
- package/package.json +1 -1
package/build/client.js
CHANGED
package/build/server.js
CHANGED
package/build/tools/listFile.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { resolveSafePath } from "../utils/pathGuard.js";
|
|
4
|
-
|
|
5
|
-
"node_modules",
|
|
6
|
-
".git",
|
|
7
|
-
"dist",
|
|
8
|
-
"build",
|
|
9
|
-
".next",
|
|
10
|
-
".env",
|
|
11
|
-
"package-lock.json",
|
|
12
|
-
"yarn.lock",
|
|
13
|
-
"pnpm-lock.yaml",
|
|
14
|
-
"package.json",
|
|
15
|
-
]);
|
|
4
|
+
import { IGNORE_LIST } from "../utils/ignoreList.js";
|
|
16
5
|
const MAX_DEPTH = 2;
|
|
17
6
|
export function listFile(dir = ".") {
|
|
18
7
|
const safeDir = resolveSafePath(dir);
|
|
@@ -26,7 +15,7 @@ function walkDirectory(absoluteDir, depth) {
|
|
|
26
15
|
const entires = fs.readdirSync(absoluteDir, { withFileTypes: true });
|
|
27
16
|
const result = [];
|
|
28
17
|
for (const entry of entires) {
|
|
29
|
-
if (
|
|
18
|
+
if (IGNORE_LIST.has(entry.name))
|
|
30
19
|
continue;
|
|
31
20
|
const entryPath = path.join(absoluteDir, entry.name);
|
|
32
21
|
if (entry.isFile()) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const IGNORE_LIST = new Set([
|
|
2
|
+
// Version control
|
|
3
|
+
".git",
|
|
4
|
+
".svn",
|
|
5
|
+
".hg",
|
|
6
|
+
// Dependencies
|
|
7
|
+
"node_modules",
|
|
8
|
+
"bower_components",
|
|
9
|
+
// Build outputs
|
|
10
|
+
"dist",
|
|
11
|
+
"build",
|
|
12
|
+
".next",
|
|
13
|
+
"out",
|
|
14
|
+
"coverage",
|
|
15
|
+
// Environment variables
|
|
16
|
+
".env",
|
|
17
|
+
".env.local",
|
|
18
|
+
".env.development",
|
|
19
|
+
".env.test",
|
|
20
|
+
".env.production",
|
|
21
|
+
// Lock files
|
|
22
|
+
"package-lock.json",
|
|
23
|
+
"yarn.lock",
|
|
24
|
+
"pnpm-lock.yaml",
|
|
25
|
+
// IDEs and editors
|
|
26
|
+
".vscode",
|
|
27
|
+
".idea",
|
|
28
|
+
".project",
|
|
29
|
+
".classpath",
|
|
30
|
+
".settings",
|
|
31
|
+
// OS generated files
|
|
32
|
+
".DS_Store",
|
|
33
|
+
"Thumbs.db",
|
|
34
|
+
// npm
|
|
35
|
+
".npmrc",
|
|
36
|
+
".npm",
|
|
37
|
+
// yarn
|
|
38
|
+
".yarnrc",
|
|
39
|
+
// Project config
|
|
40
|
+
"package.json",
|
|
41
|
+
]);
|
package/package.json
CHANGED