Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/popomore/resolve-files
Get all files from the given entry that resolved by `require`
https://github.com/popomore/resolve-files
Last synced: 3 months ago
JSON representation
Get all files from the given entry that resolved by `require`
- Host: GitHub
- URL: https://github.com/popomore/resolve-files
- Owner: popomore
- License: mit
- Created: 2017-03-07T12:00:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-03T12:04:03.000Z (over 7 years ago)
- Last Synced: 2024-10-05T01:01:35.639Z (3 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# resolve-files
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url][npm-image]: https://img.shields.io/npm/v/resolve-files.svg?style=flat-square
[npm-url]: https://npmjs.org/package/resolve-files
[travis-image]: https://img.shields.io/travis/popomore/resolve-files.svg?style=flat-square
[travis-url]: https://travis-ci.org/popomore/resolve-files
[codecov-image]: https://codecov.io/gh/popomore/resolve-files/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/popomore/resolve-files
[david-image]: https://img.shields.io/david/popomore/resolve-files.svg?style=flat-square
[david-url]: https://david-dm.org/popomore/resolve-files
[snyk-image]: https://snyk.io/test/npm/resolve-files/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/resolve-files
[download-image]: https://img.shields.io/npm/dm/resolve-files.svg?style=flat-square
[download-url]: https://npmjs.org/package/resolve-filesGet all files from the given entry that resolved by `require`
## Usage
There are files in npm packages
```
|- package.json
|- index.js
`- lib
`- index.js
```And `index.js` requires `lib/index.js`, you can use `resolve-files` to get all files.
```js
const resolve = require('resolve-files');
const result = resolve({ cwd: process.cwd() });
// =>
// [
// '$BASEDIR/index.js',
// '$BASEDIR/lib/index.js',
// ]
```It will resolve the entry
Normally, the result will include npm modules, but you can give an options `ignoreModules: true` to ignore modules (only return relative files).
## License
[MIT](LICENSE)