qleaner 1.0.2 → 1.0.4

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.
Binary file
package/bin/cli.js CHANGED
@@ -1,14 +1,22 @@
1
1
  #!/usr/bin/env node
2
- const {Command} = require('commander');
3
- const getFiles = require('../command');
2
+ const { Command } = require("commander");
3
+ const getFiles = require("../command");
4
4
 
5
5
  const program = new Command();
6
6
 
7
- program.name('qleaner').description('A tool to clean up your React code').version('1.0.0');
7
+ program
8
+ .name("qleaner")
9
+ .description("A tool to clean up your React code")
10
+ .version("1.0.0");
8
11
 
9
- program.command('qlean').description('List all the imports in the project').action(async () => {
10
- const imports = await getFiles();
11
- console.log(imports);
12
- });
12
+ program
13
+ .command("qlean")
14
+ .description("List all the imports in the project")
15
+ .argument("<path>", "The path to the directory to scan for imports")
16
+ .action(async (path) => {
17
+ console.log(path);
18
+ const imports = await getFiles(path);
19
+ });
13
20
 
14
- program.parse(process.argv);
21
+
22
+ 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(["app/**/*.{tsx,ts,js,jsx}"]);
7
+ module.exports = async function getFiles(directory = "src") {
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");
@@ -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);
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.2",
4
+ "version": "1.0.4",
5
5
  "main": "command.js",
6
6
  "bin": "./bin/cli.js",
7
7
  "scripts": {
package/src/3.png ADDED
Binary file
package/src/4.png ADDED
Binary file
@@ -0,0 +1,7 @@
1
+ export default function Demo() {
2
+ return (
3
+ <div>
4
+ <img src="/one.png" />
5
+ </div>
6
+ )
7
+ }
@@ -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
@@ -0,0 +1,12 @@
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
+ }
package/src/main.js ADDED
@@ -0,0 +1,5 @@
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'
package/src/one.png ADDED
Binary file
package/src/poa.tsx ADDED
@@ -0,0 +1,10 @@
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 ADDED
@@ -0,0 +1,7 @@
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 ADDED
@@ -0,0 +1,3 @@
1
+ .body {
2
+ background-image: url('4.png');
3
+ }
package/src/two.png ADDED
Binary file