MCPcopy
hub / github.com/npmx-dev/npmx.dev / getVueFiles

Function getVueFiles

test/unit/a11y-component-coverage.spec.ts:71–86  ·  view source on GitHub ↗

* Recursively get all Vue component files in a directory.

(dir: string, baseDir: string = dir)

Source from the content-addressed store, hash-verified

69 * Recursively get all Vue component files in a directory.
70 */
71function getVueFiles(dir: string, baseDir: string = dir): string[] {
72 const files: string[] = []
73 const entries = fs.readdirSync(dir, { withFileTypes: true })
74
75 for (const entry of entries) {
76 const fullPath = path.join(dir, entry.name)
77 if (entry.isDirectory()) {
78 files.push(...getVueFiles(fullPath, baseDir))
79 } else if (entry.isFile() && entry.name.endsWith('.vue')) {
80 // Get relative path from base components directory
81 files.push(normalizeComponentPath(path.relative(baseDir, fullPath)))
82 }
83 }
84
85 return files
86}
87
88/**
89 * Parse .nuxt/components.d.ts to get the mapping from component names to file paths.

Callers 1

Calls 1

normalizeComponentPathFunction · 0.85

Tested by

no test coverage detected