From 973a0048b46b8367864241a903453f927c158304 Mon Sep 17 00:00:00 2001 From: Gabriel Bodeen Date: Thu, 22 Dec 2022 09:03:51 -0600 Subject: [PATCH] fix: Ensure parent directories of symlinks are created (#7327) --- .changeset/violet-seahorses-wait.md | 5 +++++ packages/app-builder-lib/src/util/appFileCopier.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/violet-seahorses-wait.md diff --git a/.changeset/violet-seahorses-wait.md b/.changeset/violet-seahorses-wait.md new file mode 100644 index 00000000000..63bea2edc6e --- /dev/null +++ b/.changeset/violet-seahorses-wait.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": patch +--- + +fix: Ensure parent directories of symlinks are created when copied directory only contains symlinks diff --git a/packages/app-builder-lib/src/util/appFileCopier.ts b/packages/app-builder-lib/src/util/appFileCopier.ts index 173916bc6aa..16767aad981 100644 --- a/packages/app-builder-lib/src/util/appFileCopier.ts +++ b/packages/app-builder-lib/src/util/appFileCopier.ts @@ -2,7 +2,8 @@ import BluebirdPromise from "bluebird-lst" import { AsyncTaskManager, log } from "builder-util" import { CONCURRENCY, FileCopier, FileTransformer, Link, MAX_FILE_REQUESTS, statOrNull, walk } from "builder-util/out/fs" import { Stats } from "fs" -import { mkdir, readlink, symlink } from "fs/promises" +import { mkdir, readlink } from "fs/promises" +import { ensureSymlink } from "fs-extra" import * as path from "path" import { isLibOrExe } from "../asar/unpackDetector" import { Platform } from "../core" @@ -82,7 +83,7 @@ export async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, await taskManager.awaitTasks() } if (links.length > 0) { - await BluebirdPromise.map(links, it => symlink(it.link, it.file), CONCURRENCY) + await BluebirdPromise.map(links, it => ensureSymlink(it.link, it.file), CONCURRENCY) } }