Skip to content

Commit

Permalink
perf: do not copy already copied files
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Aug 4, 2021
1 parent 2a13db4 commit 4132483
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/service/inResourceHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ResourceHandler extends StandardHandler {
_buildMatchingFiles(elementName) {
const parsedElementName = path.parse(elementName).name
const matchingFiles = [parsedElementName]
if (StandardHandler.metadata[this.type].suffix) {
if (StandardHandler.metadata[this.type].metaFile) {
matchingFiles.push(
`${parsedElementName}.${StandardHandler.metadata[this.type].suffix}${
mc.METAFILE_SUFFIX
Expand Down
5 changes: 4 additions & 1 deletion src/service/standardHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const FSE_COPYSYNC_OPTION = {
preserveTimestamps: false,
}

const copiedFiles = new Set()

class StandardHandler {
static metadata

Expand Down Expand Up @@ -98,8 +100,9 @@ class StandardHandler {
}

_copyFiles(src, dst) {
if (fse.pathExistsSync(src)) {
if (!copiedFiles.has(src) && fse.pathExistsSync(src)) {
fse.copySync(src, dst, FSE_COPYSYNC_OPTION)
copiedFiles.add(src)
}
}

Expand Down

0 comments on commit 4132483

Please sign in to comment.