Created
January 16, 2017 22:16
-
-
Save cesarandreu/63305adeb4387f279df9018e0595e3fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Symlink aliases into node_modules | |
// Aliases are defined in td-console/config/project.yaml | |
const fs = require('fs') | |
const path = require('path') | |
const { aliases, paths } = require('../config') | |
for (const [name, source] of Object.entries(aliases)) { | |
const destination = path.join(paths.node_modules, name) | |
if (fs.existsSync(destination)) { | |
if (fs.realpathSync(destination) !== source) { | |
throw new Error(`There's already a package "${name}" installed`) | |
} | |
} else { | |
fs.symlinkSync(source, destination, 'junction') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment