find() should work like find(1)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 756
- PR merge metrics
- No merged PRs in 30d
Description
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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the sh.find API entry point referenced in the issue and inspect how its current path matching works. Compare the requested find('*/package.json') behavior with the documented find interface, then verify that matching package files produces the expected directory paths and that existing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100