Skip to content

Commit

Permalink
perf(ArxMap): only create directories for exporting once per file
Browse files Browse the repository at this point in the history
  • Loading branch information
meszaros-lajos-gyorgy committed May 20, 2024
1 parent ed014fd commit ba4641d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ArxMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { Zone } from '@src/Zone.js'
import { Zones } from '@src/Zones.js'
import { compile } from '@src/compile.js'
import { MapFinalizedError, MapNotFinalizedError } from '@src/errors.js'
import { times } from '@src/faux-ramda.js'
import { times, uniq } from '@src/faux-ramda.js'
import { getGeneratorPackageJSON, latin9ToLatin1 } from '@src/helpers.js'
import { OriginalLevel } from '@src/types.js'

Expand Down Expand Up @@ -477,8 +477,9 @@ export class ArxMap {
...Object.values(files).map((filename) => filename.replace(/\.json$/, '')),
]

for (const filename of pathsOfTheFiles) {
await fs.mkdir(path.dirname(filename), { recursive: true })
const dirnames = uniq(pathsOfTheFiles.map(path.dirname.bind(path)))
for (const dirname of dirnames) {
await fs.mkdir(dirname, { recursive: true })
}

// ------------------------
Expand Down

0 comments on commit ba4641d

Please sign in to comment.