mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-17 19:16:58 +02:00
feat: prototype dev server
This commit is contained in:
parent
2ab412e563
commit
333574efe6
11 changed files with 524 additions and 38 deletions
|
@ -1,15 +1,35 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const loadConfig = require('./config');
|
||||
const loadBlog = require('./blog');
|
||||
|
||||
module.exports = async function load(sourceDir) {
|
||||
// 1. load siteConfig
|
||||
// load siteConfig
|
||||
const siteConfig = loadConfig(sourceDir);
|
||||
|
||||
// 2. extract data from all blog files
|
||||
// extract data from all blog files
|
||||
const blogDatas = await loadBlog(sourceDir);
|
||||
|
||||
// resolve outDir
|
||||
const outDir = siteConfig.dest
|
||||
? path.resolve(siteConfig.dest)
|
||||
: path.resolve(sourceDir, '.blogi/dist');
|
||||
|
||||
// resolve the path of our app theme/ layout
|
||||
const themePath =
|
||||
!siteConfig.themePath ||
|
||||
!fs.existsSync(path.resolve(sourceDir, siteConfig.themePath))
|
||||
? path.resolve(__dirname, '../theme')
|
||||
: siteConfig.themePath;
|
||||
|
||||
const publicPath = siteConfig.base || '/';
|
||||
|
||||
return {
|
||||
siteConfig,
|
||||
blogDatas
|
||||
blogDatas,
|
||||
sourceDir,
|
||||
outDir,
|
||||
themePath,
|
||||
publicPath
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue