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 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
- unusedFiles.push(file);
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qleaner",
3
3
  "packageManager": "yarn@4.6.0",
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
5
5
  "main": "command.js",
6
6
  "bin": "./bin/cli.js",
7
7
  "scripts": {
package/src/3.png DELETED
Binary file
package/src/4.png DELETED
Binary file
@@ -1 +0,0 @@
1
- import main from '../../main';
File without changes
package/src/demo/demo.tsx DELETED
@@ -1,9 +0,0 @@
1
- import hello from '../hello.find';
2
- import hidden from '../../../demo/book/hidden'
3
- export default function Demo() {
4
- return (
5
- <div>
6
- <img src="/one.png" />
7
- </div>
8
- )
9
- }
@@ -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
- }
File without changes
@@ -1,2 +0,0 @@
1
- import name from './demo/functions';
2
- import hidden from '~/demo/book/hidden'
package/src/jambo.tsx DELETED
@@ -1,12 +0,0 @@
1
- import * as functions from './demo/functions';
2
- import hello from 'hello.find';
3
- export const JAMBO_JET = 'poa'
4
-
5
- export function JamboJet() {
6
- return (
7
- <div>
8
- <img src={one} />
9
- <img src={'3.png'} />
10
- </div>
11
- )
12
- }
@@ -1 +0,0 @@
1
- import hidden from '../../demo/book/hidden'
package/src/main.js DELETED
@@ -1,6 +0,0 @@
1
- import jambo from 'jambo'
2
- import poa from 'poa'
3
- import './style.css'
4
- import demo from './demo/demo'
5
- import { JamboJet } from './jambo'
6
- import hidden from '@/demo/book/hidden'
package/src/notused.tsx DELETED
File without changes
package/src/one.png DELETED
Binary file
package/src/poa.tsx DELETED
@@ -1,10 +0,0 @@
1
- import one from 'one.png'
2
- export default function poa() {
3
- console.log('poa')
4
- return (
5
- <div>
6
- <img src={one} />
7
- <img src={'3.png'} />
8
- </div>
9
- )
10
- }
package/src/style.css DELETED
@@ -1,7 +0,0 @@
1
- .name {
2
- background-image: url('one.png') no-repeat;
3
- }
4
-
5
- .user {
6
- background-image: url('two.png');
7
- }
package/src/style.scss DELETED
@@ -1,3 +0,0 @@
1
- .body {
2
- background-image: url('4.png');
3
- }
package/src/two.png DELETED
Binary file