mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
fix if link exists and try to link
This commit is contained in:
parent
3ce53e9dbd
commit
b92df5de51
@ -47,9 +47,16 @@ async function linkSharedResources(pkgJSON, packagePath) {
|
||||
fs.mkdirSync(path.resolve(finalLinkPath, ".."), { recursive: true })
|
||||
}
|
||||
|
||||
fs.symlinkSync(originClassPath, finalLinkPath, "dir")
|
||||
|
||||
console.log(`🔗 Linked resouce [${resource}] to [${finalLinkPath}]`)
|
||||
try {
|
||||
fs.symlinkSync(originClassPath, finalLinkPath, "dir")
|
||||
console.log(`🔗 Linked resouce [${resource}] to [${finalLinkPath}]`)
|
||||
} catch (error) {
|
||||
if (error.code && error.code == 'EEXIST') {
|
||||
fs.unlinkSync(finalLinkPath)
|
||||
fs.symlinkSync(originClassPath, finalLinkPath, "dir")
|
||||
console.log(`🔗 Linked resouce [${resource}] to [${finalLinkPath}]`)
|
||||
}
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
@ -138,4 +145,4 @@ async function main() {
|
||||
console.timeEnd("✅ post-install tooks:")
|
||||
}
|
||||
|
||||
main().catch(console.error)
|
||||
main().catch(console.error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user