mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-20 12:37:01 +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
|
@ -441,7 +441,7 @@ export default function pluginContentBlog(
|
|||
const feedTypes = getFeedTypes(options.feedOptions?.type);
|
||||
|
||||
await Promise.all(
|
||||
feedTypes.map((feedType) => {
|
||||
feedTypes.map(async (feedType) => {
|
||||
const feedPath = path.join(
|
||||
outDir,
|
||||
options.routeBasePath,
|
||||
|
@ -449,7 +449,7 @@ export default function pluginContentBlog(
|
|||
);
|
||||
const feedContent = feedType === 'rss' ? feed.rss2() : feed.atom1();
|
||||
try {
|
||||
fs.writeFileSync(feedPath, feedContent);
|
||||
await fs.outputFile(feedPath, feedContent);
|
||||
} catch (err) {
|
||||
throw new Error(`Generating ${feedType} feed failed: ${err}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue