aws-cdk-lib.IgnoreStrategy

class IgnoreStrategy

LanguageType name
.NETAmazon.CDK.IgnoreStrategy
Gogithub.com/aws/aws-cdk-go/awscdk/v2#IgnoreStrategy
Javasoftware.amazon.awscdk.IgnoreStrategy
Pythonaws_cdk.IgnoreStrategy
TypeScript (source)aws-cdk-lib » IgnoreStrategy

Implemented by DockerIgnoreStrategy, GitIgnoreStrategy, GlobIgnoreStrategy

Represents file path ignoring behavior.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const ignoreStrategy = cdk.IgnoreStrategy.fromCopyOptions({
  exclude: ['exclude'],
  follow: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
}, 'absoluteRootPath');

Initializer

new IgnoreStrategy()

Methods

NameDescription
add(pattern)Adds another pattern.
ignores(absoluteFilePath)Determines whether a given file path should be ignored or not.
static docker(absoluteRootPath, patterns)Ignores file paths based on the .dockerignore specification.
static fromCopyOptions(options, absoluteRootPath)Creates an IgnoreStrategy based on the ignoreMode and exclude in a CopyOptions.
static git(absoluteRootPath, patterns)Ignores file paths based on the .gitignore specification.
static glob(absoluteRootPath, patterns)Ignores file paths based on simple glob patterns.

add(pattern)

public add(pattern: string): void

Parameters

  • pattern string

Adds another pattern.


ignores(absoluteFilePath)

public ignores(absoluteFilePath: string): boolean

Parameters

  • absoluteFilePath string — absolute file path to be assessed against the pattern.

Returns

  • boolean

Determines whether a given file path should be ignored or not.


static docker(absoluteRootPath, patterns)

public static docker(absoluteRootPath: string, patterns: string[]): DockerIgnoreStrategy

Parameters

  • absoluteRootPath string — the absolute path to the root directory of the paths to be considered.
  • patterns string[]

Returns

  • DockerIgnoreStrategy

Ignores file paths based on the .dockerignore specification.


static fromCopyOptions(options, absoluteRootPath)

public static fromCopyOptions(options: CopyOptions, absoluteRootPath: string): IgnoreStrategy

Parameters

  • options CopyOptions — the CopyOptions to create the IgnoreStrategy from.
  • absoluteRootPath string — the absolute path to the root directory of the paths to be considered.

Returns

  • IgnoreStrategy

Creates an IgnoreStrategy based on the ignoreMode and exclude in a CopyOptions.


static git(absoluteRootPath, patterns)

public static git(absoluteRootPath: string, patterns: string[]): GitIgnoreStrategy

Parameters

  • absoluteRootPath string — the absolute path to the root directory of the paths to be considered.
  • patterns string[]

Returns

  • GitIgnoreStrategy

Ignores file paths based on the .gitignore specification.


static glob(absoluteRootPath, patterns)

public static glob(absoluteRootPath: string, patterns: string[]): GlobIgnoreStrategy

Parameters

  • absoluteRootPath string — the absolute path to the root directory of the paths to be considered.
  • patterns string[]

Returns

  • GlobIgnoreStrategy

Ignores file paths based on simple glob patterns.