Skip to content

Commit fe5d7f9

Browse files
committed
fix: ignore OSX meta file .DS_Store
1 parent 80acc86 commit fe5d7f9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/utils/dev.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { getLocalDatabase } from './database'
1818
import { generateCollectionInsert } from './collection'
1919
import { createParser } from './content'
2020
import { moduleTemplates } from './templates'
21-
import { parseSourceBase } from './source'
21+
import { getExcludedSourcePaths, parseSourceBase } from './source'
2222

2323
export const logger: ConsolaInstance = useLogger('@nuxt/content')
2424

@@ -116,7 +116,7 @@ export async function watchContents(nuxt: Nuxt, options: ModuleOptions, manifest
116116
return micromatch.isMatch(
117117
path.substring(cwd.length),
118118
'**',
119-
{ ignore: source!.exclude || [], dot: true },
119+
{ ignore: getExcludedSourcePaths(source), dot: true },
120120
)
121121
}
122122

src/utils/source.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import type { CollectionSource, ResolvedCollectionSource } from '../types/collec
66
import { downloadRepository, parseBitBucketUrl, parseGitHubUrl } from './git'
77
import { logger } from './dev'
88

9+
export function getExcludedSourcePaths(source: CollectionSource) {
10+
return [
11+
...(source!.exclude || []),
12+
// Ignore OS files
13+
'.DS_Store'
14+
]
15+
}
16+
917
export function defineLocalSource(source: CollectionSource | ResolvedCollectionSource): ResolvedCollectionSource {
1018
if (source.include.startsWith('./') || source.include.startsWith('../')) {
1119
logger.warn('Collection source should not start with `./` or `../`.')
@@ -21,7 +29,7 @@ export function defineLocalSource(source: CollectionSource | ResolvedCollectionS
2129
: join(rootDir, 'content')
2230
},
2331
getKeys: async () => {
24-
const _keys = await glob(source.include, { cwd: resolvedSource.cwd, ignore: source!.exclude || [], dot: true, expandDirectories: false })
32+
const _keys = await glob(source.include, { cwd: resolvedSource.cwd, ignore: getExcludedSourcePaths(source), dot: true, expandDirectories: false })
2533
.catch((): [] => [])
2634
return _keys.map(key => key.substring(fixed.length))
2735
},

0 commit comments

Comments
 (0)