Last active
January 22, 2017 23:58
-
-
Save thecrypticace/ec8db5908113a08921f83d5f6a2d7290 to your computer and use it in GitHub Desktop.
Fix yarn transitive dependency binaries
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 php | |
<?php | |
file_exists("node_modules/.bin") || mkdir("node_modules/.bin"); | |
chdir("node_modules/.bin"); | |
foreach (glob("../*/bin/*") as $file) { | |
if (! is_executable($file)) { | |
continue; | |
} | |
$file = (object) ["path" => $file, "link" => "./" . basename($file, ".js")]; | |
echo "\n{$file->link}\n"; | |
echo "- linking to {$file->path}\n"; | |
is_link($file->link) || symlink($file->path, $file->link); | |
echo "- making executable\n"; | |
is_executable($file->link) || chmod($file->link, 0755); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment