progga 1.0.5 → 1.0.6
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/index.js +35 -9
- package/package.json +1 -1
- package/profiles/ProjectProfile.js +14 -2
package/index.js
CHANGED
|
@@ -12,6 +12,10 @@ const ProjectTypeDetector = require('./core/ProjectTypeDetector');
|
|
|
12
12
|
const PresetSelector = require('./core/PresetSelector');
|
|
13
13
|
const Spinner = require('./core/Spinner');
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
const CLI_IGNORE_PATHS = new Set();
|
|
17
|
+
const CLI_IGNORE_EXTENSIONS = new Set();
|
|
18
|
+
|
|
15
19
|
/**
|
|
16
20
|
* Check if path should be ignored
|
|
17
21
|
*/
|
|
@@ -20,13 +24,19 @@ function shouldIgnore(filePath, basePath, profile) {
|
|
|
20
24
|
const parts = relativePath.split(path.sep);
|
|
21
25
|
|
|
22
26
|
for (const part of parts) {
|
|
23
|
-
if (
|
|
27
|
+
if (
|
|
28
|
+
profile.ignorePaths().includes(part) ||
|
|
29
|
+
CLI_IGNORE_PATHS.has(part)
|
|
30
|
+
) {
|
|
24
31
|
return true;
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
const ext = path.extname(filePath);
|
|
29
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
profile.ignoreExtensions().includes(ext) ||
|
|
38
|
+
CLI_IGNORE_EXTENSIONS.has(ext)
|
|
39
|
+
) {
|
|
30
40
|
return true;
|
|
31
41
|
}
|
|
32
42
|
|
|
@@ -301,6 +311,7 @@ function generateDocumentation(projectPath, outputFile, profile) {
|
|
|
301
311
|
|
|
302
312
|
// Main execution
|
|
303
313
|
async function main() {
|
|
314
|
+
let cliIgnores = [];
|
|
304
315
|
const args = process.argv.slice(2);
|
|
305
316
|
|
|
306
317
|
let projectPath = '.';
|
|
@@ -310,13 +321,22 @@ async function main() {
|
|
|
310
321
|
for (let i = 0; i < args.length; i++) {
|
|
311
322
|
const arg = args[i];
|
|
312
323
|
|
|
313
|
-
if (arg === '--
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
324
|
+
if (arg === '--ignore' || arg === '-i') {
|
|
325
|
+
const value = args[i + 1];
|
|
326
|
+
if (value) {
|
|
327
|
+
value
|
|
328
|
+
.split(',')
|
|
329
|
+
.map(v => v.trim())
|
|
330
|
+
.filter(Boolean)
|
|
331
|
+
.forEach(item => {
|
|
332
|
+
if (item.startsWith('.')) {
|
|
333
|
+
CLI_IGNORE_EXTENSIONS.add(item);
|
|
334
|
+
} else {
|
|
335
|
+
CLI_IGNORE_PATHS.add(item);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
i++;
|
|
339
|
+
}
|
|
320
340
|
}
|
|
321
341
|
}
|
|
322
342
|
|
|
@@ -342,8 +362,14 @@ async function main() {
|
|
|
342
362
|
profile = ProfileRegistry.fallback(projectPath);
|
|
343
363
|
}
|
|
344
364
|
|
|
365
|
+
if (cliIgnores.length) {
|
|
366
|
+
profile.applyCliIgnores(cliIgnores);
|
|
367
|
+
console.log(`🚫 CLI ignores applied: ${cliIgnores.join(', ')}`);
|
|
368
|
+
}
|
|
369
|
+
|
|
345
370
|
console.log(`Using profile: ${profile.name}`);
|
|
346
371
|
generateDocumentation(projectPath, outputFile, profile);
|
|
372
|
+
|
|
347
373
|
}
|
|
348
374
|
|
|
349
375
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
class ProjectProfile {
|
|
2
2
|
constructor(projectRoot) {
|
|
3
3
|
this.projectRoot = projectRoot;
|
|
4
|
+
this.cliIgnorePaths = [];
|
|
5
|
+
this.cliIgnoreExtensions = [];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
applyCliIgnores(list) {
|
|
9
|
+
for (const item of list) {
|
|
10
|
+
if (item.startsWith('.')) {
|
|
11
|
+
this.cliIgnoreExtensions.push(item);
|
|
12
|
+
} else {
|
|
13
|
+
this.cliIgnorePaths.push(item);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
4
16
|
}
|
|
5
17
|
|
|
6
18
|
get name() {
|
|
@@ -9,12 +21,12 @@ class ProjectProfile {
|
|
|
9
21
|
|
|
10
22
|
/** Paths to fully ignore */
|
|
11
23
|
ignorePaths() {
|
|
12
|
-
return
|
|
24
|
+
return this.cliIgnorePaths;
|
|
13
25
|
}
|
|
14
26
|
|
|
15
27
|
/** Extensions to ignore */
|
|
16
28
|
ignoreExtensions() {
|
|
17
|
-
return
|
|
29
|
+
return this.cliIgnoreExtensions;
|
|
18
30
|
}
|
|
19
31
|
|
|
20
32
|
/** Binary extensions */
|