-
-
Notifications
You must be signed in to change notification settings - Fork 79
Create @fedify/nextjs
to integrate with Next.js
#355
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
Conversation
`fedifyRequestHanlder` -> `fedifyRequestHandler`
Because `.pnpm-store/` breaks down at every execution of `pnpm install`.
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.
Summary of Changes
Hello @2chanhaeng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
I've introduced a new @fedify/nextjs package to seamlessly integrate Fedify with Next.js applications. This change also updates the CLI's init command, allowing users to easily scaffold new Fedify projects with Next.js as their chosen web framework, significantly improving the developer experience for building federated applications on Next.js.
Highlights
- New @fedify/nextjs Package: I've created a dedicated @fedify/nextjs package, providing core utilities like fedifyWith for Next.js middleware and integrateFederation for handling federation requests, enabling Fedify to run within Next.js environments.
- Enhanced CLI init Command: The fedify cli init command now supports Next.js, allowing users to generate a new project with a pre-configured Next.js setup, including necessary dependencies and a middleware.ts template for Fedify integration.
- Project Configuration Updates: I've updated the .gitignore to include .pnpm-store/ and adjusted pnpm-lock.yaml and pnpm-workspace.yaml to incorporate the new @fedify/nextjs package and its dependencies, ensuring proper project setup and dependency management.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces a new package, @fedify/nextjs
, to integrate Fedify with Next.js. It also adds a Next.js option to the cli init
command for easy project scaffolding. The changes look good overall, but I've found a few issues. There's a type issue with a default function parameter in the new Next.js package that could lead to runtime errors. The CLI template for Next.js is missing an important import, which would cause an error for users. I've also pointed out some redundant code in the CLI configuration for consistency. My review includes suggestions to fix these issues.
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.
You should mention that the Fedify–Next.js integration requires Next.js 15.5 or higher.
fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment)
fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment)
fedify-dev#355 (comment) If you need it, you can use this instead of `fedifyWith`: ```ts // middleware.ts import { hasFederationAcceptHeader, integrateFederation } from "@fedify/next"; import { getXForwardedRequest } from "x-forwarded-fetch"; export default function middleware(request: Request) { if(hasFederationAcceptHeader(request) { integrateFederation(getXForwardedRequest(request)) } } ```
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.
The docs for this pull request have been published: |
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.
Looks good in general. Just left few comments, which are all trivial.
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.
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.
It's really the last one!
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.
👍
The latest push to this pull request has been published to JSR and npm as a pre-release:
|
fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment)
fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment) Rename `@fedify/nextjs` to `@fedify/next` fedify-dev#355 (comment)
fedify-dev#355 (comment) If you need it, you can use this instead of `fedifyWith`: ```ts // middleware.ts import { hasFederationAcceptHeader, integrateFederation } from "@fedify/next"; import { getXForwardedRequest } from "x-forwarded-fetch"; export default function middleware(request: Request) { if(hasFederationAcceptHeader(request) { integrateFederation(getXForwardedRequest(request)) } } ```
Summary
Create
@fedify/nextjs
to integrate with Next.js and add Next.js option forcli init
Related Issue
@fedify/next
. #356Changes
pacakges/nextjs
.cli init
.examples/next15-app-router
.Benefits
Now users can conveniently use Next.js and Fedify together more easier.
Checklist
Did you write a regression test to reproduce the bug (if it's a bug fix)?Not a bug fix.For the test, deployment is required.(I think)
deno task test-all
on your machine?Additional Notes
A subissue needs to fix Next.js example #356