find-project-files

0.0.4 • Public • Published

Find project files CircleCI

Finds files in a directory that are not ignored by .gitignore files in the filesystem

Usage

findProjectFiles(rootPath: string, globalIgnorePatterns = [])

const findProjectFiles = require('find-project-files')
 
const files = findProjectFiles('/path/to/git/based/project')
console.info(files) //-> ['index.js', 'foo.js', 'bar.js'...]
 
const filesWithoutFoo =
  findProjectFiles('/path/to/git/based/project', ['foo.js'])
console.info(filesWithoutFoo) //-> ['index.js', 'bar.js'...]
 
const filesWithoutFooBar =
  findProjectFiles('/path/to/git/based/project', ['foo.js', 'bar.js'])
console.info(filesWithoutFooBar) //-> ['index.js'...]

checkIsProjectFilePath(rootPath: string, filePath: string, globalIgnorePatterns = [])

const { checkIsProjectFilePath } = require('find-project-files')
 
const isProjectFile = checkIsProjectFilePath(
  '/path/to/git/based/project',
  '/path/to/git/based/project/index.js'
)
console.info(isProjectFile) //-> true
 
const isIgnoredProjectFile = checkIsProjectFilePath(
  '/path/to/git/based/project',
  '/path/to/git/based/project/ignored.js'
)
console.info(isIgnoredProjectFile) //-> false
 
const isProjectFileExceptFoo = checkIsProjectFilePath(
  '/path/to/git/based/project',
  '/path/to/git/based/project/foo.js',
  ['foo.js']
)
console.info(isProjectFileExceptFoo) //-> false

Readme

Keywords

none

Package Sidebar

Install

npm i find-project-files

Weekly Downloads

4

Version

0.0.4

License

MIT

Unpacked Size

124 kB

Total Files

7

Last publish

Collaborators

  • possibilities