diff --git a/src/core/scope/children/from-globs.ts b/src/core/scope/children/from-globs.ts index b9ef96d..0ba1e4d 100644 --- a/src/core/scope/children/from-globs.ts +++ b/src/core/scope/children/from-globs.ts @@ -23,10 +23,7 @@ export default async function getChildrenFromGlobs( const children = filter(dirs).map((dir) => ({ name: path.parse(dir).name, // absolute path - directory: path.join(directory, dir), - matcher(name: string) { - return dir.includes(name); - } + directory: path.join(directory, dir) })); // Check for name conflicts diff --git a/src/core/scope/children/from-map.ts b/src/core/scope/children/from-map.ts index 2bad157..aca0302 100644 --- a/src/core/scope/children/from-map.ts +++ b/src/core/scope/children/from-map.ts @@ -8,9 +8,6 @@ export default function getChildrenFromMap( ): IChild[] { return Object.entries(map).map(([key, value]) => ({ name: key, - directory: absolute({ path: value, cwd: directory }), - matcher(name: string): boolean { - return name === key; - } + directory: absolute({ path: value, cwd: directory }) })); } diff --git a/src/core/scope/set.ts b/src/core/scope/set.ts index 547b632..f2457c4 100644 --- a/src/core/scope/set.ts +++ b/src/core/scope/set.ts @@ -23,7 +23,7 @@ export default async function setScope( // child scopes const matches = children - .filter((child) => child.matcher(name)) + .filter((child) => child.name.includes(name)) .map((child) => child.directory); if (matches.length) { diff --git a/src/core/types.ts b/src/core/types.ts index 171c2ec..e3e54ce 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -19,7 +19,6 @@ export interface IScope { export interface IChild { name: string; directory: string; - matcher: (scope: string) => boolean; } export interface ITask { diff --git a/src/public/exec/stream.ts b/src/public/exec/stream.ts index 0ae1d49..2d3bb15 100644 --- a/src/public/exec/stream.ts +++ b/src/public/exec/stream.ts @@ -98,7 +98,7 @@ function stream( /** @hidden */ function getChild(name: string, children: IChild[]): IChild { - const matches = children.filter((child) => child.matcher(name)); + const matches = children.filter((child) => child.name.includes(name)); if (matches.length > 1) throw Error(`Several scopes matched name "${name}"`); if (matches.length < 1) throw Error(`Scope "${name}" not found`); return matches[0];