Link Directory
const fs = require('fs') | |
const path = require('path') | |
const moduleMap = [ | |
'base' | |
] | |
function link (modulePath) { | |
const sourcePath = path.join(__dirname, '..', modulePath) | |
const targetPath = path.join(__dirname, '../node_modules', modulePath) | |
try { | |
// throw if the link doesn't exist yet. | |
fs.statSync(targetPath) | |
fs.unlinkSync(targetPath) | |
} catch (err) { | |
} | |
// create link | |
fs.symlinkSync(sourcePath, targetPath, 'dir') | |
} | |
moduleMap.forEach(link) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment