@cspell/cspell-pipe
Advanced tools
Comparing version 6.14.0 to 6.14.1
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "6.14.0", | ||
"version": "6.14.1", | ||
"description": "Library to make working with Iterators/AsyncIterators easier.", | ||
@@ -118,3 +118,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "9f5274766ae9e1e4796a7c10b78db4d98f04ea42" | ||
"gitHead": "35db1ed216cd9aaf479429d3268482f30d824e70" | ||
} |
@@ -10,62 +10,1 @@ # `@cspell/cspell-pipe` | ||
``` | ||
## Usage | ||
```ts | ||
import { GitIgnore, findRepoRoot } from 'cspell-gitignore'; | ||
// ... | ||
const cwd = process.cwd(); | ||
const root = (await findRepoRoot(cwd)) || cwd; | ||
const gitIgnore = new GitIgnore([root]); | ||
const allFiles = glob('**'); | ||
const files = await gitIgnore.filterOutIgnored(allFiles); | ||
``` | ||
## Logic | ||
- For each file, search for the `.gitignore` files in the directory hierarchy. | ||
- Ignore any files that match the globs found in the `.gitignore` files. | ||
The `.gitignore` globs are evaluated from highest to lowest, matching the `git` behavior. | ||
To prevent searching higher in the directory hierarchy, specify roots: | ||
```ts | ||
const gitIgnore = new GitIgnore([process.cwd()]); | ||
``` | ||
# `cspell-gitignore` CLI | ||
`cspell-gitignore` provides a simple cli for debugging .gitignore issues. | ||
In most cases it should provide the same output as `git check-ignore`. | ||
## Usage | ||
```text | ||
Usage cspell-gitignore [options] <files> | ||
Check files against .gitignore | ||
Compare against git check-ignore -v -n <files> | ||
Options: | ||
-r, --root Add a root to prevent searching for .gitignore files above the root if the file is under the root. | ||
This option can be used multiple times to add multiple roots. The default root is the current | ||
repository root determined by the `.git` directory. | ||
Example: | ||
cspell-gitignore README.md | ||
cspell-gitignore -r . node_modules | ||
``` | ||
## Example: | ||
```sh | ||
$ cspell-gitignore -r . node_modules | ||
.gitignore:58:node_modules/ node_modules | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53164
10