Skip to content

Commit

Permalink
Merge pull request #17 from triyanox/fix/remove-slashes-at-end
Browse files Browse the repository at this point in the history
Fix/remove slashes at end
  • Loading branch information
triyanox authored Mar 27, 2024
2 parents 07db107 + c3b8892 commit aacb7bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @triyanox/next-routes

## 0.1.5

### Patch Changes

- Remove slashes at the end of the path

## 0.1.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@triyanox/next-routes",
"description": "You will never have broken links in your Next.js app again",
"version": "0.1.4",
"version": "0.1.5",
"publishConfig": {
"access": "public"
},
Expand Down
6 changes: 5 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ const generateRoutes = async (appDir: string): Promise<IRoute[]> => {
...route,
path: cleanPath(route.path, appDir),
}))
.filter((route) => route.path !== '');
.filter((route) => route.path !== '')
.map((route) => ({
...route,
path: route.path === '/' ? route.path : route.path.replace(/\/$/, ''),
}));

routes_generated.push({
path: '/',
Expand Down

0 comments on commit aacb7bc

Please sign in to comment.