symlink-dir
Advanced tools
Comparing version 5.1.0 to 5.1.1
@@ -46,3 +46,3 @@ "use strict"; | ||
} | ||
await forceSymlink(src, dest); | ||
await forceSymlink(src, dest, opts); | ||
return { reused: false }; | ||
@@ -68,7 +68,17 @@ case 'EEXIST': | ||
const parentDir = path.dirname(dest); | ||
const ignore = `.ignored_${path.basename(dest)}`; | ||
await renameOverwrite(dest, path.join(parentDir, ignore)); | ||
let warn; | ||
if (opts === null || opts === void 0 ? void 0 : opts.renameTried) { | ||
// This is needed in order to fix a mysterious bug that sometimes happens on macOS. | ||
// It is hard to reproduce and is described here: https://github.com/pnpm/pnpm/issues/5909#issuecomment-1400066890 | ||
await fs_1.promises.unlink(dest); | ||
warn = `Symlink wanted name was occupied by directory or file. Old entity removed: "${parentDir}${path.sep}{${path.basename(dest)}".`; | ||
} | ||
else { | ||
const ignore = `.ignored_${path.basename(dest)}`; | ||
await renameOverwrite(dest, path.join(parentDir, ignore)); | ||
warn = `Symlink wanted name was occupied by directory or file. Old entity moved: "${parentDir}${path.sep}{${path.basename(dest)} => ${ignore}".`; | ||
} | ||
return { | ||
...await forceSymlink(src, dest), | ||
warn: `Symlink wanted name was occupied by directory or file. Old entity moved: "${parentDir}${path.sep}{${path.basename(dest)} => ${ignore}}".`, | ||
...await forceSymlink(src, dest, { ...opts, renameTried: true }), | ||
warn, | ||
}; | ||
@@ -80,3 +90,3 @@ } | ||
await fs_1.promises.unlink(dest); | ||
return await forceSymlink(src, dest); | ||
return await forceSymlink(src, dest, opts); | ||
} | ||
@@ -83,0 +93,0 @@ // for backward compatibility |
{ | ||
"name": "symlink-dir", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "Cross-platform directory symlinking", | ||
@@ -37,4 +37,2 @@ "main": "dist/index.js", | ||
"@types/tape": "^4.13.2", | ||
"mos": "^1.3.1", | ||
"mos-plugin-readme": "^1.0.4", | ||
"rimraf": "^3.0.2", | ||
@@ -65,7 +63,5 @@ "tape": "^5.6.1", | ||
"test": "ts-node test", | ||
"test-md": "mos t", | ||
"premd": "rimraf node_modules/src && npm run tsc", | ||
"md": "mos", | ||
"tsc": "rimraf dist && tsc" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11479
8
107