1.2.0 • Published 7 months ago
next-routes-list v1.2.0
next-routes-list
Easy generate all available routes in Next.js .
Support
- App routes
- Page routes
Install
npm install --save-dev next-routes-list@latest
Usage
1. Run script
add script to package.json
:
{
"script": {
"generate-next-routes-list": "generate-next-routes-list"
}
}
If you use src
directory:
{
"script": {
"generate-next-routes-list": "cd src && npx generate-next-routes-list"
}
}
then run npm script:
npm run generate-next-routes-list
2. Import routes
import { routes } from "next-routes-list";
console.log(routes);
/**
[
'/',
'/about',
'/posts/[id]',
...
]
*/
Options
Option | Type | Description | Example |
---|---|---|---|
-o | string | set the output routes file path | npx generate-next-routes-list -o routes.ts |
Example
next projct is here, generate result is: here.
Contribute
feel free to contribute anything or report any issues.
1.2.0
7 months ago
1.2.0-alpha.0
7 months ago
1.1.3-alpha.1
11 months ago
1.1.1
11 months ago
1.0.2
1 year ago
1.1.0
1 year ago
1.0.1
1 year ago
1.1.3-alpha.3
11 months ago
1.1.3-alpha.2
11 months ago
1.1.5
11 months ago
1.1.4
11 months ago
1.1.3
11 months ago
1.1.2
11 months ago
1.1.3-alpha.4
11 months ago
1.0.0
1 year ago
0.0.1
1 year ago