File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -106,10 +106,24 @@ module.exports = function(options) {
106106 return runner ;
107107} ;
108108
109+ function lookupBin ( binMap , framework ) {
110+ let binPath = binMap [ framework ] ;
111+ if ( ! binPath ) {
112+ const firstBin = Object . keys ( binMap ) [ 0 ]
113+ if ( ! firstBin ) {
114+ throw new Error ( `No bin file provided in framework ${ framework } 's package.json.` ) ;
115+ }
116+ binPath = binMap [ firstBin ] ;
117+ }
118+ return binPath
119+ }
120+
109121function lookupFramework ( framework , filepath ) {
110122 try {
111- let frameworkBin = require . resolve ( path . join ( filepath , framework ) ) ;
112- frameworkBin = path . join ( path . dirname ( frameworkBin ) , 'bin' , framework ) ;
123+ const pkgPath = path . join ( filepath , framework , 'package.json' ) ;
124+ const frameworkPkgDir = path . dirname ( require . resolve ( pkgPath ) ) ;
125+ const frameworkAbsBin = lookupBin ( require ( pkgPath ) [ 'bin' ] , framework ) ;
126+ const frameworkBin = path . join ( frameworkPkgDir , frameworkAbsBin ) ;
113127 // ensure framework exists.
114128 fs . accessSync ( frameworkBin ) ;
115129 return frameworkBin ;
You can’t perform that action at this time.
0 commit comments