devbonzai 2.2.3 → 2.2.201

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.201",
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,56 +25,76 @@ module.exports = async function scanCodeQuality(req, res) {
23
25
  const ignorePatterns = getIgnorePatterns();
24
26
  const issues = [];
25
27
 
26
- // 1. Check file sizes
28
+ // Common build/output directories to always ignore
29
+ const defaultIgnoreGlobs = [
30
+ '**/node_modules/**',
31
+ '**/dist/**',
32
+ '**/build/**',
33
+ '**/static/**',
34
+ '**/out/**',
35
+ '**/.next/**',
36
+ '**/*.min.js',
37
+ '**/*.bundle.js',
38
+ '**/*.chunk.js'
39
+ ];
40
+
41
+ // Get all files (needed for multiple checks)
27
42
  const allFiles = glob.sync('**/*.{js,ts,jsx,tsx,py,java,go}', {
28
43
  cwd: projectPath,
29
- nodir: true
44
+ nodir: true,
45
+ ignore: defaultIgnoreGlobs
30
46
  });
31
47
 
32
48
  const files = allFiles.filter(file => !shouldIgnore(file, ignorePatterns));
33
49
 
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
- });
50
+ // 1. Check file sizes
51
+ if (willEnforceLines) {
52
+ files.forEach(file => {
53
+ const fullPath = path.join(projectPath, file);
54
+ const content = fs.readFileSync(fullPath, 'utf8');
55
+ const lines = content.split('\n').length;
56
+
57
+ if (lines > maxFileLines) {
58
+ issues.push({
59
+ type: 'large_file',
60
+ file: file,
61
+ lines: lines,
62
+ limit: maxFileLines
63
+ });
64
+ }
65
+ });
66
+ }
48
67
 
49
68
  // 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;
69
+ if (willEnforceFolders) {
70
+ const allFolders = glob.sync('**/', {
71
+ cwd: projectPath,
72
+ ignore: defaultIgnoreGlobs
73
+ });
63
74
 
64
- if (fileCount > maxFolderFiles) {
65
- issues.push({
66
- type: 'crowded_folder',
67
- folder: folder,
68
- count: fileCount,
69
- limit: maxFolderFiles
70
- });
71
- }
72
- });
75
+ const folders = allFolders.filter(folder => !shouldIgnore(folder, ignorePatterns));
76
+
77
+ folders.forEach(folder => {
78
+ const fullPath = path.join(projectPath, folder);
79
+ const contents = fs.readdirSync(fullPath);
80
+ const fileCount = contents.filter(item => {
81
+ const itemPath = path.join(fullPath, item);
82
+ return fs.statSync(itemPath).isFile();
83
+ }).length;
84
+
85
+ if (fileCount > maxFolderFiles) {
86
+ issues.push({
87
+ type: 'crowded_folder',
88
+ folder: folder,
89
+ count: fileCount,
90
+ limit: maxFolderFiles
91
+ });
92
+ }
93
+ });
94
+ }
73
95
 
74
96
  // 3. Check unused imports and dead code with ESLint
75
- if (checkUnusedImports || checkDeadCode) {
97
+ if (willFlagUnusedImports || willFlagDeadCode) {
76
98
  try {
77
99
  const eslint = new ESLint({
78
100
  cwd: projectPath,
@@ -89,8 +111,7 @@ module.exports = async function scanCodeQuality(req, res) {
89
111
  ecmaFeatures: { jsx: true }
90
112
  },
91
113
  rules: {
92
- 'no-unused-vars': checkDeadCode ? 'error' : 'off',
93
- '@typescript-eslint/no-unused-vars': checkDeadCode ? 'error' : 'off'
114
+ 'no-unused-vars': willFlagDeadCode ? 'error' : 'off'
94
115
  }
95
116
  }
96
117
  });
@@ -102,7 +123,7 @@ module.exports = async function scanCodeQuality(req, res) {
102
123
  const relativePath = path.relative(projectPath, result.filePath);
103
124
 
104
125
  result.messages.forEach(msg => {
105
- if (msg.ruleId === 'no-unused-vars' || msg.ruleId === '@typescript-eslint/no-unused-vars') {
126
+ if (msg.ruleId === 'no-unused-vars') {
106
127
  issues.push({
107
128
  type: 'unused_variable',
108
129
  file: relativePath,
@@ -120,7 +141,7 @@ module.exports = async function scanCodeQuality(req, res) {
120
141
  }
121
142
 
122
143
  // 4. Check circular dependencies
123
- if (checkCircularDeps) {
144
+ if (willFlagCircularDeps) {
124
145
  try {
125
146
  const result = await madge(projectPath, {
126
147
  fileExtensions: ['js', 'jsx', 'ts', 'tsx'],