Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use a worker for hard linking directories #7154

Merged
merged 9 commits into from
Oct 19, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: hard-link-dir
  • Loading branch information
zkochan committed Oct 5, 2023
commit 0425b90b26f384b24780904744cc2ba2589501c0
6 changes: 4 additions & 2 deletions fs/hard-link-dir/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ function _hardLinkDir (src: string, destDirs: string[], isRoot?: boolean) {
} catch (err: any) { // eslint-disable-line
if (!isRoot || err.code !== 'ENOENT') throw err
globalWarn(`Source directory not found when creating hardLinks for: ${src}. Creating destinations as empty: ${destDirs.join(', ')}`)
destDirs.map((dir) => fs.mkdirSync(dir, { recursive: true }))
for (const dir of destDirs) {
fs.mkdirSync(dir, { recursive: true })
}
return
}
for (const file of files) {
if (file === 'node_modules') continue
const srcFile = path.join(src, file)
if ((fs.lstatSync(srcFile)).isDirectory()) {
if (fs.lstatSync(srcFile).isDirectory()) {
const destSubdirs = destDirs.map((destDir) => {
const destSubdir = path.join(destDir, file)
try {
Expand Down
Loading