Socket
Socket
Sign inDemoInstall

@neutrinojs/clean

Package Overview
Dependencies
347
Maintainers
4
Versions
52
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @neutrinojs/clean

Neutrino middleware for cleaning bundle output directories


Version published
Maintainers
4
Install size
2.26 MB
Created

Changelog

Source

v9.5.0

Readme

Source

Neutrino Clean Middleware

@neutrinojs/clean is Neutrino middleware for removing or cleaning build directories.

NPM version NPM downloads

By default, this plugin will remove all files inside webpack's output.path directory, as well as all unused webpack assets after every successful rebuild.

Requirements

  • Node.js 10+
  • Yarn v1.2.1+, or npm v5.4+
  • Neutrino 9
  • webpack 4

Installation

@neutrinojs/clean can be installed via the Yarn or npm clients.

Yarn
❯ yarn add --dev @neutrinojs/clean
npm
❯ npm install --save-dev @neutrinojs/clean

Usage

@neutrinojs/clean can be consumed from the Neutrino API, middleware, or presets. Require this package and plug it into Neutrino:

const clean = require('@neutrinojs/clean');

// Use with default options
neutrino.use(clean());

// Usage shows the default values of this middleware:
neutrino.use(
  clean({
    verbose: neutrino.options.debug,
    // Override pluginId to add an additional clean plugin instance
    pluginId: 'clean',
  }),
);
// Using in .neutrinorc.js
const clean = require('@neutrinojs/clean');

// Use with default options
module.exports = {
  use: [clean()],
};

// Usage shows the default values of this middleware:
module.exports = {
  use: [
    clean({
      verbose: neutrino.options.debug,
      // Override pluginId to add an additional banner plugin instance
      pluginId: 'clean',
    }),
  ],
};

Additional options can be specified to control the behavior of the underlying clean-webpack-plugin. See CleanWebpackPlugin's documentation for available options.

Clean external directories

Pass the dangerouslyAllowCleanPatternsOutsideProject: true option to remove directories outside of the project root. This is disabled by default to prevent deletion of unintended directories.

module.exports = {
  use: [
    clean({
      dangerouslyAllowCleanPatternsOutsideProject: true,
    }),
  ],
};

Customization

@neutrinojs/clean creates some conventions to make overriding the configuration easier once you are ready to make changes.

Plugins

The following is a list of plugins and their identifiers which can be overridden:

NameDescriptionNODE_ENV
cleanRemoves directories before building.all

Contributing

This middleware is part of the neutrino repository, a monorepo containing all resources for developing Neutrino and its core presets and middleware. Follow the contributing guide for details.

Keywords

FAQs

Last updated on 23 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc