-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Deploying | ||
|
||
The following guides are based on some shared assumptions: | ||
|
||
- You are placing your docs inside the `docs` directory of your project; | ||
- You are using the default build output location (`.vitepress/dist`); | ||
- VuePress is installed as a local dependency in your project, and you have setup the following npm scripts: | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"docs:build": "vuepress build docs", | ||
"docs:serve": "vuepress serve docs" | ||
} | ||
} | ||
``` | ||
|
||
## Building The Docs | ||
|
||
You may run `yarn docs:build` command to build the docs. | ||
|
||
```bash | ||
$ yarn docs:build | ||
``` | ||
|
||
By default, the build output will be placed at `.vitepress/dist`. You may deploy this `dist` folder to any of your preferred platforms. | ||
|
||
### Testing The Docs Locally | ||
|
||
Once you've built the docs, you may test them locally by running `yarn docs:serve` command. | ||
|
||
```bash | ||
$ yarn docs:build | ||
$ yarn docs:serve | ||
``` | ||
|
||
The `serve` command will boot up local static web server that serves the files from `.vitepress/dist` at http://localhost:3000. It's an easy way to check if the production build looks OK in your local environment. | ||
|
||
You may configure the port of the server py passing `--port` flag as an argument. | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"docs:serve": "vuepress serve docs --port 8080" | ||
} | ||
} | ||
``` | ||
|
||
Now the `docs:serve` method will launch the server at http://localhost:8080. |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './server' | ||
export * from './build/build' | ||
export * from './serve/serve' | ||
export * from './config' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Koa from 'koa' | ||
import koaServe from 'koa-static' | ||
import { resolveConfig } from '../config' | ||
|
||
export interface ServeOptions { | ||
root?: string | ||
port?: number | ||
} | ||
|
||
export async function serve(options: ServeOptions = {}) { | ||
const port = options.port !== undefined ? options.port : 3000 | ||
const site = await resolveConfig(options.root) | ||
|
||
const app = new Koa() | ||
|
||
app.use(koaServe(site.outDir)) | ||
|
||
app.listen(port) | ||
|
||
console.log(`listening at http://localhost:${port}`) | ||
} |
This file contains 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