Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ignore-walk

npm45.1mISC7.0.0TypeScript support: definitely-typed

Nested/recursive .gitignore/.npmignore parsing and filtering.

ignorefile, ignore, file, .gitignore, .npmignore, glob

readme

ignore-walk

Nested/recursive .gitignore/.npmignore parsing and filtering.

Walk a directory creating a list of entries, parsing any .ignore files met along the way to exclude files.

USAGE

const walk = require('ignore-walk')

// All options are optional, defaults provided.

// this function returns a promise, but you can also pass a cb
// if you like that approach better.
walk({
  path: '...', // root dir to start in. defaults to process.cwd()
  ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore']
  includeEmpty: true|false, // true to include empty dirs, default false
  follow: true|false // true to follow symlink dirs, default false
}, callback)

// to walk synchronously, do it this way:
const result = walk.sync({ path: '/wow/such/filepath' })

If you want to get at the underlying classes, they're at walk.Walker and walk.WalkerSync.

OPTIONS

  • path The path to start in. Defaults to process.cwd()

  • ignoreFiles Filenames to treat as ignore files. The default is ['.ignore']. (This is where you'd put .gitignore or .npmignore or whatever.) If multiple ignore files are in a directory, then rules from each are applied in the order that the files are listed.

  • includeEmpty Set to true to include empty directories, assuming they are not excluded by any of the ignore rules. If not set, then this follows the standard git behavior of not including directories that are empty.

    Note: this will cause an empty directory to be included if it would contain an included entry, even if it would have otherwise been excluded itself.

    For example, given the rules * (ignore everything) and !/a/b/c (re-include the entry at /a/b/c), the directory /a/b will be included if it is empty.

  • follow Set to true to treat symbolically linked directories as directories, recursing into them. There is no handling for nested symlinks, so ELOOP errors can occur in some cases when using this option. Defaults to false.

changelog

Changelog

7.0.0 (2024-09-03)

⚠️ BREAKING CHANGES

  • ignore-walk now supports node ^18.17.0 || >=20.5.0

    Bug Fixes

  • 0379dab #142 align to npm 10 node engine range (@hashtagchris)

    Chores

  • 7575014 #142 run template-oss-apply (@hashtagchris)
  • dce54bb #140 bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])
  • 38ac197 #141 postinstall for dependabot template-oss PR (@hashtagchris)
  • 40cc562 #141 bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot])

6.0.5 (2024-05-04)

Bug Fixes

Chores

  • c3ed705 #127 bump @npmcli/template-oss to 4.22.0 (@lukekarrys)
  • 477a720 #121 chore: chore: postinstall for dependabot template-oss PR (@lukekarrys)
  • f5919cc #114 template-oss-apply (@dependabot[bot])
  • ce00723 #127 postinstall for dependabot template-oss PR (@lukekarrys)
  • f77a3dc #126 bump @npmcli/template-oss from 4.21.3 to 4.21.4 (@dependabot[bot])

6.0.4 (2023-11-29)

Bug Fixes

  • b587cc3 handling of nested unignores (#119) (@mohd-akram)
  • 493401a recursive directory ignore rules (#118) (@wraithgar, @LinqLover)
  • 0bb0972 #116 disallow child unignoring parent directory ignore (#116) (@mohd-akram)

6.0.3 (2023-04-26)

Dependencies

  • 6446cd2 #83 bump minimatch from 7.4.6 to 9.0.0 (#83)

6.0.2 (2023-03-21)

Dependencies

  • 7a459ad #78 bump minimatch from 6.2.0 to 7.4.2 (#78)

6.0.1 (2023-02-07)

Dependencies

6.0.0 (2022-10-10)

⚠️ BREAKING CHANGES

  • ignore-walk is now compatible with the following semver range for node: ^14.17.0 || ^16.13.0 || >=18.0.0

Features

  • e723a53 #43 postinstall for dependabot template-oss PR (@lukekarrys)

5.0.1 (2022-04-06)

Bug Fixes

  • trim ignore rules before matching (#28) (e6a9acc)

5.0.0 (2022-04-05)

⚠ BREAKING CHANGES

  • this drops support for node 10 and non-LTS versions of node 12 and node 14

Bug Fixes

  • replace deprecated String.prototype.substr() (#27) (a173abe)

Documentation

Dependencies