Skip to content

Commit

Permalink
pref: parse json
Browse files Browse the repository at this point in the history
  • Loading branch information
showlotus committed Apr 21, 2024
1 parent 59c39fa commit 87bf712
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@ export async function openDocumentRevealTokenRange(params: CommandTokenParams) {
*/
export async function getConfigJSON(folderPath: string) {
const configDirs = getConfiguration('configDirs')
console.log(configDirs)
const res = await Promise.all(
configDirs.map(async dir => {
return await fg.glob([`**/${dir}/*.json`], {
cwd: folderPath,
ignore: ['**/node_modules/**'],
absolute: true,
})
}),
if (!configDirs.length) {
return []
}

const res = await fg.glob(
configDirs.map(dir => `**/${dir}/*.json`),
{
cwd: folderPath,
ignore: ['**/node_modules/**'],
absolute: true,
},
)
return res.flat()
return res
}

/**
Expand Down

0 comments on commit 87bf712

Please sign in to comment.