1
1
import BluebirdPromise from "bluebird-lst"
2
2
import { copyFile as _nodeCopyFile } from "fs-extra"
3
3
import { Stats } from "fs"
4
+ import { platform } from "os"
4
5
import { access , chmod , mkdir , link , lstat , readdir , readlink , stat , symlink , unlink , writeFile } from "fs/promises"
5
6
import * as path from "path"
6
7
import { Mode } from "stat-mode"
@@ -283,6 +284,7 @@ export function copyDir(src: string, destination: string, options: CopyDirOption
283
284
284
285
const createdSourceDirs = new Set < string > ( )
285
286
const links : Array < Link > = [ ]
287
+ const symlinkType = platform ( ) === "win32" ? "junction" : "file"
286
288
return walk ( src , options . filter , {
287
289
consume : async ( file , stat , parent ) => {
288
290
if ( ! stat . isFile ( ) && ! stat . isSymbolicLink ( ) ) {
@@ -301,7 +303,7 @@ export function copyDir(src: string, destination: string, options: CopyDirOption
301
303
links . push ( { file : destFile , link : await readlink ( file ) } )
302
304
}
303
305
} ,
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 ) )
305
307
}
306
308
307
309
// eslint-disable-next-line @typescript-eslint/no-unused-vars
0 commit comments