Skip to content

Instantly share code, notes, and snippets.

@Rokt33r

Rokt33r/linkDir.js

Created May 7, 2017
Embed
What would you like to do?
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
You can’t perform that action at this time.