feat: user configurable `outDir` (#448)

pull/486/head
Bryan Müller 3 years ago committed by GitHub
parent fb6a4ad3e0
commit 5b04bb9eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

1
.gitignore vendored

@ -8,3 +8,4 @@ dist
node_modules node_modules
TODOs.md TODOs.md
.vscode .vscode
.idea

@ -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>/'`. 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: 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:

@ -38,7 +38,7 @@ export interface UserConfig<ThemeConfig = any> {
locales?: Record<string, LocaleConfig> locales?: Record<string, LocaleConfig>
markdown?: MarkdownOptions markdown?: MarkdownOptions
/** /**
* Opitons to pass on to `@vitejs/plugin-vue` * Options to pass on to `@vitejs/plugin-vue`
*/ */
vue?: VuePluginOptions vue?: VuePluginOptions
/** /**
@ -48,6 +48,7 @@ export interface UserConfig<ThemeConfig = any> {
srcDir?: string srcDir?: string
srcExclude?: string[] srcExclude?: string[]
outDir?: string
shouldPreload?: (link: string, page: string) => boolean shouldPreload?: (link: string, page: string) => boolean
/** /**
@ -105,6 +106,7 @@ export async function resolveConfig(
const [userConfig, configPath] = await resolveUserConfig(root, command, mode) const [userConfig, configPath] = await resolveUserConfig(root, command, mode)
const site = await resolveSiteData(root, userConfig) const site = await resolveSiteData(root, userConfig)
const srcDir = path.resolve(root, userConfig.srcDir || '.') const srcDir = path.resolve(root, userConfig.srcDir || '.')
const outDir = userConfig.outDir ? path.resolve(root, userConfig.outDir) : resolve(root, 'dist')
// resolve theme path // resolve theme path
const userThemeDir = resolve(root, 'theme') const userThemeDir = resolve(root, 'theme')
@ -132,7 +134,7 @@ export async function resolveConfig(
themeDir, themeDir,
pages, pages,
configPath, configPath,
outDir: resolve(root, 'dist'), outDir,
tempDir: resolve(root, '.tmp'), tempDir: resolve(root, '.tmp'),
markdown: userConfig.markdown, markdown: userConfig.markdown,
alias: resolveAliases(themeDir), alias: resolveAliases(themeDir),

Loading…
Cancel
Save