npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fnet/rollup-plugin-delete

v0.1.10

Published

Rollup plugin to delete files and folders

Downloads

72

Readme

@fnet/rollup-plugin-delete

The @fnet/rollup-plugin-delete is a plugin designed for Rollup, a JavaScript module bundler. Its main purpose is to clean up unnecessary files and folders during the build process by automatically deleting specified targets. This functionality helps maintain a tidy project structure and prevent clutter, especially in continuous integration or build pipelines.

How It Works

The plugin hooks into the Rollup build process and deletes specified files or directories. It can be configured to run just once or every time the build is executed. By specifying targets in the configuration, users can automate the cleanup of files or folders as part of their rollup build process.

Key Features

  • Configurable Execution: Decide whether the plugin should run every build or only once by setting the runOnce option.
  • Target Specification: Specify files or directories to delete during the build using the targets option.
  • Verbose Output: Enable detailed logging to the console with the verbose option, helping track what files are deleted.
  • Dry Run Option: Utilize the dryRun mode to check potential deletions without actually removing files, allowing for safe testing of configurations.

Conclusion

The @fnet/rollup-plugin-delete provides a simple yet effective way to manage file and folder clean-up in Rollup-based projects. By automating the deletion process, it ensures that only relevant files remain, aiding in project organization and simplifying build routines.

@fnet/rollup-plugin-delete Developer Guide

Overview

The @fnet/rollup-plugin-delete is a Rollup plugin designed to help developers automatically delete files or directories during the build process. It offers a straightforward way to clean up build artifacts without manual intervention. This plugin can be particularly useful for maintaining a tidy project directory by removing unnecessary files before or after a build.

Installation

To install the @fnet/rollup-plugin-delete library, use either npm or yarn:

npm install @fnet/rollup-plugin-delete --save-dev

or

yarn add @fnet/rollup-plugin-delete --dev

Usage

Integrate the plugin into your Rollup configuration file. Below is a simple example demonstrating how to use it within a typical Rollup setup:

import deletePlugin from '@fnet/rollup-plugin-delete';

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    deletePlugin({
      targets: ['dist/*'], // Specify files or folders to delete
      runOnce: true,       // Only delete the specified targets once
      verbose: true        // Log deletions to the console
    })
  ]
};

Options

  • targets: An array of strings specifying the files or directories to delete.
  • runOnce: A boolean indicating whether the plugin should execute only once per build session. Defaults to false.
  • verbose: Enable this option to log details of deleted files to the console. Defaults to false.

Examples

Basic Usage

To delete all files within the dist directory before each build:

deletePlugin({
  targets: ['dist/*'],
  verbose: true
});

Run Once Option

To ensure that the deletion only occurs once per build session:

deletePlugin({
  targets: ['build/cache'],
  runOnce: true
});

Dry Run

Perform a dry run to output which files would be deleted without actually removing them:

deletePlugin({
  targets: ['temp/*'],
  verbose: true,
  dryRun: true
});

Acknowledgement

No additional acknowledgments are required for this plugin. It is designed to seamlessly integrate into your Rollup setup and automatically manage file cleanup tasks.

This guide aims to clarify how to effectively use the @fnet/rollup-plugin-delete plugin in your Rollup projects, ensuring a clean and manageable build environment.

Input Schema

$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
  runOnce:
    type: boolean
    description: Whether the plugin should run only once
    default: false
  targets:
    type: array
    items:
      type: string
    description: Files or folders to delete
    default: []
  verbose:
    type: boolean
    description: Whether to log details to the console
    default: false
  dryRun:
    type: boolean
    description: If true, simulates the deletion without actual file removal
required: []