mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-13 08:12:48 +02:00
feat(v2): postBuild() - plugin lifecycle (#1302)
* feat(v2): build() - plugin lifecycle * rename to postBuild
This commit is contained in:
parent
c5d8e2d641
commit
72242dddf4
9 changed files with 145 additions and 94 deletions
|
@ -12,7 +12,6 @@ const chalk = require('chalk');
|
|||
const fs = require('fs-extra');
|
||||
const globby = require('globby');
|
||||
const load = require('../load');
|
||||
const createSitemap = require('../core/sitemap');
|
||||
const createServerConfig = require('../webpack/server');
|
||||
const createClientConfig = require('../webpack/client');
|
||||
const {applyConfigureWebpack} = require('../webpack/utils');
|
||||
|
@ -86,10 +85,15 @@ module.exports = async function build(siteDir) {
|
|||
}),
|
||||
);
|
||||
|
||||
// Generate sitemap.
|
||||
const sitemap = await createSitemap(props);
|
||||
const sitemapPath = path.join(outDir, 'sitemap.xml');
|
||||
await fs.writeFile(sitemapPath, sitemap);
|
||||
/* Plugin lifecycle - postBuild */
|
||||
await Promise.all(
|
||||
plugins.map(async plugin => {
|
||||
if (!plugin.postBuild) {
|
||||
return;
|
||||
}
|
||||
await plugin.postBuild(props);
|
||||
}),
|
||||
);
|
||||
|
||||
const relativeDir = path.relative(process.cwd(), outDir);
|
||||
console.log(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue