mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
refactor: folder structure & filename
This commit is contained in:
parent
9070fb50ab
commit
dbf78c5c14
10 changed files with 79 additions and 74 deletions
|
@ -13,8 +13,8 @@ const serve = require('webpack-serve');
|
|||
const serveWaitpage = require('webpack-serve-waitpage');
|
||||
const webpackNiceLog = require('webpack-nicelog');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const load = require('./loader');
|
||||
const createDevConfig = require('./webpack/dev');
|
||||
const load = require('../loader');
|
||||
const createDevConfig = require('../webpack/dev');
|
||||
|
||||
async function getPort(port) {
|
||||
portfinder.basePort = parseInt(port, 10) || 8080;
|
||||
|
@ -61,7 +61,7 @@ module.exports = async function dev(sourceDir, cliOptions = {}) {
|
|||
{
|
||||
inject: false,
|
||||
hash: true,
|
||||
template: path.resolve(__dirname, 'core/index.html'),
|
||||
template: path.resolve(__dirname, '../core/index.html'),
|
||||
filename: 'index.html'
|
||||
}
|
||||
]);
|
|
@ -1,2 +1,7 @@
|
|||
exports.dev = require('./dev');
|
||||
exports.build = require('./build');
|
||||
const dev = require('./commands/dev');
|
||||
const build = require('./commands/build');
|
||||
|
||||
module.exports = {
|
||||
dev,
|
||||
build
|
||||
};
|
||||
|
|
|
@ -25,12 +25,12 @@ module.exports = async function load(sourceDir) {
|
|||
? 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;
|
||||
// resolve the path of our app user interface layout
|
||||
const uiPath =
|
||||
!siteConfig.uiPath ||
|
||||
!fs.existsSync(path.resolve(sourceDir, siteConfig.uiPath))
|
||||
? path.resolve(__dirname, '../ui')
|
||||
: siteConfig.uiPath;
|
||||
|
||||
const publicPath = siteConfig.base || '/';
|
||||
|
||||
|
@ -39,7 +39,7 @@ module.exports = async function load(sourceDir) {
|
|||
blogDatas,
|
||||
sourceDir,
|
||||
outDir,
|
||||
themePath,
|
||||
uiPath,
|
||||
publicPath
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ const Config = require('webpack-chain');
|
|||
const path = require('path');
|
||||
|
||||
module.exports = function createBaseConfig(props) {
|
||||
const {outDir, themePath, sourceDir, publicPath} = props;
|
||||
const {outDir, uiPath, sourceDir, publicPath} = props;
|
||||
|
||||
const config = new Config();
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
@ -17,7 +17,7 @@ module.exports = function createBaseConfig(props) {
|
|||
|
||||
config.resolve
|
||||
.set('symlinks', true)
|
||||
.alias.set('@theme', themePath)
|
||||
.alias.set('@ui', uiPath)
|
||||
.set('@source', sourceDir)
|
||||
.set('@generated', path.resolve(__dirname, '../generated'))
|
||||
.set('@core', path.resolve(__dirname, '../core'))
|
||||
|
|
|
@ -4,7 +4,7 @@ const createBaseConfig = require('./base');
|
|||
module.exports = function createDevConfig(props) {
|
||||
const config = createBaseConfig(props);
|
||||
|
||||
config.entry('main').add(path.resolve(__dirname, '../core/index.js'));
|
||||
config.entry('main').add(path.resolve(__dirname, '../core/devEntry.js'));
|
||||
|
||||
return config;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue