Skip to content

Commit

Permalink
Merge pull request #11 from aspida/develop
Browse files Browse the repository at this point in the history
chore(release): 0.9.4
  • Loading branch information
solufa authored Dec 25, 2020
2 parents 05c988e + ac822d4 commit c5ab60c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.9.4](https://github.com/aspida/pathpida/compare/v0.9.3...v0.9.4) (2020-12-25)


### Bug Fixes

* type of slugs of nextjs ([a3cf164](https://github.com/aspida/pathpida/commit/a3cf164f6bd2a34d43e0e4a54ec5ac9808b1f755))

### [0.9.3](https://github.com/aspida/pathpida/compare/v0.9.2...v0.9.3) (2020-12-25)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pathpida",
"version": "0.9.3",
"version": "0.9.4",
"description": "TypeScript friendly pages path generator for Next.js and Nuxt.js",
"author": "Solufa <solufa2020@gmail.com>",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions projects/nextjs/lib/$path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ export const pagesPath = {
$url: (url?: { query?: OptionalQuery1, hash?: string }) => ({ pathname: '/[pid]' as const, query: { pid, ...url?.query }, hash: url?.hash })
}),
aaa: {
_bbb: (bbb: (string | number)[]) => ({
_bbb: (bbb: string[]) => ({
ccc: {
$url: (url?: { hash?: string }) => ({ pathname: '/aaa/[...bbb]/ccc' as const, query: { bbb }, hash: url?.hash })
}
})
},
blog: {
_slug: (slug: (string | number)[]) => ({
_slug: (slug: string[]) => ({
$url: (url: { query: Query2, hash?: string }) => ({ pathname: '/blog/[...slug]' as const, query: { slug, ...url.query }, hash: url.hash })
}),
hoge: {
_fuga: (fuga?: (string | number)[]) => ({
_fuga: (fuga?: string[]) => ({
$url: (url?: { hash?: string }) => ({ pathname: '/blog/hoge/[[...fuga]]' as const, query: { fuga }, hash: url?.hash })
})
}
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion projects/nuxtjs-no-slash/plugins/$path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const pagesPath = {
_bbb: (bbb: string | number) => ({
ccc: {
$url: (url?: { hash?: string }) => ({ path: `/aaa/${bbb}/ccc`, hash: url?.hash })
}
},
$url: (url?: { hash?: string }) => ({ path: `/aaa/${bbb}`, hash: url?.hash })
})
},
blog: {
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion projects/nuxtjs/plugins/$path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const pagesPath = {
_bbb: (bbb: string | number) => ({
ccc: {
$url: (url?: { hash?: string }) => ({ path: `/aaa/${bbb}/ccc/`, hash: url?.hash })
}
},
$url: (url?: { hash?: string }) => ({ path: `/aaa/${bbb}/`, hash: url?.hash })
})
},
blog: {
Expand Down
2 changes: 1 addition & 1 deletion src/createNextTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default (input: string) => {
if (basename.startsWith('[') && basename.endsWith(']')) {
const slug = basename.replace(/[.[\]]/g, '')
valFn = `${indent}${`_${slug}`}: (${slug}${basename.startsWith('[[') ? '?' : ''}: ${
/\[\./.test(basename) ? '(string | number)[]' : 'string | number'
/\[\./.test(basename) ? 'string[]' : 'string | number'
}) => ({\n<% next %>\n${indent}})`
newSlugs.push(slug)
}
Expand Down

0 comments on commit c5ab60c

Please sign in to comment.