or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

archive.mdconfiguration.mdcopy.mddelete.mdindex.mdmkdir.mdmove.md
tile.json

delete.mddocs/

Delete Operations

Delete individual files or entire directories with support for glob patterns and comprehensive options from the del package for safe and flexible file removal.

Capabilities

Delete Action Function

Main delete action function that processes delete tasks.

/**
 * Execute delete tasks with the provided options
 * @param tasks Array of delete tasks to execute
 * @param taskOptions Task execution options including logger and error handling
 */
function deleteAction(tasks: DeleteTask[], taskOptions: TaskOptions): Promise<void>;

export default deleteAction;

Delete Action Configuration

Configuration for delete operations supporting both simple string paths and detailed options.

/**
 * Configuration for delete operations
 * Can be a simple string path or an object with options
 */
type DeleteAction = string | {
  source: string;
  options: DeleteOptions;
};

/**
 * Delete options from the del package
 */
type DeleteOptions = DelOptions;

Internal Task Structure

Internal task structure used by the plugin during delete execution.

/**
 * Internal task structure for delete operations
 */
interface DeleteTask {
  source: string;
  absoluteSource: string;
  options?: DelOptions;
}

Usage Examples:

// Simple file/directory deletion
{
  delete: [
    './dist',
    './temp',
    './logs/*.log'
  ]
}

// Glob pattern deletion
{
  delete: [
    './dist/**/*.tmp',
    './src/**/*.bak',
    './**/node_modules'
  ]
}

// Delete with options
{
  delete: [
    {
      source: './dist',
      options: {
        force: true      // Allow deletion outside current working directory
      }
    },
    {
      source: './**/*.log',
      options: {
        dryRun: true     // Show what would be deleted without actually deleting
      }
    }
  ]
}

// Mixed simple and detailed deletion
{
  delete: [
    './temp',           // Simple deletion
    {
      source: './cache/**/*',
      options: {
        dot: true,      // Include hidden files
        force: true
      }
    }
  ]
}

Delete Options (from del package)

The plugin uses the del package internally, supporting all its options:

Common Options

  • force (boolean): Allow deletion outside current working directory
  • dryRun (boolean): Show what would be deleted without actually deleting
  • dot (boolean): Include files/directories starting with a dot
  • concurrency (number): Number of concurrent operations (default: Infinity)
  • expandDirectories (boolean): Expand directories to include all files
  • onlyFiles (boolean): Only delete files, not directories
  • onlyDirectories (boolean): Only delete directories, not files
  • ignore (string[]): Glob patterns to ignore

Advanced Options

  • followSymbolicLinks (boolean): Follow symbolic links
  • throwErrorOnBrokenSymbolicLink (boolean): Throw error for broken symbolic links
  • suppressErrors (boolean): Suppress errors for non-existent files

Safety Features

Built-in Protections

  • Prevents deletion outside project context (unless force: true)
  • Supports dry-run mode for testing deletion patterns
  • Graceful error handling with optional error suppression

Glob Pattern Support

  • Standard glob patterns: *, **, ?, [...]
  • Negation patterns for exclusions
  • Hidden file inclusion with dot: true

Error Handling

Delete operations handle errors based on plugin configuration:

  • throwOnError: false (default): Log errors but continue execution
  • throwOnError: true: Fail compilation on deletion errors
  • suppressErrors: true: Suppress individual file errors