feat(serve): implement open default browser option for ng serve#2489
Closed
dzonatan wants to merge 2 commits intoangular:masterfrom
Closed
feat(serve): implement open default browser option for ng serve#2489dzonatan wants to merge 2 commits intoangular:masterfrom
dzonatan wants to merge 2 commits intoangular:masterfrom
Conversation
graingert
suggested changes
Oct 6, 2016
| reject(err.details); | ||
| } else { | ||
| if(commandOptions.open) { | ||
| opn(`http://${commandOptions.host}:${commandOptions.port}/`); |
Contributor
There was a problem hiding this comment.
import url from 'url';
...
const { open, host, port } = commandOptions;
if (open) {
opn(url.format({ protocol: 'http', hostname: host, port }));
}
Contributor
Author
There was a problem hiding this comment.
Are there any pros of that url formatter?
I was trying to make it same as webpack dev server binary do.
Contributor
There was a problem hiding this comment.
It's built in and escapes funky stuff like ipv6 addresses properly
bdede2b to
b38438f
Compare
filipesilva
suggested changes
Oct 9, 2016
| name: 'open', | ||
| description: 'Opens the url in default browser', | ||
| type: Boolean, | ||
| default: false |
Contributor
There was a problem hiding this comment.
Can you add the o alias?
aliases: ['o']
Contributor
|
This is nice, thanks! I added the request for an alias, I think it would help. People could then do |
b38438f to
51ffdf0
Compare
filipesilva
approved these changes
Oct 10, 2016
graingert
approved these changes
Oct 10, 2016
| } else { | ||
| const { open, host, port } = commandOptions; | ||
| if (open) { | ||
| opn(url.format({ protocol: 'http', hostname: host, port: port.toString() })); |
Contributor
|
Thank you! |
JJayet
pushed a commit
to JJayet/angular-cli
that referenced
this pull request
Oct 14, 2016
texel
pushed a commit
to splice/angular-cli
that referenced
this pull request
Nov 3, 2016
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Sometimes it's really handy to have auto browser opening when serving app.
This PR implements that by
--openoption forng servecommand.Closes #1081