-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: experimental typescript-nextjs template #152
Draft
mnahkies
wants to merge
14
commits into
main
Choose a base branch
from
mn/feat/typescript-nextjs
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mnahkies
force-pushed
the
mn/feat/typescript-nextjs
branch
from
April 20, 2024 10:16
7403f4f
to
12c684f
Compare
mnahkies
force-pushed
the
mn/feat/typescript-nextjs
branch
from
April 21, 2024 07:34
12c684f
to
d0be6c4
Compare
mnahkies
force-pushed
the
mn/feat/typescript-nextjs
branch
from
April 27, 2024 08:12
54335e8
to
3033f06
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Creates a new
typescript-nextjs
template./src/generated
containing the types and validation boilerplateApproach
Due to the NextJS file based routing paradigm I couldn't see anyway to avoid manipulating files that will contain manually written code.
Pending Refactoring
Currently there is a lot of duplicated code between this and the
typescript-koa
template which needs rationalizing, as well as it depending on thetypescript-koa-runtime
package. Part of the motivation behind this is to have more than one server template to allow it to become more generic like the client templates.Because of the
typescript-koa-runtime
hack, to actually use this in a NextJS application you need to add the following to yournext.config.mjs
:I also don't love the explosion of files this creates when running the standard set of integration suites, and might limit the scope down to one spec to reduce the noise. Ideally I'd like to separate the integration tests to their own repo and also start testing more permutations of options (eg:
joi
,extract-inline-schemas
).Additionally to make multiple suites play nicely I've had to fudge the output paths in the tests, technically producing incorrect routes.
Performance
I've been told that
ts-morph
can be relatively slow, so it's probably useful to check the performance between this andtypescript-koa
Overall it looks similar, aside from calculation of the dependency graph. I'm not sure if this is the bug in the timing code, or if the larger number of compilation units is somehow causing this. Warrants some investigation in case we're calculating it repeatedly or something.
typescript-nextjs - api.github.com.yaml
typescript-koa - api.github.com.yaml