Skip to content

Commit

Permalink
fix: ignore pages/api on nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Dec 25, 2020
1 parent 1389268 commit 7cc612d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"dev": "run-p dev:*",
"dev:next": "next dev",
"dev:path": "pathpida --watch",
"build:path": "pathpida"
"build": "pathpida && next build"
}
}
```
Expand Down Expand Up @@ -174,7 +174,7 @@ export default () => {
"dev": "run-p dev:*",
"dev:next": "next dev",
"dev:path": "pathpida --enableStatic --watch",
"build:path": "pathpida --enableStatic"
"build": "pathpida --enableStatic && next build"
}
}
```
Expand Down Expand Up @@ -233,7 +233,7 @@ export default () => {
"dev": "run-p dev:*",
"dev:nuxt": "nuxt-ts",
"dev:path": "pathpida --watch",
"build:path": "pathpida"
"build": "pathpida && nuxt-ts build"
}
}
```
Expand Down Expand Up @@ -357,7 +357,7 @@ export default Vue.extend({
"dev": "run-p dev:*",
"dev:nuxt": "nuxt-ts",
"dev:path": "pathpida --enableStatic --watch",
"build:path": "pathpida --enableStatic"
"build": "pathpida --enableStatic && nuxt-ts build"
}
}
```
Expand Down
Empty file.
Empty file.
7 changes: 6 additions & 1 deletion projects/nextjs-src/src/utils/$path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export const pagesPath = {
ccc: {
$url: (url?: { hash?: string }) => ({ pathname: '/aaa/[...bbb]/ccc' as const, query: { bbb }, hash: url?.hash })
}
})
}),
api: {
samples: {
$url: (url?: { hash?: string }) => ({ pathname: '/aaa/api/samples' as const, hash: url?.hash })
}
}
},
blog: {
_slug: (slug: string[]) => ({
Expand Down
7 changes: 6 additions & 1 deletion projects/nextjs/lib/$path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export const pagesPath = {
ccc: {
$url: (url?: { hash?: string }) => ({ pathname: '/aaa/[...bbb]/ccc' as const, query: { bbb }, hash: url?.hash })
}
})
}),
api: {
samples: {
$url: (url?: { hash?: string }) => ({ pathname: '/aaa/api/samples' as const, hash: url?.hash })
}
}
},
blog: {
_slug: (slug: string[]) => ({
Expand Down
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion src/createNextTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default (input: string) => {
indent += ' '

fs.readdirSync(targetDir)
.filter(file => !file.startsWith('_'))
.filter(file => !file.startsWith('_') && `${url}/${file}` !== '/api')
.sort()
.forEach((file, _, arr) => {
const newSlugs = [...slugs]
Expand Down

0 comments on commit 7cc612d

Please sign in to comment.