Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/forty-hats-press.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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