1170 lines are from pnpm-lock - don't get scared 😅
Added pageExtensions CLI flag, which allows to extend file extensions that are matched as a page. This works for both app and pages directories. For example, running next-typesafe-url --pageExtensions tsx,ts,js,jsx,mdx will include default page extensions AND mdx pages, if you have set it up. I currently have project which uses MDX pages, and it's very inconvenient when this lib doesn't generate paths to those pages. I decided to not read the pageExtensions parameter from next.config.js, since it adds a bit too much complexity for my liking into the CLI. Also, if next.config.js is stored in weird location, we'd need to match it. I think for now, separate flag it good enough.
Adding pageExtensions also makes it possible to use CLI with .js pages.
Added .tsx extension support for routeType file. Now both ts and tsx are matched.
Updated appdir example, to have .js and .mdx pages, to test the pageExtensions flag.
Fixed CLI help outputPath description typo.
Changed multi-parameter functions to use option-bag pattern. Let me know if you want me to change it back, but I think it's way better for DX, since you always know what you're passing into a function. Also it's easier to have optional parameters, and to be able to re-order parameters when calling a function.
Fixed build error in the app/transform/routeType.ts schema. It fails on initial clone of the project 🤷♀️
Closes #101
[x] (if ready to be merged) Yes I have made a changeset
This PR:
pageExtensions
CLI flag, which allows to extend file extensions that are matched as a page. This works for bothapp
andpages
directories. For example, runningnext-typesafe-url --pageExtensions tsx,ts,js,jsx,mdx
will include default page extensions AND mdx pages, if you have set it up. I currently have project which uses MDX pages, and it's very inconvenient when this lib doesn't generate paths to those pages. I decided to not read thepageExtensions
parameter fromnext.config.js
, since it adds a bit too much complexity for my liking into the CLI. Also, ifnext.config.js
is stored in weird location, we'd need to match it. I think for now, separate flag it good enough.pageExtensions
also makes it possible to use CLI with.js
pages..tsx
extension support forrouteType
file. Now bothts
andtsx
are matched.appdir
example, to have.js
and.mdx
pages, to test thepageExtensions
flag.outputPath
description typo.app/transform/routeType.ts
schema. It fails on initial clone of the project 🤷♀️Closes #101