-
Notifications
You must be signed in to change notification settings - Fork 0
/
ignores.ts
30 lines (25 loc) · 833 Bytes
/
ignores.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { GLOB_IGNORES } from '../globs'
import { applyConfig, defineConfigs, isOptionEnabled, overrideConfigs } from '../utils'
import { gitignore } from './gitignore'
import type { GitIgnoreConfigOptions } from './gitignore'
export type IgnoresConfigOptions = {
gitignore?: boolean | GitIgnoreConfigOptions
}
export function ignores(options: IgnoresConfigOptions = {}) {
const { gitignore: gitignoreOptions = true } = options
const isGitignoreEnabled = isOptionEnabled(gitignoreOptions)
const gitignoreConfigs = applyConfig(gitignore, gitignoreOptions)
return defineConfigs([
{
name: 'base',
ignores: [...GLOB_IGNORES]
},
...isGitignoreEnabled
? overrideConfigs(gitignoreConfigs, {
base: {
name: 'gitignore'
}
}, 'gitignore')
: []
], 'ignores')
}