-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'c84843053a8f9e0b6af14c6b2ed33c5f82d495b3' into feat/ele…
…ctron-fuses # Conflicts: # packages/app-builder-lib/package.json # pnpm-lock.yaml
- Loading branch information
Showing
19 changed files
with
2,602 additions
and
1,766 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"app-builder-lib": minor | ||
--- | ||
|
||
feat: migrate to official `electron/asar` packaging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Jest TEST_FILES", | ||
"runtimeExecutable": "pnpm", | ||
"program": "ci:test", | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "openOnFirstSessionStart", | ||
"env": { | ||
"TEST_FILES": "BuildTest" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,21 @@ | ||
import { statOrNull } from "builder-util" | ||
import { Node, readAsar } from "./asar" | ||
import * as asar from "@electron/asar" | ||
import { FilesystemEntry, FilesystemFileEntry } from "@electron/asar/lib/filesystem" | ||
|
||
/** @internal */ | ||
export async function checkFileInArchive(asarFile: string, relativeFile: string, messagePrefix: string) { | ||
export function checkFileInArchive(asarFile: string, relativeFile: string, messagePrefix: string) { | ||
function error(text: string) { | ||
return new Error(`${messagePrefix} "${relativeFile}" in the "${asarFile}" ${text}`) | ||
} | ||
|
||
let fs | ||
let stat: FilesystemEntry | ||
try { | ||
fs = await readAsar(asarFile) | ||
stat = asar.statFile(asarFile, relativeFile, false) | ||
} catch (e: any) { | ||
throw error(`is corrupted: ${e}`) | ||
} | ||
|
||
let stat: Node | null | ||
try { | ||
stat = fs.getFile(relativeFile) | ||
} catch (_e: any) { | ||
const fileStat = await statOrNull(asarFile) | ||
if (fileStat == null) { | ||
throw error(`does not exist. Seems like a wrong configuration.`) | ||
if (e.message.includes("Cannot read properties of undefined (reading 'link')")) { | ||
throw error("does not exist. Seems like a wrong configuration.") | ||
} | ||
|
||
// asar throws error on access to undefined object (info.link) | ||
stat = null | ||
} | ||
|
||
if (stat == null) { | ||
throw error(`does not exist. Seems like a wrong configuration.`) | ||
throw error(`is corrupted: ${e}`) | ||
} | ||
if (stat.size === 0) { | ||
if ((stat as FilesystemFileEntry).size === 0) { | ||
throw error(`is corrupted: size 0`) | ||
} | ||
return stat | ||
} |
Oops, something went wrong.