qleaner 1.0.8 → 1.0.9
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/cli.js +2 -0
- package/command.js +11 -1
- package/package.json +1 -1
- package/src/3.png +0 -0
- package/src/4.png +0 -0
- package/src/demo/book/hidden.tsx +0 -1
- package/src/demo/book/public.tsx +0 -0
- package/src/demo/demo.tsx +0 -9
- package/src/demo/functions.js +0 -18
- package/src/demo/public.tsx +0 -0
- package/src/hello.find.tsx +0 -2
- package/src/jambo.tsx +0 -12
- package/src/layer/shell/shell.tsx +0 -1
- package/src/main.js +0 -6
- package/src/notused.tsx +0 -0
- package/src/one.png +0 -0
- package/src/poa.tsx +0 -10
- package/src/style.css +0 -7
- package/src/style.scss +0 -3
- package/src/two.png +0 -0
package/bin/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ program
|
|
|
17
17
|
.option("-i, --list-imports", "List all the imports in the project")
|
|
18
18
|
.option("-e, --exclude-dir <dir...>", "Exclude directories from the scan")
|
|
19
19
|
.option("-f, --exclude-file <file...>", "Exclude files from the scan")
|
|
20
|
+
.option("-F, --exclude-file-print <file...>", "Do not Print the excluded files")
|
|
20
21
|
.action(async (path, options) => {
|
|
21
22
|
const imports = await getFiles(path, options);
|
|
22
23
|
});
|
|
@@ -26,6 +27,7 @@ program
|
|
|
26
27
|
.argument("<path>", "The path to the directory to scan for unused files")
|
|
27
28
|
.option("-e, --exclude-dir <dir...>", "Exclude directories from the scan")
|
|
28
29
|
.option("-f, --exclude-file <file...>", "Exclude files from the scan")
|
|
30
|
+
.option("-F, --exclude-file-print <files...>", "Do not Print the excluded files")
|
|
29
31
|
.action(async (path, options) => {
|
|
30
32
|
const unusedFiles = await unUsedFiles(path, options);
|
|
31
33
|
// console.clear()
|
package/command.js
CHANGED
|
@@ -113,7 +113,13 @@ async function unUsedFiles(directory = "src", options) {
|
|
|
113
113
|
isFound = true;
|
|
114
114
|
break;
|
|
115
115
|
}else if(i === imports.length - 1) {
|
|
116
|
-
|
|
116
|
+
if(options.excludeFilePrint && options.excludeFilePrint.length > 0) {
|
|
117
|
+
if(!isExcludedFile(file, options.excludeFilePrint)){
|
|
118
|
+
unusedFiles.push(file);
|
|
119
|
+
}
|
|
120
|
+
}else {
|
|
121
|
+
unusedFiles.push(file);
|
|
122
|
+
}
|
|
117
123
|
break;
|
|
118
124
|
}
|
|
119
125
|
i++;
|
|
@@ -122,6 +128,10 @@ async function unUsedFiles(directory = "src", options) {
|
|
|
122
128
|
return unusedFiles;
|
|
123
129
|
}
|
|
124
130
|
|
|
131
|
+
function isExcludedFile(file, excludeFiles) {
|
|
132
|
+
return excludeFiles.some(exclude => file.includes(exclude));
|
|
133
|
+
}
|
|
134
|
+
|
|
125
135
|
function compareFiles(filePath, importPath) {
|
|
126
136
|
const importNoExt = importPath.replace(/\.[^/.]+$/, "");
|
|
127
137
|
const prefixImportPath = importNoExt.replace(/^(?:\.{1,2}\/|[@~]+\/)+/, "");
|
package/package.json
CHANGED
package/src/3.png
DELETED
|
Binary file
|
package/src/4.png
DELETED
|
Binary file
|
package/src/demo/book/hidden.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import main from '../../main';
|
package/src/demo/book/public.tsx
DELETED
|
File without changes
|
package/src/demo/demo.tsx
DELETED
package/src/demo/functions.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function demoFunction() {
|
|
2
|
-
return 'demoFunction';
|
|
3
|
-
}
|
|
4
|
-
export function demoFunction2() {
|
|
5
|
-
return 'demoFunction2';
|
|
6
|
-
}
|
|
7
|
-
export function demoFunction3() {
|
|
8
|
-
return 'demoFunction3';
|
|
9
|
-
}
|
|
10
|
-
export function demoFunction4() {
|
|
11
|
-
return 'demoFunction4';
|
|
12
|
-
}
|
|
13
|
-
export function demoFunction5() {
|
|
14
|
-
return 'demoFunction5';
|
|
15
|
-
}
|
|
16
|
-
export function demoFunction6() {
|
|
17
|
-
return 'demoFunction6';
|
|
18
|
-
}
|
package/src/demo/public.tsx
DELETED
|
File without changes
|
package/src/hello.find.tsx
DELETED
package/src/jambo.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import hidden from '../../demo/book/hidden'
|
package/src/main.js
DELETED
package/src/notused.tsx
DELETED
|
File without changes
|
package/src/one.png
DELETED
|
Binary file
|
package/src/poa.tsx
DELETED
package/src/style.css
DELETED
package/src/style.scss
DELETED
package/src/two.png
DELETED
|
Binary file
|