File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -15,25 +15,21 @@ const createLoader = () => {
15
15
/**
16
16
* Loads API Doc files and transforms it into VFiles
17
17
*
18
- * @param {string } path A glob/path for API docs to be loaded
18
+ * @param {string } searchPath A glob/path for API docs to be loaded
19
19
* The input string can be a simple path (relative or absolute)
20
20
* The input string can also be any allowed glob string
21
21
*
22
22
* @see https://code.visualstudio.com/docs/editor/glob-patterns
23
23
*/
24
- const loadFiles = path => {
25
- const resolvedFiles = globSync ( path ) ;
24
+ const loadFiles = searchPath => {
25
+ const resolvedFiles = globSync ( searchPath ) . filter (
26
+ filePath => extname ( filePath ) === '.md'
27
+ ) ;
26
28
27
29
return resolvedFiles . map ( async filePath => {
28
- const fileExtension = extname ( filePath ) ;
30
+ const fileBuffer = await readFile ( filePath ) ;
29
31
30
- if ( fileExtension === '.md' ) {
31
- const fileBuffer = await readFile ( filePath ) ;
32
-
33
- return new VFile ( { path : filePath , value : fileBuffer } ) ;
34
- }
35
-
36
- throw new Error ( `File ${ filePath } is not a Markdown file` ) ;
32
+ return new VFile ( { path : filePath , value : fileBuffer } ) ;
37
33
} ) ;
38
34
} ;
39
35
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ const createMetadata = slugger => {
33
33
} ,
34
34
/**
35
35
* Set the Metadata (from YAML if exists) properties to the current Metadata entry
36
- * itI also allows for extra data (such as Stability Index) and miscellaneous data to be set
36
+ * it also allows for extra data (such as Stability Index) and miscellaneous data to be set
37
37
* although it'd be best to only set ones from {ApiDocRawMetadataEntry}
38
38
*
39
39
* @param {Partial<import('./types.d.ts').ApiDocRawMetadataEntry> } properties Extra Metadata properties to be defined
You can’t perform that action at this time.
0 commit comments