Skip to content

Commit

Permalink
feat: adds optional name field to IChild
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 30, 2019
1 parent 895863c commit 6596a1e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/scope/children/from-globs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default async function getChildrenFromGlobs(

// filter and make into IChild
return filter(dirs).map((dir) => ({
name: path.parse(dir).name,
// absolute path
directory: path.join(directory, dir),
matcher(name: string) {
Expand Down
1 change: 1 addition & 0 deletions src/core/scope/children/from-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function getChildrenFromMap(
directory: string
): IChild[] {
return Object.entries(map).map(([key, value]) => ({
name: key,
directory: absolute({ path: value, cwd: directory }),
matcher(name: string): boolean {
return name === key;
Expand Down
1 change: 1 addition & 0 deletions src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface IScope {
}

export interface IChild {
name: string;
directory: string;
matcher: (scope: string) => boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion src/public/kpo/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function fromScopes(): Promise<string> {
const scopes = await core.children();

let rows = scopes.map((child) => [
path.parse(child.directory).name,
child.name,
path.relative(cwd, child.directory)
]);
if (root) {
Expand Down

0 comments on commit 6596a1e

Please sign in to comment.