shelljs/shelljs

find() should work like find(1)

開放

#114 建立於 2014年4月4日

 (1 則留言) (0 個反應) (0 位負責人)JavaScript (752 個分叉)batch import
bash compatfixhelp wantedlow priority

倉庫指標

星標
 (14,399 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

I expected the following to work... but took a look at the docs and require('shelljs').find quite a bit different than I expected.

Here is what I'm trying to do:

// find all directories in the cwd that have a package.json
var sh = require('shelljs');
var packages = sh.find('*/package.json').map((f) => {
 return path.dirname(f)
}); 

This is obviously not possible with sh.find. You have to do something like

sh.find('.').filter((p) => {
  return path.dirname(p) === cwd
      && path.filename(p) === 'package.json'
});

Would be nice if it supported the same functionality as find(1).

貢獻者指南