Skip to content

Commit

Permalink
fix copying for jsonDir assets
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Sep 1, 2024
1 parent 59f63ec commit f1b39d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

* 2.8.0
- (New Feature) added new merge command for CLI: `npx monocart merge path-to/*/*.json` (#142)

* 2.7.1
- fixed custom raw dir for merging coverage

Expand Down
7 changes: 6 additions & 1 deletion lib/merge-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ const mergeArtifacts = async (artifactsList, options) => {
const coverageList = [];
const coverageRawList = [];

const jsonDirMap = {};

artifactsList.forEach((item) => {
const jsonDir = item.jsonDir;
let hasAssets = false;
Expand Down Expand Up @@ -144,6 +146,7 @@ const mergeArtifacts = async (artifactsList, options) => {
// copy assets dir
if (hasAssets) {
copyTarget('assets', jsonDir, outputDir);
jsonDirMap[jsonDir] = true;
}

});
Expand All @@ -165,7 +168,9 @@ const mergeArtifacts = async (artifactsList, options) => {
// copy all files in art dir, like network, audit
copyTarget(targetDirName, jsonDir, outputDir);

copyTarget('assets', jsonDir, outputDir);
if (!jsonDirMap[jsonDir]) {
copyTarget('assets', jsonDir, outputDir);
}

// update path relative to cwd/root
art.path = Util.relativePath(path.resolve(outputDir, art.path));
Expand Down

0 comments on commit f1b39d5

Please sign in to comment.