mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-28 08:27:03 +02:00
refactor: prefer fs.readJSON over readFile.then(JSON.parse) (#7186)
* refactor: prefer fs.readJSON over readFile.then(JSON.parse) * refactor: use promises
This commit is contained in:
parent
674a77f02d
commit
200009008b
9 changed files with 27 additions and 33 deletions
|
@ -27,12 +27,8 @@ type PackageJsonFile = {
|
|||
|
||||
async function getPackagesJsonFiles(): Promise<PackageJsonFile[]> {
|
||||
const files = await Globby('packages/*/package.json');
|
||||
|
||||
return Promise.all(
|
||||
files.map(async (file) => ({
|
||||
file,
|
||||
content: JSON.parse(await fs.readFile(file, 'utf8')),
|
||||
})),
|
||||
files.map((file) => fs.readJSON(file).then((content) => ({file, content}))),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue