-
Notifications
You must be signed in to change notification settings - Fork 337
Add the ability to preview without opening the browser #816
Conversation
src/commands/publish/preview/mod.rs
Outdated
@@ -34,6 +34,7 @@ pub fn preview( | |||
body: Option<String>, | |||
livereload: bool, | |||
verbose: bool, | |||
browser: bool, |
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 flag is "terminal" but this attribute says browser... might be more maintainable if they are aligned- what do you think?
i sorta think that it might be nice to have the flag be browser instead of terminal... backwards compat has us a bit stuck though. gonna think on this- but would love to hear your thoughts!
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.
My preference would be that the default opens the browser and that the flag is browser. The reason I implemented it this way is because of the way things are today. That being said, I don't think we really need to worry too much about backwards compatibility wrt preview, but I could be wrong. As for the reason the flag is terminal and the preview function takes browser - it makes more sense semantically (to me) to test for browser == true
than for terminal == false
when trying to open the browser.
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.
should it be configurable via another method as well? there's the whole idea that if there's a flag for it, there should be a config setting for it, or that it should accept an environment variable.
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.
also, perhaps it isn't a no arg flag, but a bool value flag, like --browser=true
, with a default?
We've had a bunch of discussion around this that I will attempt to summarize here. This feature is largely temporary until we deprecate responses being shown in the terminal for
@ashleymichal proposed changing the flag to My favorite proposal is @xtuc's @ashleymichal proposed that we also introduce a field in the manifest in addition to an environment variable to configure the default behavior so people can simply We'd also like to get this in for the release candidate today. TL;DR: I want to just change this PR from |
at the risk of sounding a bit rude, after all this time of this being a problem, why introduce a stop gap we intend to almost immediately deprecate, when we are actively working on the full-featured command that will replace it and the work is slated to complete this quarter? |
i'm in favor of if we made it configurable it should be a global config not a per project config, and we dont have that beyond auth yet so i dont want to rush into introducing it |
@ashleymichal I think that's a reasonable ask - and is why I'm opposed to introducing manifest changes. I think that this is a small enough change that will alleviate some pain for devs (including our CI running wrangler tests) until we get wrangler curl out. I also think we'll want to keep |
250deca
to
f2cf57d
Compare
does this imply that will we maintain long term support for this feature? |
f2cf57d
to
9106cf8
Compare
I think so |
Fixes #256
This PR adds
wrangler preview --headless
which does not open the browser for preview requests. The tests forwrangler preview
now use this flag.