Skip to content

Commit

Permalink
fix: catch-all directory base name (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jozefhruska authored Dec 4, 2022
1 parent 2a29cc8 commit 9949ffe
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utilities/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const buildRouteTree = (
);
}

const baseName = parse(path).name;
const baseName = parse(path).base;

// Check if the current folder is an auxiliary (helper)
// Used to check for excluded files/folders (i.e. _document.*)
Expand Down
Empty file.
10 changes: 10 additions & 0 deletions tests/1/out/routeBuilder.expected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export type RouteBuilder = {
getPath: () => string;
},
},
uploads: {
rest: {
getPath: (rest: string[]) => string;
},
},
},
};

Expand All @@ -37,5 +42,10 @@ export const routeBuilder: RouteBuilder = {
getPath: () => `/dashboard/settings/profile`,
},
},
uploads: {
rest: {
getPath: (rest) => `/dashboard/uploads/${rest.join('/')}`,
},
},
},
};
Empty file.
10 changes: 10 additions & 0 deletions tests/2/out/routeBuilder.expected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export type RouteBuilder = {
getPath: (slug: string) => string;
},
},
test: {
rest: {
getPath: (rest: string[]) => string;
},
},
};

export const routeBuilder: RouteBuilder = {
Expand All @@ -34,4 +39,9 @@ export const routeBuilder: RouteBuilder = {
getPath: (slug) => `/services/${slug}`,
},
},
test: {
rest: {
getPath: (rest) => `/test/${rest.join('/')}`,
},
},
};
Empty file.
Empty file.
20 changes: 20 additions & 0 deletions tests/3/out/routeBuilder.expected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export type RouteBuilder = {
getPath: () => string;
},
},
uploads: {
rest: {
getPath: (rest: string[]) => string;
},
},
},
getPath: () => string;
contactUs: {
Expand All @@ -33,6 +38,11 @@ export type RouteBuilder = {
getPath: (slug: string) => string;
},
},
test: {
rest: {
getPath: (rest: string[]) => string;
},
},
};

export const routeBuilder: RouteBuilder = {
Expand All @@ -53,6 +63,11 @@ export const routeBuilder: RouteBuilder = {
getPath: () => `/dashboard/settings/profile`,
},
},
uploads: {
rest: {
getPath: (rest) => `/dashboard/uploads/${rest.join('/')}`,
},
},
},
getPath: () => `/`,
contactUs: {
Expand All @@ -70,4 +85,9 @@ export const routeBuilder: RouteBuilder = {
getPath: (slug) => `/services/${slug}`,
},
},
test: {
rest: {
getPath: (rest) => `/test/${rest.join('/')}`,
},
},
};

0 comments on commit 9949ffe

Please sign in to comment.