feat: add infoPlistsToIgnore prop to prevent modification (#72)

This commit is contained in:
Samuel Attard
2023-06-24 22:38:09 -07:00
committed by GitHub
parent 85b1f90f2c
commit b02ce7697f

View File

@@ -44,6 +44,10 @@ export type MakeUniversalOpts = {
* Minimatch pattern of binaries that are expected to be the same x64 binary in both of the ASAR files. * Minimatch pattern of binaries that are expected to be the same x64 binary in both of the ASAR files.
*/ */
x64ArchFiles?: string; x64ArchFiles?: string;
/**
* Minimatch pattern of paths that should not receive an injected ElectronAsarIntegrity value
*/
infoPlistsToIgnore?: string;
}; };
const dupedFiles = (files: AppFile[]) => const dupedFiles = (files: AppFile[]) =>
@@ -321,7 +325,12 @@ export const makeUniversalApp = async (opts: MakeUniversalOpts): Promise<void> =
); );
} }
const mergedPlist = { ...x64Plist, ElectronAsarIntegrity: generatedIntegrity }; const injectAsarIntegrity =
!opts.infoPlistsToIgnore ||
minimatch(plistFile.relativePath, opts.infoPlistsToIgnore, { matchBase: true });
const mergedPlist = injectAsarIntegrity
? { ...x64Plist, ElectronAsarIntegrity: generatedIntegrity }
: { ...x64Plist };
await fs.writeFile(path.resolve(tmpApp, plistFile.relativePath), plist.build(mergedPlist)); await fs.writeFile(path.resolve(tmpApp, plistFile.relativePath), plist.build(mergedPlist));
} }