Skip to content

Commit

Permalink
feat: add outDir config
Browse files Browse the repository at this point in the history
  • Loading branch information
zuofenghua committed Oct 8, 2020
1 parent 6261e95 commit 5255a9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
**Note this is early WIP! Currently the focus is on making doc-the-lib stable and feature complete first. It is not recommended to use this for anything serious yet.**

``` bash
npm install -D vdoc
echo '# Hello vdoc' > index.md
npm install -D doc-the-lib
echo '# Hello doc-the-lib' > index.md

# starts dev server
npx vdoc
npx doc-the-lib

# build > .vdoc/dist
npx vdoc build
# build > .doc-the-lib/dist
npx doc-the-lib build
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "doc-the-lib",
"version": "0.1.0",
"version": "0.1.2",
"description": "",
"main": "dist/node/index.js",
"typings": "types/index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface UserConfig<ThemeConfig = any> {
alias?: Record<string, string>
// TODO locales support etc.
viteOptions: ServerConfig
outDir?: string
}

export interface SiteConfig<ThemeConfig = any> {
Expand Down Expand Up @@ -56,7 +57,9 @@ export async function resolveConfig(
themeDir,
pages: await globby(['**.md'], { cwd: root, ignore: ['node_modules'] }),
configPath: resolve(root, 'config.js'),
outDir: resolve(root, 'dist'),
outDir: userConfig.outDir
? path.resolve(root, userConfig.outDir)
: path.resolve(root, 'dist'),
tempDir: path.resolve(APP_PATH, 'temp'),
resolver: createResolver(themeDir, userConfig),
userConfig
Expand Down

0 comments on commit 5255a9a

Please sign in to comment.