feat: support https in vuepress log output (fix #2357 #2358) #2750
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 the before/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 a new 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.