Skip to content

Commit

Permalink
feat(nsis): display required disk space
Browse files Browse the repository at this point in the history
Adjusted code style, changed operations order in packArch

electron-userland#7487
  • Loading branch information
Nikolay Velizhanin authored and Nikolay Velizhanin committed Apr 17, 2023
1 parent c830d33 commit da837a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions packages/app-builder-lib/src/targets/nsis/nsisUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,11 @@ export class AppPackageHelper {
const appOutDir = target.archs.get(arch)!
resultPromise = this.elevateHelper
.copy(appOutDir, target)
.then(() => dirSize(appOutDir))
.then(unpackedSize =>
target.buildAppPackage(appOutDir, arch).then(fileInfo => ({
fileInfo,
unpackedSize,
}))
)
.then(() => target.buildAppPackage(appOutDir, arch))
.then(async fileInfo => ({
fileInfo,
unpackedSize: await dirSize(appOutDir),
}))
this.archToResult.set(arch, resultPromise)
}

Expand Down
4 changes: 3 additions & 1 deletion packages/builder-util/src/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ export async function dirSize(dirPath: string): Promise<number> {
const entrySizes = entries.map(async entry => {
const entryPath = path.join(dirPath, entry.name)

if (entry.isDirectory()) return await dirSize(entryPath)
if (entry.isDirectory()) {
return await dirSize(entryPath)
}

if (entry.isFile()) {
const { size } = await stat(entryPath)
Expand Down

0 comments on commit da837a8

Please sign in to comment.