8000 fix: linting by wraithgar · Pull Request #19 · npm/move-file · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

fix: linting #19

Merged
merged 1 commit into from
Aug 15, 2022
Merged
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
22 changes: 16 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,19 @@ const moveFile = async (source, destination, options = {}, root = true, symlinks
}
// try to determine what the actual file is so we can create the correct
// type of symlink in windows
let targetStat
let targetStat = 'file'
try {
targetStat = await stat(resolve(dirname(symSource), target))
} catch (err) {}
if (targetStat.isDirectory()) {
targetStat = 'junction'
}
} catch {
// targetStat remains 'file'
}
await symlink(
target,
symDestination,
targetStat && targetStat.isDirectory() ? 'junction' : 'file'
targetStat
)
}))
await rimraf(source)
Expand Down Expand Up @@ -157,14 +162,19 @@ const moveFileSync = (source, destination, options = {}, root = true, symlinks =
}
// try to determine what the actual file is so we can create the correct
// type of symlink in windows
let targetStat
let targetStat = 'file'
try {
targetStat = statSync(resolve(dirname(symSource), target))
} catch (err) {}
if (targetStat.isDirectory()) {
targetStat = 'junction'
}
} catch {
// targetStat remains 'file'
}
symlinkSync(
target,
symDestination,
targetStat && targetStat.isDirectory() ? 'junction' : 'file'
targetStat
)
}
rimrafSync(source)
Expand Down
0