Delete individual files or entire directories with support for glob patterns and comprehensive options from the del package for safe and flexible file removal.
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;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 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
}
}
]
}The plugin uses the del package internally, supporting all its options:
force: true)*, **, ?, [...]dot: trueDelete operations handle errors based on plugin configuration: