mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-10 23:02:56 +02:00
chore: remove unused variables
This commit is contained in:
parent
b1e785b6c3
commit
8b381777bc
5 changed files with 11 additions and 83 deletions
37
lib/dev.js
37
lib/dev.js
|
@ -1,21 +1,16 @@
|
|||
const ora = require('ora');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const chalk = require('chalk');
|
||||
const webpack = require('webpack');
|
||||
const fs = require('fs-extra');
|
||||
const chokidar = require('chokidar');
|
||||
const serve = require('webpack-serve');
|
||||
const convert = require('koa-connect');
|
||||
const mount = require('koa-mount');
|
||||
const range = require('koa-range');
|
||||
const serveStatic = require('koa-static');
|
||||
const history = require('connect-history-api-fallback');
|
||||
const load = require('./loader');
|
||||
const createDevConfig = require('./webpack/dev');
|
||||
const logPlugin = require('./webpack/log');
|
||||
const blogiLog = require('./webpack/log');
|
||||
|
||||
module.exports = async function dev(sourceDir, cliOptions = {}) {
|
||||
const logger = ora(chalk.blue('Start development server')).start();
|
||||
const logger = ora(chalk.blue('Starting development server')).start();
|
||||
|
||||
// load site props from preprocessed files in source directory
|
||||
const props = await load(sourceDir);
|
||||
|
@ -42,7 +37,7 @@ module.exports = async function dev(sourceDir, cliOptions = {}) {
|
|||
const port = cliOptions.port || 8080;
|
||||
const {publicPath} = props;
|
||||
|
||||
config.plugin('blogi-log').use(logPlugin, [
|
||||
config.plugin('blogi-log').use(blogiLog, [
|
||||
{
|
||||
port,
|
||||
publicPath
|
||||
|
@ -58,9 +53,8 @@ module.exports = async function dev(sourceDir, cliOptions = {}) {
|
|||
await serve(
|
||||
{},
|
||||
{
|
||||
content: [path.resolve(__dirname, 'serveContent')],
|
||||
compiler,
|
||||
open: true,
|
||||
open: false, // don't open browser automatically
|
||||
devMiddleware: {
|
||||
logLevel: 'warn',
|
||||
publicPath
|
||||
|
@ -70,26 +64,7 @@ module.exports = async function dev(sourceDir, cliOptions = {}) {
|
|||
logLevel: 'error'
|
||||
},
|
||||
logLevel: 'error',
|
||||
port,
|
||||
add: app => {
|
||||
const userPublic = path.resolve(sourceDir, '.blogi/public');
|
||||
|
||||
// enable range request
|
||||
app.use(range);
|
||||
|
||||
// respect base when serving static files...
|
||||
if (fs.existsSync(userPublic)) {
|
||||
app.use(mount(props.publicPath, serveStatic(userPublic)));
|
||||
}
|
||||
|
||||
app.use(
|
||||
convert(
|
||||
history({
|
||||
rewrites: [{from: /\.html$/, to: '/'}]
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
port
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue