fix: fully respect singleArchFiles option (#152)
Some checks failed
Publish documentation / docs (push) Failing after 13s
Some checks failed
Publish documentation / docs (push) Failing after 13s
Files listed under `singleArchFiles` are allowed to be unique for different platforms so `dupedFiles` should not return them. Fix: #151
This commit is contained in:
30
test/util.ts
30
test/util.ts
@@ -33,7 +33,12 @@ export const verifyApp = async (appPath: string, containsRuntimeGeneratedMacho =
|
||||
// verify header
|
||||
const asarFs = getRawHeader(path.resolve(resourcesDir, asar));
|
||||
expect(
|
||||
removeUnstableProperties(asarFs.header, containsRuntimeGeneratedMacho ? ['hello-world'] : []),
|
||||
removeUnstableProperties(
|
||||
asarFs.header,
|
||||
containsRuntimeGeneratedMacho
|
||||
? ['hello-world', 'hello-world-arm64', 'hello-world-x64']
|
||||
: [],
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
}
|
||||
|
||||
@@ -53,7 +58,7 @@ export const verifyApp = async (appPath: string, containsRuntimeGeneratedMacho =
|
||||
await verifyFileTree(path.resolve(resourcesDir, dir));
|
||||
}
|
||||
|
||||
const allFiles = await fileUtils.getAllAppFiles(appPath);
|
||||
const allFiles = await fileUtils.getAllAppFiles(appPath, {});
|
||||
const infoPlists = allFiles
|
||||
.filter(
|
||||
(appFile) =>
|
||||
@@ -89,7 +94,7 @@ const extractAsarIntegrity = async (infoPlist: string) => {
|
||||
export const verifyFileTree = async (dirPath: string) => {
|
||||
const { expect } = await import('vitest');
|
||||
|
||||
const dirFiles = await fileUtils.getAllAppFiles(dirPath);
|
||||
const dirFiles = await fileUtils.getAllAppFiles(dirPath, {});
|
||||
const files = dirFiles.map((file) => {
|
||||
const it = path.join(dirPath, file.relativePath);
|
||||
const name = toSystemIndependentPath(file.relativePath);
|
||||
@@ -229,6 +234,7 @@ export const generateNativeApp = async (options: {
|
||||
createAsar: boolean;
|
||||
nativeModuleArch?: string;
|
||||
additionalFiles?: Record<string, string>;
|
||||
singleArchBindings?: boolean;
|
||||
}) => {
|
||||
const {
|
||||
appNameWithExtension,
|
||||
@@ -236,6 +242,7 @@ export const generateNativeApp = async (options: {
|
||||
createAsar,
|
||||
nativeModuleArch = arch,
|
||||
additionalFiles,
|
||||
singleArchBindings,
|
||||
} = options;
|
||||
const appPath = await templateApp(appNameWithExtension, arch, async (appPath) => {
|
||||
const resources = path.join(appPath, 'Contents', 'Resources');
|
||||
@@ -247,14 +254,19 @@ export const generateNativeApp = async (options: {
|
||||
path.basename(appNameWithExtension, '.app'),
|
||||
additionalFiles,
|
||||
);
|
||||
await fs.promises.cp(
|
||||
path.join(appsDir, `hello-world-${nativeModuleArch}`),
|
||||
path.join(testPath, 'hello-world'),
|
||||
{ recursive: true, verbatimSymlinks: true },
|
||||
);
|
||||
let targetBinding: string;
|
||||
if (singleArchBindings) {
|
||||
targetBinding = path.join(testPath, `hello-world-${nativeModuleArch}`);
|
||||
} else {
|
||||
targetBinding = path.join(testPath, 'hello-world');
|
||||
}
|
||||
await fs.promises.cp(path.join(appsDir, `hello-world-${nativeModuleArch}`), targetBinding, {
|
||||
recursive: true,
|
||||
verbatimSymlinks: true,
|
||||
});
|
||||
if (createAsar) {
|
||||
await createPackageWithOptions(testPath, path.resolve(resources, 'app.asar'), {
|
||||
unpack: '**/hello-world',
|
||||
unpack: '**/hello-world*',
|
||||
});
|
||||
} else {
|
||||
await fs.promises.cp(testPath, resourcesApp, { recursive: true, verbatimSymlinks: true });
|
||||
|
||||
Reference in New Issue
Block a user