From f2d30d4e3396725f7ab0d54e8c92e97885fbac86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Chmiela?= Date: Tue, 4 Feb 2025 22:22:59 +0100 Subject: [PATCH] Fix symlink support --- packages/eas-cli/src/vcs/local.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/eas-cli/src/vcs/local.ts b/packages/eas-cli/src/vcs/local.ts index ea424fb293..fef6a68417 100644 --- a/packages/eas-cli/src/vcs/local.ts +++ b/packages/eas-cli/src/vcs/local.ts @@ -1,5 +1,6 @@ import fg from 'fast-glob'; -import fs from 'fs-extra'; +import fs from 'fs/promises'; +import fsExtra from 'fs-extra'; import createIgnore, { Ignore as SingleFileIgnore } from 'ignore'; import path from 'path'; @@ -36,10 +37,10 @@ export class Ignore { public async initIgnoreAsync(): Promise { const easIgnorePath = path.join(this.rootDir, EASIGNORE_FILENAME); - if (await fs.pathExists(easIgnorePath)) { + if (await fsExtra.pathExists(easIgnorePath)) { this.ignoreMapping = [ ['', createIgnore().add(DEFAULT_IGNORE)], - ['', createIgnore().add(await fs.readFile(easIgnorePath, 'utf-8'))], + ['', createIgnore().add(await fsExtra.readFile(easIgnorePath, 'utf-8'))], ]; return; } @@ -57,7 +58,7 @@ export class Ignore { ignoreFilePaths.map(async filePath => { return [ filePath.slice(0, filePath.length - GITIGNORE_FILENAME.length), - createIgnore().add(await fs.readFile(path.join(this.rootDir, filePath), 'utf-8')), + createIgnore().add(await fsExtra.readFile(path.join(this.rootDir, filePath), 'utf-8')), ] as const; }) ); @@ -77,7 +78,10 @@ export class Ignore { export async function makeShallowCopyAsync(src: string, dst: string): Promise { const ignore = new Ignore(src); await ignore.initIgnoreAsync(); - await fs.copy(src, dst, { + await fs.cp(src, dst, { + recursive: true, + // Preserve symlinks without re-resolving them to their original targets + verbatimSymlinks: true, filter: (srcFilePath: string) => { if (srcFilePath === src) { return true;