doclify-guardrail 1.1.0 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doclify-guardrail",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "description": "Quality gate for your Markdown docs. Zero dependencies, catches errors in seconds.",
6
6
  "files": [
package/src/glob.mjs CHANGED
@@ -1,6 +1,31 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
 
4
+ const IGNORED_DIRS = new Set([
5
+ 'node_modules',
6
+ '.git',
7
+ 'Pods',
8
+ '.symlinks',
9
+ '.plugin_symlinks',
10
+ '.dart_tool',
11
+ 'vendor',
12
+ 'build',
13
+ 'dist',
14
+ '.next',
15
+ '.nuxt',
16
+ 'coverage',
17
+ '.cache',
18
+ '__pycache__',
19
+ '.venv',
20
+ 'venv',
21
+ 'ephemeral'
22
+ ]);
23
+
24
+ function isIgnoredPath(filePath) {
25
+ const parts = filePath.split(path.sep);
26
+ return parts.some(p => IGNORED_DIRS.has(p));
27
+ }
28
+
4
29
  /**
5
30
  * Find all .md files recursively in a directory.
6
31
  */
@@ -9,7 +34,8 @@ function findMarkdownFiles(dirPath) {
9
34
  const entries = fs.readdirSync(resolved, { recursive: true, withFileTypes: true });
10
35
  return entries
11
36
  .filter(e => e.isFile() && e.name.endsWith('.md'))
12
- .map(e => path.join(e.parentPath || e.path, e.name));
37
+ .map(e => path.join(e.parentPath || e.path, e.name))
38
+ .filter(f => !isIgnoredPath(path.relative(resolved, f)));
13
39
  }
14
40
 
15
41
  /**
@@ -63,7 +89,8 @@ function miniGlob(pattern, basePath) {
63
89
 
64
90
  return entries
65
91
  .filter(e => e.isFile() && fileRx.test(e.name))
66
- .map(e => path.join(e.parentPath || e.path, e.name));
92
+ .map(e => path.join(e.parentPath || e.path, e.name))
93
+ .filter(f => !isIgnoredPath(path.relative(searchDir, f)));
67
94
  }
68
95
 
69
96
  /**
package/src/index.mjs CHANGED
@@ -419,7 +419,8 @@ async function runCli(argv = process.argv.slice(2)) {
419
419
  console.error('');
420
420
 
421
421
  for (const filePath of filePaths) {
422
- const shortPath = path.relative(process.cwd(), filePath) || filePath;
422
+ const rel = path.relative(process.cwd(), filePath);
423
+ const shortPath = rel.startsWith('..') ? filePath : rel || filePath;
423
424
  log(c.cyan('ℹ'), `Checking ${c.bold(shortPath)}...`);
424
425
 
425
426
  try {