CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-filemanager-webpack-plugin

Webpack plugin to copy, archive (.zip), move, delete files and directories before and after builds

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

configuration.mddocs/

Plugin Configuration

Comprehensive configuration options for the FileManager Webpack Plugin, including event handling, execution control, and context management.

Capabilities

Main Configuration Interface

Primary configuration interface for the FileManager Plugin.

/**
 * Main configuration interface for FileManager Plugin
 */
interface FileManagerPluginOptions {
  /** Event-based action configuration */
  events?: {
    /** Actions to execute before Webpack bundling */
    onStart?: Actions | Actions[];
    /** Actions to execute after Webpack bundling */
    onEnd?: Actions | Actions[];
  };
  /** Run tasks in series instead of parallel (default: false) */
  runTasksInSeries?: boolean;
  /** Run tasks only once in watch mode (default: false) */
  runOnceInWatchMode?: boolean;
  /** Base directory for resolving relative paths (default: webpack context) */
  context?: string | null;
  /** Throw error if any action fails (default: false) */
  throwOnError?: boolean;
}

Actions Container

Container interface for all available file operations.

/**
 * Container for all file management actions
 */
interface Actions {
  /** Copy operations */
  copy?: CopyAction[];
  /** Delete operations */
  delete?: DeleteAction[];
  /** Move operations */
  move?: MoveAction[];
  /** Directory creation operations */
  mkdir?: MkdirAction[];
  /** Archive operations */
  archive?: ArchiveAction[];
}

Default Configuration

const defaultOptions: FileManagerPluginOptions = {
  events: {
    onStart: [],
    onEnd: []
  },
  runTasksInSeries: false,
  context: null,
  runOnceInWatchMode: false,
  throwOnError: false
};

Plugin Class

/**
 * Main FileManager Webpack Plugin class
 */
class FileManagerPlugin {
  constructor(options: FileManagerPluginOptions);
  apply(compiler: Compiler): void;
}

Usage Examples:

import FileManagerPlugin from "filemanager-webpack-plugin";

// Basic configuration
const basicPlugin = new FileManagerPlugin({
  events: {
    onEnd: {
      copy: [{ source: './src', destination: './dist' }]
    }
  }
});

// Advanced configuration
const advancedPlugin = new FileManagerPlugin({
  events: {
    onStart: {
      delete: ['./dist']
    },
    onEnd: {
      copy: [{ source: './assets', destination: './dist/assets' }],
      archive: [{ source: './dist', destination: './release.zip' }]
    }
  },
  runTasksInSeries: true,
  runOnceInWatchMode: true,
  context: '/absolute/path/to/project',
  throwOnError: true
});

// Multiple action sets (executed in order)
const orderedPlugin = new FileManagerPlugin({
  events: {
    onEnd: [
      {
        copy: [{ source: './dist/bundle.js', destination: './backup.js' }]
      },
      {
        delete: ['./dist/bundle.js']
      }
    ]
  }
});

Configuration Options Details

Event Configuration

  • onStart: Executed before Webpack begins bundling
    • Note: May execute twice for file changes in watch mode
    • Use runOnceInWatchMode: true to prevent multiple executions
  • onEnd: Executed after Webpack completes bundling

Execution Control

  • runTasksInSeries: When true, tasks within an action run sequentially
  • runOnceInWatchMode: When true, onStart events run only once in watch mode
  • throwOnError: When true, compilation fails if any action fails

Path Resolution

  • context: Absolute path for resolving relative file paths
  • Default: Uses Webpack's context or process.cwd()

docs

archive.md

configuration.md

copy.md

delete.md

index.md

mkdir.md

move.md

tile.json