Skip to content

Commit

Permalink
feat(archive): skip nsis compression step when archive is already up …
Browse files Browse the repository at this point in the history
…to date (#7971)
  • Loading branch information
OrbitZore committed Jan 9, 2024
1 parent 28e5b5d commit 8803852
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/forty-hats-press.md
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

feat(archive): skip archive when destination file is already up to date
8 changes: 7 additions & 1 deletion packages/app-builder-lib/src/targets/archive.ts
@@ -1,5 +1,5 @@
import { debug7z, exec, log } from "builder-util"
import { exists, unlinkIfExists } from "builder-util/out/fs"
import { exists, unlinkIfExists, statOrNull } from "builder-util/out/fs"
import { move } from "fs-extra"
import * as path from "path"
import { create, CreateOptions, FileOptions } from "tar"
Expand Down Expand Up @@ -203,6 +203,12 @@ export function computeZipCompressArgs(options: ArchiveOptions = {}) {
// 7z is very fast, so, use ultra compression
/** @internal */
export async function archive(format: string, outFile: string, dirToArchive: string, options: ArchiveOptions = {}): Promise<string> {
const outFileStat = await statOrNull(outFile)
const dirStat = await statOrNull(dirToArchive)
if (outFileStat && dirStat && outFileStat.mtime > dirStat.mtime) {
log.info({ reason: "Archive file is up to date", outFile }, `skipped archiving`)
return outFile
}
let use7z = true
if (process.platform === "darwin" && format === "zip" && dirToArchive.normalize("NFC") !== dirToArchive) {
log.warn({ reason: "7z doesn't support NFD-normalized filenames" }, `using zip`)
Expand Down

0 comments on commit 8803852

Please sign in to comment.