Skip to content
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

[PFX-547]: Option for next custom server/fastify/express in presets #785

Closed
wants to merge 22 commits into from

Conversation

bbetts-godaddy
Copy link
Contributor

@bbetts-godaddy bbetts-godaddy commented Jun 11, 2024

Summary

This PR allows for users to select which server type they would like to use with a preset. The options include fastify, express and Custom Next Server.

Ticket: PFX-547

Changelog

  • Add prompt for server type to @gasket/preset-api and @gasket/preset-nextjs

Test Plan

Screenshot 2024-06-11 at 10 42 21 AM

@bbetts-godaddy bbetts-godaddy requested a review from a team as a code owner June 11, 2024 17:42
@bbetts-godaddy bbetts-godaddy marked this pull request as draft June 11, 2024 23:31
@bbetts-godaddy bbetts-godaddy marked this pull request as ready for review June 18, 2024 19:59
@@ -1,3 +1,96 @@
function prompts(context, prompt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were the Nextjs prompts moved to the preset-prompt? Would this lead to code duplication in the webapp preset and any other preset in the future that uses the next plugin.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were moved because there was duplication. They should be removed from the plugin itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpina1-godaddy not sure if you saw this!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where was the duplication? Weren't these only called in the nextjs plugin?

If we want to use some of these prompts for the webapp preset, for example the promptAppRouter prompt, wouldn't we have to copy and paste this promptAppRouter prompt code from here into the webapp preset instead of sharing the code between the two presets if it was located in the nextjs plugin?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this change doesn't seem correct.

The general rule should be:

  • Preset prompts present choices of which plugins to use.
  • Plugin prompts present choices of which features to use.

If my present includes the a plugin, I expect that plugin to ask about what features to set up.
If I want to give my users options between different plugins, then I add that choice as a prompt to my preset. After that, if there are any feature choices, the plugin should ask about it.

So, unless I'm missing or overlooking something here, these Next.js prompts should remain in the Next.js plugin.

Copy link
Contributor

@agerard-godaddy agerard-godaddy Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it might be an ordering issue?

  1. Preset prompts fire
  2. Next.js Plugin asks if you want Custom Server
  3. If you do, then the Preset can no longer ask if you want Express or Fastify for the Custom Server

Is that the scenario here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a team chat, this is going to be explored further to define a good pattern moving forward. Approving for now to unblock.

@agerard-godaddy
Copy link
Contributor

Closing in favor of #811

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants