Skip to content

Commit

Permalink
fix(routes-gen): fixed dash delimiters in routes generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sandulat committed Apr 6, 2022
1 parent ab5c7d1 commit ecbbe1b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions packages/routes-gen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# routes-gen

## 0.3.2

### Patch Changes

- Fixed dash delimiters in routes generation.

## 0.3.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/routes-gen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "routes-gen",
"version": "0.3.1",
"version": "0.3.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/routes-gen/src/export-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const extractPathParams = (path: Route["path"]) =>
? path
.split("/")
.filter((item) => item.includes(":"))
.map((item) => `${item.split(".")[0].substring(1)}`)
.map((item) => item.split(".")[0].split("-")[0].substring(1))
: [];

export const exportRoutes = ({
Expand All @@ -34,7 +34,7 @@ export const exportRoutes = ({

return ` "${route.path}": ${
params.length > 0
? `{ ${params.map((path) => `${path}: string`).join(", ")} }`
? `{ ${params.map((path) => `"${path}": string`).join(", ")} }`
: "{}"
};`;
})
Expand Down

0 comments on commit ecbbe1b

Please sign in to comment.