mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 19:32:35 +02:00
refactor(v2): convert synchronous file write to asynchronous (#2936)
* perf(v2): convert synchronous filewrite to asynchronous in feed file generate This looks like should return a Promise list , other than a sync io operation * perf(v2): convert synchronous filewrite to asynchronous in sitemap generate * perf(v2): convert Promise style to async/await style for consistency
This commit is contained in:
parent
0c92f5aacd
commit
930222ea87
2 changed files with 4 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {PluginOptions} from './types';
|
||||
import createSitemap from './createSitemap';
|
||||
|
@ -37,7 +37,7 @@ export default function pluginSitemap(
|
|||
// Write sitemap file.
|
||||
const sitemapPath = path.join(outDir, 'sitemap.xml');
|
||||
try {
|
||||
fs.writeFileSync(sitemapPath, generatedSitemap);
|
||||
await fs.outputFile(sitemapPath, generatedSitemap);
|
||||
} catch (err) {
|
||||
throw new Error(`Sitemap error: ${err}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue