mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
refactor: prefer fs.outputFile to ensureDir + writeFile (#6880)
* refactor: prefer fs.outputFile to ensureDir + writeFile * fix test * fix
This commit is contained in:
parent
73df485aec
commit
23a34c1a07
15 changed files with 66 additions and 108 deletions
|
@ -47,8 +47,7 @@ async function createVersionedSidebarFile({
|
|||
versionedSidebarsDir,
|
||||
`version-${version}-sidebars.json`,
|
||||
);
|
||||
await fs.ensureDir(path.dirname(newSidebarFile));
|
||||
await fs.writeFile(
|
||||
await fs.outputFile(
|
||||
newSidebarFile,
|
||||
`${JSON.stringify(sidebars, null, 2)}\n`,
|
||||
'utf8',
|
||||
|
@ -140,8 +139,7 @@ export async function cliDocsVersionCommand(
|
|||
|
||||
// Update versions.json file.
|
||||
versions.unshift(version);
|
||||
await fs.ensureDir(path.dirname(versionsJSONFile));
|
||||
await fs.writeFile(
|
||||
await fs.outputFile(
|
||||
versionsJSONFile,
|
||||
`${JSON.stringify(versions, null, 2)}\n`,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue