11import BluebirdPromise from "bluebird-lst"
22import { copyFile as _nodeCopyFile } from "fs-extra"
33import { Stats } from "fs"
4+ import { platform } from "os"
45import { access , chmod , mkdir , link , lstat , readdir , readlink , stat , symlink , unlink , writeFile } from "fs/promises"
56import * as path from "path"
67import { Mode } from "stat-mode"
@@ -283,6 +284,7 @@ export function copyDir(src: string, destination: string, options: CopyDirOption
283284
284285 const createdSourceDirs = new Set < string > ( )
285286 const links : Array < Link > = [ ]
287+ const symlinkType = platform ( ) === "win32" ? "junction" : "file"
286288 return walk ( src , options . filter , {
287289 consume : async ( file , stat , parent ) => {
288290 if ( ! stat . isFile ( ) && ! stat . isSymbolicLink ( ) ) {
@@ -301,7 +303,7 @@ export function copyDir(src: string, destination: string, options: CopyDirOption
301303 links . push ( { file : destFile , link : await readlink ( file ) } )
302304 }
303305 } ,
304- } ) . then ( ( ) => BluebirdPromise . map ( links , it => symlink ( it . link , it . file ) , CONCURRENCY ) )
306+ } ) . then ( ( ) => BluebirdPromise . map ( links , it => symlink ( it . link , it . file , symlinkType ) , CONCURRENCY ) )
305307}
306308
307309// eslint-disable-next-line @typescript-eslint/no-unused-vars
0 commit comments