Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user configurable outDir #448

Merged
merged 7 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
dist
node_modules
TODOs.md
.vscode
.vscode
.idea
2 changes: 1 addition & 1 deletion docs/guide/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ deploy:

If you are deploying to `https://<USERNAME or GROUP>.gitlab.io/<REPO>/`, for example your repository is at `https://gitlab.com/<USERNAME>/<REPO>`, then set `base` to `'/<REPO>/'`.

2. Set `dest` in `.vitepress/config.js` to `public`.
2. Set `outDir` in `.vitepress/config.js` to `../public`.

3. Create a file called `.gitlab-ci.yml` in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content:

Expand Down
6 changes: 4 additions & 2 deletions src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface UserConfig<ThemeConfig = any> {
locales?: Record<string, LocaleConfig>
markdown?: MarkdownOptions
/**
* Opitons to pass on to `@vitejs/plugin-vue`
* Options to pass on to `@vitejs/plugin-vue`
*/
vue?: VuePluginOptions
/**
Expand All @@ -48,6 +48,7 @@ export interface UserConfig<ThemeConfig = any> {

srcDir?: string
srcExclude?: string[]
outDir?: string
shouldPreload?: (link: string, page: string) => boolean

/**
Expand Down Expand Up @@ -105,6 +106,7 @@ export async function resolveConfig(
const [userConfig, configPath] = await resolveUserConfig(root, command, mode)
const site = await resolveSiteData(root, userConfig)
const srcDir = path.resolve(root, userConfig.srcDir || '.')
const outDir = userConfig.outDir ? path.resolve(root, userConfig.outDir) : resolve(root, 'dist')

// resolve theme path
const userThemeDir = resolve(root, 'theme')
Expand Down Expand Up @@ -132,7 +134,7 @@ export async function resolveConfig(
themeDir,
pages,
configPath,
outDir: resolve(root, 'dist'),
outDir,
tempDir: resolve(root, '.tmp'),
markdown: userConfig.markdown,
alias: resolveAliases(themeDir),
Expand Down