jstar-reviewer 2.4.1 → 2.4.2
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/jstar.js +1 -1
- package/dist/scripts/detective.js +7 -3
- package/package.json +1 -1
- package/scripts/detective.ts +10 -3
package/bin/jstar.js
CHANGED
|
@@ -68,9 +68,10 @@ const FILE_RULES = [
|
|
|
68
68
|
}
|
|
69
69
|
];
|
|
70
70
|
class Detective {
|
|
71
|
-
constructor(directory) {
|
|
71
|
+
constructor(directory, options = {}) {
|
|
72
72
|
this.directory = directory;
|
|
73
73
|
this.violations = [];
|
|
74
|
+
this.includeBuildFiles = options.includeBuildFiles ?? false;
|
|
74
75
|
}
|
|
75
76
|
async scan() {
|
|
76
77
|
this.walk(this.directory);
|
|
@@ -85,7 +86,8 @@ class Detective {
|
|
|
85
86
|
const stat = fs.statSync(filePath);
|
|
86
87
|
if (stat.isDirectory()) {
|
|
87
88
|
// Ignore common build/config directories
|
|
88
|
-
|
|
89
|
+
const ignoredDirs = ['node_modules', '.git', '.jstar', 'dist', 'coverage', '.next'];
|
|
90
|
+
if (!this.includeBuildFiles && ignoredDirs.includes(file)) {
|
|
89
91
|
continue;
|
|
90
92
|
}
|
|
91
93
|
this.walk(filePath);
|
|
@@ -156,8 +158,10 @@ class Detective {
|
|
|
156
158
|
exports.Detective = Detective;
|
|
157
159
|
// CLI Integration
|
|
158
160
|
if (require.main === module) {
|
|
161
|
+
const args = process.argv.slice(2);
|
|
162
|
+
const includeBuildFiles = args.includes('--all');
|
|
159
163
|
// Scan current directory by default
|
|
160
|
-
const detective = new Detective(process.cwd());
|
|
164
|
+
const detective = new Detective(process.cwd(), { includeBuildFiles });
|
|
161
165
|
detective.scan();
|
|
162
166
|
detective.report();
|
|
163
167
|
}
|
package/package.json
CHANGED
package/scripts/detective.ts
CHANGED
|
@@ -50,8 +50,11 @@ const FILE_RULES: Rule[] = [
|
|
|
50
50
|
|
|
51
51
|
export class Detective {
|
|
52
52
|
violations: Violation[] = [];
|
|
53
|
+
private includeBuildFiles: boolean;
|
|
53
54
|
|
|
54
|
-
constructor(private directory: string
|
|
55
|
+
constructor(private directory: string, options: { includeBuildFiles?: boolean } = {}) {
|
|
56
|
+
this.includeBuildFiles = options.includeBuildFiles ?? false;
|
|
57
|
+
}
|
|
55
58
|
|
|
56
59
|
async scan(): Promise<Violation[]> {
|
|
57
60
|
this.walk(this.directory);
|
|
@@ -67,7 +70,8 @@ export class Detective {
|
|
|
67
70
|
|
|
68
71
|
if (stat.isDirectory()) {
|
|
69
72
|
// Ignore common build/config directories
|
|
70
|
-
|
|
73
|
+
const ignoredDirs = ['node_modules', '.git', '.jstar', 'dist', 'coverage', '.next'];
|
|
74
|
+
if (!this.includeBuildFiles && ignoredDirs.includes(file)) {
|
|
71
75
|
continue;
|
|
72
76
|
}
|
|
73
77
|
this.walk(filePath);
|
|
@@ -142,8 +146,11 @@ export class Detective {
|
|
|
142
146
|
|
|
143
147
|
// CLI Integration
|
|
144
148
|
if (require.main === module) {
|
|
149
|
+
const args = process.argv.slice(2);
|
|
150
|
+
const includeBuildFiles = args.includes('--all');
|
|
151
|
+
|
|
145
152
|
// Scan current directory by default
|
|
146
|
-
const detective = new Detective(process.cwd());
|
|
153
|
+
const detective = new Detective(process.cwd(), { includeBuildFiles });
|
|
147
154
|
detective.scan();
|
|
148
155
|
detective.report();
|
|
149
156
|
}
|