qleaner 1.0.2 → 1.0.3
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/.yarn/install-state.gz +0 -0
- package/bin/cli.js +12 -7
- package/command.js +1 -3
- package/package.json +1 -1
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/bin/cli.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const {Command} = require(
|
|
3
|
-
const getFiles = require(
|
|
2
|
+
const { Command } = require("commander");
|
|
3
|
+
const getFiles = require("../command");
|
|
4
4
|
|
|
5
5
|
const program = new Command();
|
|
6
6
|
|
|
7
|
-
program
|
|
7
|
+
program
|
|
8
|
+
.name("qleaner")
|
|
9
|
+
.description("A tool to clean up your React code")
|
|
10
|
+
.version("1.0.0");
|
|
8
11
|
|
|
9
|
-
program
|
|
12
|
+
program
|
|
13
|
+
.command("qlean")
|
|
14
|
+
.description("List all the imports in the project")
|
|
15
|
+
.action(async () => {
|
|
10
16
|
const imports = await getFiles();
|
|
11
|
-
|
|
12
|
-
});
|
|
17
|
+
});
|
|
13
18
|
|
|
14
|
-
program.parse(process.argv);
|
|
19
|
+
program.parse(process.argv);
|
package/command.js
CHANGED
|
@@ -5,7 +5,7 @@ const traverse = require("@babel/traverse").default;
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
module.exports = async function getFiles() {
|
|
8
|
-
const files = await fg(["
|
|
8
|
+
const files = await fg(["src/**/*.{tsx,ts,js,jsx}"]);
|
|
9
9
|
const imports = [];
|
|
10
10
|
for (const file of files) {
|
|
11
11
|
const code = fs.readFileSync(file, "utf8");
|
|
@@ -24,12 +24,10 @@ module.exports = async function getFiles() {
|
|
|
24
24
|
file: file,
|
|
25
25
|
line: node.loc.start.line,
|
|
26
26
|
column: node.loc.start.column,
|
|
27
|
-
|
|
28
27
|
});
|
|
29
28
|
},
|
|
30
29
|
|
|
31
30
|
});
|
|
32
|
-
|
|
33
31
|
// ExportNamedDeclaration: ({ node }) => {
|
|
34
32
|
// if (node.declaration.declarations && node.declaration.declarations[0].id && node.declaration.declarations[0].id.name) {
|
|
35
33
|
// exports.push(node.declaration.declarations[0].id.name);
|