cf-node-client
momo auto_awesome BUY CLAUDE KIT WITH 20% OFF coffee BUY ME COFFEE

Class: CfIgnoreHelper

CfIgnoreHelper()

CfIgnoreHelper — parses `.cfignore` files and filters file lists. `.cfignore` uses the same syntax as `.gitignore`. This is a lightweight implementation that handles common patterns: - Exact file/directory names - Wildcard patterns (* and **) - Negation patterns (!) - Comments (#) - Directory-only patterns (trailing /)

Constructor

new CfIgnoreHelper()

Source:

Members

_rules :Array.<{pattern: RegExp, negate: Boolean, dirOnly: Boolean}>

Type:
  • Array.<{pattern: RegExp, negate: Boolean, dirOnly: Boolean}>
Source:

Methods

(static) fromDirectory(dirPath) → {CfIgnoreHelper}

Create a CfIgnoreHelper from a directory (looks for .cfignore in it).
Parameters:
Name Type Description
dirPath String Directory to look for .cfignore in
Source:
Returns:
Instance with parsed patterns
Type
CfIgnoreHelper

(static) fromFile(cfIgnorePath) → {CfIgnoreHelper}

Create a CfIgnoreHelper from a .cfignore file path.
Parameters:
Name Type Description
cfIgnorePath String Path to the .cfignore file
Source:
Returns:
Instance with parsed patterns
Type
CfIgnoreHelper

addPatterns(content) → {CfIgnoreHelper}

Parse and add patterns from a .cfignore content string.
Parameters:
Name Type Description
content String .cfignore file content
Source:
Returns:
this (for chaining)
Type
CfIgnoreHelper

filter(filePaths) → {Array.<String>}

Filter a list of file paths, removing ignored ones.
Parameters:
Name Type Description
filePaths Array.<String> Array of relative file paths
Source:
Returns:
Paths that are NOT ignored
Type
Array.<String>

isIgnored(relativePath, isDirectoryopt) → {Boolean}

Check if a relative file path should be ignored.
Parameters:
Name Type Attributes Default Description
relativePath String File path relative to the project root
isDirectory Boolean <optional>
false Whether the path is a directory
Source:
Returns:
True if the path should be ignored
Type
Boolean