Skip to content

Amended changes from #7452 #11897

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

Closed
wants to merge 9 commits into from
Closed

Conversation

elken
Copy link

@elken elken commented Jul 4, 2019

  • Removed VueDevelopmentServer
  • Added Dictionary for arguments to DevelopmentServer
  • Unobseleted ReactDevelopmentServer

RE: "over-specialised" APIs, I agree with the idea that the ready signal might not be static text, but I think digging into that rabbit hole could lead to any number of implementations and all major frameworks do indeed return static text on success.

WilliamABradley and others added 6 commits February 11, 2019 22:41
…dleware, obsoleted old namespace, Added Generic UseDevelopmentServer and Vue UseVueDevelopmentServer.
- Removed VueDevelopmentServer
- Added Dictionary for arguments to DevelopmentServer
- Unobseleted ReactDevelopmentServer
@dnfclas
Copy link

dnfclas commented Jul 4, 2019

CLA assistant check
All CLA requirements met.

};
var npmScriptRunner = new NpmScriptRunner(
sourcePath, npmScriptName, null, envVars);
sourcePath, npmScriptName, null, envVars.Union(extraArgs));
Copy link
Author

Choose a reason for hiding this comment

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

I'm aware this will cause a NullReference. I'll setup a local build env and possibly add some tests.

@analogrelay analogrelay removed their request for review July 5, 2019 15:35
@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates and removed area-blazor Includes: Blazor, Razor Components labels Jul 8, 2019
@mkArtakMSFT
Copy link
Member

Thanks for your effort, @elken.
Seems like you have some merge conflicts. Can you please resolve those, while we're looking into this?

@elken
Copy link
Author

elken commented Jul 8, 2019 via email

@elken
Copy link
Author

elken commented Jul 9, 2019

I've attempted to fix said conflicts in 32321bb

{
internal static class ReactDevelopmentServerMiddleware
internal static class DevelopmentServerMiddleware
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the file path and filename should be updated to match this.

string npmScriptName,
string waitText,
Dictionary<string, string> extraArgs,
string serverName = "App")
Copy link
Member

Choose a reason for hiding this comment

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

Does there have to be a default value for this parameter? It would be clearer to make it mandatory if that's possible.


var envVars = new Dictionary<string, string>
{
{ "PORT", portNumber.ToString() },
{ "BROWSER", "none" }, // We don't want create-react-app to open its own extra browser window pointing to the internal dev server port
{ "PORT", portNumber.ToString() }
Copy link
Member

Choose a reason for hiding this comment

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

It's problematic to assume that all SPA development servers would use an environment variable to configure this, or that they would be looking for an environment variable with this particular name.

};

waitText = waitText.Replace("$PORT", portNumber.ToString());
Copy link
Member

@SteveSandersonMS SteveSandersonMS Jul 24, 2019

Choose a reason for hiding this comment

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

Having a special custom syntax to define the message as a function of the port number is very nonstandard and makes me think we should reconsider this layering.

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Jul 24, 2019

Thanks for submitting this update.

Based on this, my preference would be not to have an API at this level of abstraction, because it's simultaneously quite coupled to assumptions around React dev server (e.g., how the port is specified), while also not being coupled enough to safely hardcode this knowledge like ReactDevelopmentServerMiddleware did before. I particularly don't like declaring a custom syntax for defining the "wait until" message, as that's totally outside typical ASP.NET Core API patterns.

I think it would be better to publish this as a separate package, not as part of ASP.NET Core itself. That would allow much more flexibility to make whatever assumptions you want, and to change (with breaking changes) any time you need based on changes in the 3rd-party SPA frameworks and their associated tooling.

Sorry that's an annoying thing to hear after you've been working on this! I definitely appreciate your efforts to contribute this, and how you've amended the PR following feedback. I hope it makes sense that we're trying to pick only APIs that can be supported in the long term and don't create exposure to significant risks that they cease to be supportable due to changes we can't control.

cc @danroth27 for any further thoughts on this.

@elken
Copy link
Author

elken commented Jul 24, 2019

Understand the thought behind, I have been rolling my own impl similar to the deployed one for a few of our internal packages so I'll roll that up into a nuget package tmrw.

The thought process behind the custom syntax for $PORT was my own solution to that problem, as the particular stack we use (NextJS) reads the port via cmd line flags passed to the npm/yarn task, and is also included in the "waiting" output.

Feel free to close this, #8024 and #7452

@SteveSandersonMS
Copy link
Member

Thanks @elken!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants