Created
April 2, 2014 14:52
-
-
Save thomasboyt/9935811 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
// given a structure of | |
// cwd/ | |
// ..vendor/ | |
// ....my_lib/ | |
// ......foo.js | |
// ..link_sadness.js | |
var fs = require('fs'); | |
fs.symlinkSync(process.cwd() + '/vendor/my_lib', 'my_symlinked_lib'); | |
fs.linkSync('my_symlinked_lib', 'my_hardlinked_lib'); | |
// this will create: | |
// cwd/ | |
// ..vendor/ | |
// ....my_lib/ | |
// ......foo.js | |
// ..my_symlinked_lib symlinked to vendor/my_lib/ | |
// ..my_hardlinked_lib hard linked to my_symlinked_lib/ | |
// ..link_sadness.js | |
// | |
// now, if you `rm -rf my_hard_linked_lib`, it'll become: | |
// cwd/ | |
// ..vendor/ | |
// ....my_lib/ | |
// ..my_symlinked_lib symlinked to vendor/my_lib/ | |
// ..link_sadness.js | |
// | |
// notice that vendor/my_lib/foo.js is gone D: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment