Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/fs/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function searchComponents(ctx: Context) {
const root = ctx.root

const files = fg.sync(ctx.options.globs, {
ignore: ['node_modules'],
ignore: ctx.options.ignore,
onlyFiles: true,
cwd: root,
absolute: true,
Expand Down
3 changes: 3 additions & 0 deletions src/core/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const defaultOptions: Omit<Required<Options>, 'include' | 'exclude' | 'tr
deep: true,
dts: isPackageExists('typescript'),

ignore: ['node_modules'],

directoryAsNamespace: false,
collapseSamePrefixes: false,
globalNamespaces: [],
Expand All @@ -29,6 +31,7 @@ export function resolveOptions(options: Options, root: string): ResolvedOptions
const resolved = Object.assign({}, defaultOptions, options) as ResolvedOptions
resolved.resolvers = normalizeResolvers(resolved.resolvers)
resolved.extensions = toArray(resolved.extensions)
resolved.ignore = toArray(resolved.ignore).map((i: string) => slash(resolve(root, i)))

if (resolved.globs) {
resolved.globs = toArray(resolved.globs).map((glob: string) => slash(resolve(root, glob)))
Expand Down
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ export interface Options {
*/
globs?: string | string[]

/**
* An array of glob patterns to exclude matches, This is an alternative way to use negative patterns.
* @default ['node_modules']
*/
ignore?: string[]
Comment thread
lishaobos marked this conversation as resolved.
Outdated

/**
* Search for subdirectories
* @default true
Expand Down