Skip to content

Commit

Permalink
fix: Fix issues with conflictDependency that have two or more layers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondkmp committed Sep 15, 2024
1 parent 0dd4616 commit 216eaf9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-vans-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix: Fix issues with conflictDependency that have two or more layers
23 changes: 12 additions & 11 deletions packages/app-builder-lib/src/util/appFileCopier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,25 @@ export async function computeNodeModuleFileSets(platformPackager: PlatformPackag
// use main matcher patterns, so, user can exclude some files !node_modules/xxxx
return path.dirname(parentDir)
}
for (const info of deps) {
const source = info.dir
const destination = path.join(mainMatcher.to, NODE_MODULES, info.name)
const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {
const source = dep.dir
const matcher = new FileMatcher(getRealSource(source), destination, mainMatcher.macroExpander, mainMatcher.patterns)
const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)
const files = await copier.collectNodeModules(info, nodeModuleExcludedExts)
const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts)
result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })

if (info.conflictDependency) {
for (const dep of info.conflictDependency) {
const source = dep.dir
const destination = path.join(mainMatcher.to, NODE_MODULES, info.name, NODE_MODULES, dep.name)
const matcher = new FileMatcher(getRealSource(source), destination, mainMatcher.macroExpander, mainMatcher.patterns)
const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)
result[index++] = validateFileSet({ src: source, destination, files: await copier.collectNodeModules(dep, nodeModuleExcludedExts), metadata: copier.metadata })
if (dep.conflictDependency) {
for (const c of dep.conflictDependency) {
await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))
}
}
}

for (const dep of deps) {
const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)
await collectNodeModules(dep, destination)
}

return result
}

Expand Down

0 comments on commit 216eaf9

Please sign in to comment.