-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable output directory #35
base: main
Are you sure you want to change the base?
Conversation
make destination configurable
@ckastbjerg not sure how we should make automated tests for this but it does work on my computer. |
@@ -1,6 +1,9 @@ | |||
{ | |||
"compilerOptions": { | |||
"declaration": true, | |||
"strict": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tightened up the typings while i was at it
@@ -72,6 +72,30 @@ Now you just need to decide how you want to integrate `next-type-safe-routes` in | |||
|
|||
<img src="./example.gif" /> | |||
|
|||
## Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are these docs @ckastbjerg ?
@ckastbjerg would love a peek at this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@osdiab thanks so much for picking this up! Looks great. I left a few minor suggestions around naming but nothing blocking at all.
Also, I'm really sorry for letting you hang!!! 🙏 For personal reasons, I had to take a break from this project among other things. I should be more available in the future. But I want to make sure that I'm not a bottleneck here. So will prioritise getting releases more automated soon.
const withPlugins = require("next-compose-plugins"); | ||
const nextTypeSafePages = require("next-type-safe-routes/plugin"); | ||
|
||
module.exports = withPlugins([nextTypeSafePages], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested this out in the example project, but it only worked for me with:
module.exports = withPlugins([nextTypeSafeRoutes], {
nextTypeSafeRoutes: { outDir: "@types/custom-page-type-directory" },
});
Is this the intended interface? Or am I misunderstanding something?
Note, I haven't looked into the "correct" way of allowing options for plugins...
|
||
```js | ||
const withPlugins = require("next-compose-plugins"); | ||
const nextTypeSafePages = require("next-type-safe-routes/plugin"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking this should be
const nextTypeSafePages = require("next-type-safe-routes/plugin"); | |
const nextTypeSafeRoutes = require("next-type-safe-routes/plugin"); |
const withPlugins = require("next-compose-plugins"); | ||
const nextTypeSafePages = require("next-type-safe-routes/plugin"); | ||
|
||
module.exports = withPlugins([nextTypeSafePages], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module.exports = withPlugins([nextTypeSafePages], { | |
module.exports = withPlugins([nextTypeSafeRoutes], { |
const writeTypesToDisc = ({ pagesDir, outDir: inputOutDir }: PathConfig) => { | ||
const typeScriptFile = generateTypeScriptFile(pagesDir); | ||
const srcDir = path.dirname(pagesDir); | ||
const outDir = path.isAbsolute(inputOutDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit pick! Just ignore if you disagree :)
I got a bit confused a bout the re-mapping of outDir
to inputOutDir
. Makes the code a bit hard to read IMO. How about naming this outDirAbsolute
instead?
Yeah, good question. Maybe we could look how some of the more mature Next.js plugins does it. But guessing it's not too common to test this aspect of it. |
Supercedes #33
Closes #32
Worked locally on my project.