Skip to content

Commit

Permalink
refactor: use fs-readdir-recursive package
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Aug 19, 2023
1 parent 16786a6 commit 519a1ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@japa/runner": "3.0.0-6",
"@poppinss/dev-utils": "^2.0.3",
"@swc/core": "^1.3.70",
"@types/fs-readdir-recursive": "^1.1.0",
"@types/he": "^1.2.0",
"@types/node": "^20.4.4",
"c8": "^8.0.0",
Expand All @@ -63,6 +64,7 @@
"edge-error": "^4.0.0-0",
"edge-lexer": "^6.0.0-4",
"edge-parser": "^9.0.0-3",
"fs-readdir-recursive": "^1.1.0",
"he": "^1.2.0",
"js-stringify": "^1.0.2",
"property-information": "^6.2.0",
Expand Down
10 changes: 5 additions & 5 deletions src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { slash } from '@poppinss/utils'
import { fileURLToPath } from 'node:url'
import string from '@poppinss/utils/string'
import { join, isAbsolute } from 'node:path'
import { existsSync, readFileSync, readdirSync } from 'node:fs'
import readdirSync from 'fs-readdir-recursive'
import { existsSync, readFileSync } from 'node:fs'
import type { ComponentsTree, LoaderContract, LoaderTemplate } from './types.js'

/**
Expand Down Expand Up @@ -58,10 +59,9 @@ export class Loader implements LoaderContract {
return []
}

const files = readdirSync(join(diskBasePath, componentsDirName), {
recursive: true,
encoding: 'utf8',
}).filter((file) => file.endsWith('.edge'))
const files = readdirSync(join(diskBasePath, componentsDirName)).filter((file) =>
file.endsWith('.edge')
)

return files.map((file) => {
const fileName = slash(file).replace(/\.edge$/, '')
Expand Down

0 comments on commit 519a1ca

Please sign in to comment.