1 | # Neutrino Clean Middleware
|
2 |
|
3 | `neutrino-middleware-clean` is Neutrino middleware for removing directories before building.
|
4 |
|
5 | [![NPM version][npm-image]][npm-url]
|
6 | [![NPM downloads][npm-downloads]][npm-url]
|
7 | [![Join the Neutrino community on Spectrum][spectrum-image]][spectrum-url]
|
8 |
|
9 | ## Requirements
|
10 |
|
11 | - Node.js v6.10+
|
12 | - Yarn or npm client
|
13 | - Neutrino v7
|
14 |
|
15 | ## Installation
|
16 |
|
17 | `neutrino-middleware-clean` can be installed via the Yarn or npm clients.
|
18 |
|
19 | #### Yarn
|
20 |
|
21 | ```bash
|
22 | ❯ yarn add neutrino-middleware-clean
|
23 | ```
|
24 |
|
25 | #### npm
|
26 |
|
27 | ```bash
|
28 | ❯ npm install --save neutrino-middleware-clean
|
29 | ```
|
30 |
|
31 | ## Usage
|
32 |
|
33 | `neutrino-middleware-clean` can be consumed from the Neutrino API, middleware, or presets. Require this package
|
34 | and plug it into Neutrino:
|
35 |
|
36 | ```js
|
37 | // Using function middleware format
|
38 | const clean = require('neutrino-middleware-clean');
|
39 |
|
40 | // Use with default options
|
41 | neutrino.use(clean);
|
42 |
|
43 | // Usage shows the default values of this middleware:
|
44 | neutrino.use(clean, {
|
45 | paths: [],
|
46 | root: neutrino.options.root
|
47 | });
|
48 | ```
|
49 |
|
50 | ```js
|
51 | // Using object or array middleware format
|
52 |
|
53 | // Use with default options
|
54 | module.exports = {
|
55 | use: ['neutrino-middleware-clean']
|
56 | };
|
57 |
|
58 | // Usage shows the default values of this middleware:
|
59 | module.exports = {
|
60 | use: [
|
61 | ['neutrino-middleware-clean', {
|
62 | paths: [],
|
63 | root: neutrino.options.root
|
64 | }]
|
65 | ]
|
66 | };
|
67 | ```
|
68 |
|
69 | ## Customization
|
70 |
|
71 | `neutrino-middleware-clean` creates some conventions to make overriding the configuration easier once you are ready to
|
72 | make changes.
|
73 |
|
74 | ### Plugins
|
75 |
|
76 | The following is a list of plugins and their identifiers which can be overridden:
|
77 |
|
78 | | Name | Description | Environments and Commands |
|
79 | | --- | --- | --- |
|
80 | | `clean` | Removes directories before building. | all |
|
81 |
|
82 | ## Contributing
|
83 |
|
84 | This middleware is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
|
85 | containing all resources for developing Neutrino and its core presets and middleware. Follow the
|
86 | [contributing guide](https://neutrino.js.org/contributing) for details.
|
87 |
|
88 | [npm-image]: https://img.shields.io/npm/v/neutrino-middleware-clean.svg
|
89 | [npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-clean.svg
|
90 | [npm-url]: https://npmjs.org/package/neutrino-middleware-clean
|
91 | [spectrum-image]: https://withspectrum.github.io/badge/badge.svg
|
92 | [spectrum-url]: https://spectrum.chat/neutrino
|