diff --git a/package.json b/package.json index b19165d137b..d1b91d9ee9e 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "electron-download-tf": "4.3.1", "electron-is-dev": "^0.1.2", "electron-osx-sign": "0.4.6", - "fcopy-pre-bundled": "0.3.1", + "fcopy-pre-bundled": "0.3.3", "fs-extra-p": "^4.3.0", "hosted-git-info": "^2.4.2", "ini": "^1.3.4", diff --git a/packages/electron-builder-util/package.json b/packages/electron-builder-util/package.json index 00df3ab48f0..c54a23e21c3 100644 --- a/packages/electron-builder-util/package.json +++ b/packages/electron-builder-util/package.json @@ -12,7 +12,7 @@ ], "dependencies": { "fs-extra-p": "^4.3.0", - "fcopy-pre-bundled": "0.3.1", + "fcopy-pre-bundled": "0.3.3", "is-ci": "^1.0.10", "stat-mode": "^0.2.2", "bluebird-lst": "^1.0.2", diff --git a/packages/electron-builder-util/src/fs.ts b/packages/electron-builder-util/src/fs.ts index 50a72960f00..b470f9d6af9 100644 --- a/packages/electron-builder-util/src/fs.ts +++ b/packages/electron-builder-util/src/fs.ts @@ -41,7 +41,7 @@ export async function exists(file: string): Promise { } } -export async function walk(initialDirPath: string, filter?: Filter | null, consumer?: (file: string, stat: Stats, parent: string, extraIgnoredFiles: Set) => any): Promise> { +export async function walk(initialDirPath: string, filter?: Filter | null, consumer?: (file: string, stat: Stats, parent: string, extraIgnoredFiles: Set, siblingNames: Array) => any): Promise> { const result: Array = [] const queue: Array = [initialDirPath] let addDirToResult = false @@ -68,7 +68,7 @@ export async function walk(initialDirPath: string, filter?: Filter | null, consu return null } - const consumerResult = consumer == null ? null : consumer(filePath, stat, dirPath, extraIgnoredFiles) + const consumerResult = consumer == null ? null : consumer(filePath, stat, dirPath, extraIgnoredFiles, childNames) if (consumerResult == null || !("then" in consumerResult)) { if (stat.isDirectory()) { dirs.push(name) diff --git a/packages/electron-builder/src/asarUtil.ts b/packages/electron-builder/src/asarUtil.ts index 612daff447b..3d2ca38f483 100644 --- a/packages/electron-builder/src/asarUtil.ts +++ b/packages/electron-builder/src/asarUtil.ts @@ -59,12 +59,12 @@ export class AsarPackager { async pack(filter: Filter, isElectronCompile: boolean) { const metadata = this.metadata const nodeModulesSystemDependentSuffix = `${path.sep}node_modules` - let files = await walk(this.src, filter, (file, fileStat, parent, extraIgnoredFiles) => { + let files = await walk(this.src, filter, (file, fileStat, parent, extraIgnoredFiles, siblingNames) => { metadata.set(file, fileStat) // https://github.com/electron-userland/electron-builder/issues/1539 // but do not filter if we inside node_modules dir - if (fileStat.isDirectory() && file.endsWith(nodeModulesSystemDependentSuffix) && !parent.includes("node_modules")) { + if (fileStat.isDirectory() && file.endsWith(nodeModulesSystemDependentSuffix) && !parent.includes("node_modules") && siblingNames.includes("package.json")) { return dependencies(parent, extraIgnoredFiles) .then(it => { if (debug.enabled) { diff --git a/yarn.lock b/yarn.lock index 76c77b9381f..b1e0632c472 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1227,9 +1227,9 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fcopy-pre-bundled@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/fcopy-pre-bundled/-/fcopy-pre-bundled-0.3.1.tgz#d7c5a171850a92cedd5370abe50976b013b1ed8d" +fcopy-pre-bundled@0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/fcopy-pre-bundled/-/fcopy-pre-bundled-0.3.3.tgz#4e1fce4a94ab3fafcf3bbb3d5567bb152092bf1b" feature-detect-es6@^1.3.1: version "1.3.1"