NPM.Ignore (NPM v0.6.0)

Copy Markdown View Source

Parses .npmignore and .gitignore files for package publishing.

Determines which files to include/exclude when packing or publishing a package, following npm's ignore rules.

Summary

Functions

Returns the list of always-ignored paths.

Gets the effective ignore patterns for a package directory.

Checks if a file path is ignored by the given patterns.

Returns the list of never-ignored paths.

Parses ignore file content into a list of patterns.

Reads and parses an ignore file.

Functions

always_ignored()

@spec always_ignored() :: [String.t()]

Returns the list of always-ignored paths.

effective_patterns(package_dir)

@spec effective_patterns(String.t()) :: [String.t()]

Gets the effective ignore patterns for a package directory.

Checks .npmignore first, falls back to .gitignore.

ignored?(path, patterns)

@spec ignored?(String.t(), [String.t()]) :: boolean()

Checks if a file path is ignored by the given patterns.

never_ignored()

@spec never_ignored() :: [String.t()]

Returns the list of never-ignored paths.

parse(content)

@spec parse(String.t()) :: [String.t()]

Parses ignore file content into a list of patterns.

read(path)

@spec read(String.t()) :: [String.t()]

Reads and parses an ignore file.