Skip to content
Myr

fix #335

Before adoption: this commit came in with the history the project adopted, so no landing records it.

fix Subcommands not found when installed globally

authored by zhiyelee · committed by zhiyelee · parent 6135fbc · Browse files · 2 files+38 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+38 added−14 removed

  • other:+38 added−14 removed

2 files+38 added−14 removed

modified:index.js+8 added-2 removed
3 unmodified lines
4 */56var EventEmitter = require('events').EventEmitter;7var spawn = require('child_process').spawn;8var readlink = require('graceful-readlink').readlinkSync;9var path = require('path');10var dirname = path.dirname;11var basename = path.basename;12var fs = require('fs');
454 unmodified lines
467 args[1] = '--help';468 }469470 // executable471 var f = argv[1];472 var link = readlink(f);473 if (link.indexOf('.') === 0) {474 link = path.join(dirname(f), link)475 }470 var dir = dirname(argv[1]);471 var bin = basename(argv[1], '.js') + '-' + args[0];476 var dir = dirname(link);477 var bin = basename(f, '.js') + '-' + args[0];478479 // prefer local `./<bin>` to bin in the $PATH480 var local = path.join(dir, bin);481 try {
570 unmodified lines
modified:package.json+30 added-12 removed