qleaner 1.0.3 → 1.0.5
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 +8 -2
- package/command.js +15 -10
- package/package.json +1 -1
- package/src/3.png +0 -0
- package/src/4.png +0 -0
- package/src/demo/demo.tsx +7 -0
- package/src/demo/functions.js +18 -0
- package/src/hello.find.tsx +0 -0
- package/src/jambo.tsx +12 -0
- package/src/main.js +5 -0
- package/src/one.png +0 -0
- package/src/poa.tsx +10 -0
- package/src/style.css +7 -0
- package/src/style.scss +3 -0
- package/src/two.png +0 -0
package/bin/cli.js
CHANGED
|
@@ -12,8 +12,14 @@ program
|
|
|
12
12
|
program
|
|
13
13
|
.command("qlean")
|
|
14
14
|
.description("List all the imports in the project")
|
|
15
|
-
.
|
|
16
|
-
|
|
15
|
+
.argument("<path>", "The path to the directory to scan for imports")
|
|
16
|
+
.option("-l, --list-files", "List all the files in the project")
|
|
17
|
+
.option("-i, --list-imports", "List all the imports in the project")
|
|
18
|
+
.action(async (path, options) => {
|
|
19
|
+
console.log('path', path);
|
|
20
|
+
console.log('options', options);
|
|
21
|
+
const imports = await getFiles(path, options);
|
|
17
22
|
});
|
|
18
23
|
|
|
24
|
+
|
|
19
25
|
program.parse(process.argv);
|
package/command.js
CHANGED
|
@@ -4,8 +4,8 @@ const parser = require("@babel/parser");
|
|
|
4
4
|
const traverse = require("@babel/traverse").default;
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
module.exports = async function getFiles() {
|
|
8
|
-
const files = await fg([
|
|
7
|
+
module.exports = async function getFiles(directory = "src", options) {
|
|
8
|
+
const files = await fg([`${directory}/**/*.{tsx,ts,js,jsx}`]);
|
|
9
9
|
const imports = [];
|
|
10
10
|
for (const file of files) {
|
|
11
11
|
const code = fs.readFileSync(file, "utf8");
|
|
@@ -42,12 +42,17 @@ module.exports = async function getFiles() {
|
|
|
42
42
|
// });
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
if (options.listFiles) {
|
|
46
|
+
console.log('***************** Files *****************');
|
|
47
|
+
files.forEach((file) => {
|
|
48
|
+
console.log(file);
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
if (options.listImports) {
|
|
52
|
+
console.log('***************** Imports *****************');
|
|
53
|
+
imports.forEach((importStatement) => {
|
|
54
|
+
console.log(`${importStatement.file}:${importStatement.line}:${importStatement.column} ${importStatement.from}`);
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
}
|
package/package.json
CHANGED
package/src/3.png
ADDED
|
Binary file
|
package/src/4.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
package/src/jambo.tsx
ADDED
package/src/main.js
ADDED
package/src/one.png
ADDED
|
Binary file
|
package/src/poa.tsx
ADDED
package/src/style.css
ADDED
package/src/style.scss
ADDED
package/src/two.png
ADDED
|
Binary file
|