Socket
Socket
Sign inDemoInstall

@cspell/cspell-pipe

Package Overview
Dependencies
Maintainers
1
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cspell/cspell-pipe

Library to make working with Iterators/AsyncIterators easier.


Version published
Weekly downloads
620K
increased by16.22%
Maintainers
1
Weekly downloads
 
Created
Source

@cspell/cspell-pipe

A library to assist with working with Iterables and AsyncIterables

Install

npm install -S @cspell/cspell-pipe

Usage

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:

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

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:

$ cspell-gitignore -r . node_modules
.gitignore:58:node_modules/       node_modules

Keywords

FAQs

Package last updated on 15 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc