Skip to content

Instantly share code, notes, and snippets.

@thecrypticace
Last active January 22, 2017 23:58
Show Gist options
  • Save thecrypticace/ec8db5908113a08921f83d5f6a2d7290 to your computer and use it in GitHub Desktop.
Save thecrypticace/ec8db5908113a08921f83d5f6a2d7290 to your computer and use it in GitHub Desktop.
Fix yarn transitive dependency binaries
#!/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