devbonzai 2.2.3 → 2.2.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devbonzai",
3
- "version": "2.2.3",
3
+ "version": "2.2.21",
4
4
  "description": "Quickly set up a local file server in any repository for browser-based file access",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -11,9 +11,11 @@ module.exports = async function scanCodeQuality(req, res) {
11
11
  projectPath,
12
12
  maxFileLines = 500,
13
13
  maxFolderFiles = 20,
14
- checkUnusedImports = true,
15
- checkDeadCode = true,
16
- checkCircularDeps = false
14
+ willEnforceLines = true,
15
+ willEnforceFolders = true,
16
+ willFlagUnusedImports = true,
17
+ willFlagDeadCode = true,
18
+ willFlagCircularDeps = false
17
19
  } = req.body;
18
20
 
19
21
  if (!projectPath) {
@@ -23,7 +25,7 @@ module.exports = async function scanCodeQuality(req, res) {
23
25
  const ignorePatterns = getIgnorePatterns();
24
26
  const issues = [];
25
27
 
26
- // 1. Check file sizes
28
+ // Get all files (needed for multiple checks)
27
29
  const allFiles = glob.sync('**/*.{js,ts,jsx,tsx,py,java,go}', {
28
30
  cwd: projectPath,
29
31
  nodir: true
@@ -31,48 +33,53 @@ module.exports = async function scanCodeQuality(req, res) {
31
33
 
32
34
  const files = allFiles.filter(file => !shouldIgnore(file, ignorePatterns));
33
35
 
34
- files.forEach(file => {
35
- const fullPath = path.join(projectPath, file);
36
- const content = fs.readFileSync(fullPath, 'utf8');
37
- const lines = content.split('\n').length;
38
-
39
- if (lines > maxFileLines) {
40
- issues.push({
41
- type: 'large_file',
42
- file: file,
43
- lines: lines,
44
- limit: maxFileLines
45
- });
46
- }
47
- });
36
+ // 1. Check file sizes
37
+ if (willEnforceLines) {
38
+ files.forEach(file => {
39
+ const fullPath = path.join(projectPath, file);
40
+ const content = fs.readFileSync(fullPath, 'utf8');
41
+ const lines = content.split('\n').length;
42
+
43
+ if (lines > maxFileLines) {
44
+ issues.push({
45
+ type: 'large_file',
46
+ file: file,
47
+ lines: lines,
48
+ limit: maxFileLines
49
+ });
50
+ }
51
+ });
52
+ }
48
53
 
49
54
  // 2. Check folder sizes
50
- const allFolders = glob.sync('**/', {
51
- cwd: projectPath
52
- });
53
-
54
- const folders = allFolders.filter(folder => !shouldIgnore(folder, ignorePatterns));
55
-
56
- folders.forEach(folder => {
57
- const fullPath = path.join(projectPath, folder);
58
- const contents = fs.readdirSync(fullPath);
59
- const fileCount = contents.filter(item => {
60
- const itemPath = path.join(fullPath, item);
61
- return fs.statSync(itemPath).isFile();
62
- }).length;
55
+ if (willEnforceFolders) {
56
+ const allFolders = glob.sync('**/', {
57
+ cwd: projectPath
58
+ });
63
59
 
64
- if (fileCount > maxFolderFiles) {
65
- issues.push({
66
- type: 'crowded_folder',
67
- folder: folder,
68
- count: fileCount,
69
- limit: maxFolderFiles
70
- });
71
- }
72
- });
60
+ const folders = allFolders.filter(folder => !shouldIgnore(folder, ignorePatterns));
61
+
62
+ folders.forEach(folder => {
63
+ const fullPath = path.join(projectPath, folder);
64
+ const contents = fs.readdirSync(fullPath);
65
+ const fileCount = contents.filter(item => {
66
+ const itemPath = path.join(fullPath, item);
67
+ return fs.statSync(itemPath).isFile();
68
+ }).length;
69
+
70
+ if (fileCount > maxFolderFiles) {
71
+ issues.push({
72
+ type: 'crowded_folder',
73
+ folder: folder,
74
+ count: fileCount,
75
+ limit: maxFolderFiles
76
+ });
77
+ }
78
+ });
79
+ }
73
80
 
74
81
  // 3. Check unused imports and dead code with ESLint
75
- if (checkUnusedImports || checkDeadCode) {
82
+ if (willFlagUnusedImports || willFlagDeadCode) {
76
83
  try {
77
84
  const eslint = new ESLint({
78
85
  cwd: projectPath,
@@ -89,8 +96,8 @@ module.exports = async function scanCodeQuality(req, res) {
89
96
  ecmaFeatures: { jsx: true }
90
97
  },
91
98
  rules: {
92
- 'no-unused-vars': checkDeadCode ? 'error' : 'off',
93
- '@typescript-eslint/no-unused-vars': checkDeadCode ? 'error' : 'off'
99
+ 'no-unused-vars': willFlagDeadCode ? 'error' : 'off',
100
+ '@typescript-eslint/no-unused-vars': willFlagDeadCode ? 'error' : 'off'
94
101
  }
95
102
  }
96
103
  });
@@ -120,7 +127,7 @@ module.exports = async function scanCodeQuality(req, res) {
120
127
  }
121
128
 
122
129
  // 4. Check circular dependencies
123
- if (checkCircularDeps) {
130
+ if (willFlagCircularDeps) {
124
131
  try {
125
132
  const result = await madge(projectPath, {
126
133
  fileExtensions: ['js', 'jsx', 'ts', 'tsx'],