- Notifications
You must be signed in to change notification settings - Fork4.7k
feat: support https in vuepress log output (fix #2357 #2358)#2750
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
morphatic wants to merge2 commits intovuejs:masterChoose a base branch frommorphatic:feat/support-https-in-vuepress-log
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+4 −3
Conversation
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
Add a property `isHttps` to the options passed to the `DevLogPlugin` used with the `vuepress-log` plugin. The value of this property is determined based on the existence and value of the `devServer.https` property which in turn is part of the `webpack-dev-server` instance used by Vuepress for running a Vuepress site in development mode
Originally, the `displayUrl` output in log messages was hard-coded to be `http`. Now it is set to `https` if the `isHttps` value passed in via `options` is truthy.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
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.
Summary
Make the URL displayed in output logged by the dev server accurately reflects whether the dev server is running in HTTPS mode or not.
Explanation/Justification
This is mostly a cosmetic/convenience change. Previously, when running the dev server (
yarn docs:dev
ornpm run docs:dev
), the console would output messages like:VuePress dev server listening at http://docs.example.test:8080/
success [16:27:43] Build b6b75d finished in 111 ms! ( http://docs.example.test:8080/ )
Many editors (e.g. VSCode) allow the developer to hover over that URL and open up the link in a web browser. The problem was that the
http://
part of the URLs displayed here were hard-coded. Since it is relatively easy to run the local dev server using SSL, and this is desirable for making the dev environment match the deployment environment as closely as possible, it would be nice if the URLs logged to the console accurately reflected this. Running locally in SSL mode is also a good way to be able to test the PWA functions of your Vuepress site before deployment (although I haven't tested this).To set up SSL for the local dev server:
hosts
file to add a custom domain at which to test, e.g.docs.example.test
.Using a*.test
TLD is recommended for local testing (and may be required to get this to work in some browsers?).mkcert
is a nice tool for this. By runningmkcert docs.example.test
in the root of the Vuepress project, the cert and key pem files will be generated and registered to be trusted by your local machine..vuepress/config.js
accordingly (NOTE: update the path to the certs according to your project structure):With this PR, once you've added SSL to your dev server in this way, the URL logged to the console will look something like
https://docs.example.test:8080
.What kind of change does this PR introduce? (check at least one)
If changing the UI of default theme, please provide thebefore/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
If adding anew feature, the PR's description includes:
No unit tests were added, but I did run the tests after making the change to make sure it didn't break anything.
Other information:
#2357 and#2358 would be addressed by this.