1 | # packmule core [![npm-latest]][npm]
|
2 |
|
3 | > Stubborn configuration generator for Webpack.
|
4 |
|
5 | ## Overview
|
6 |
|
7 | - [Setup](#setup)
|
8 | - [API](#api)
|
9 | - [License](#license)
|
10 |
|
11 | ## Setup
|
12 |
|
13 | Either install `@packmule/core` and needed packs individually
|
14 | or install one of the available packmule editions which bundle
|
15 | various packages/packs for faster usage.
|
16 |
|
17 | **Current Release**
|
18 |
|
19 | ```bash
|
20 | npm install --save-dev @packmule/core
|
21 | ```
|
22 |
|
23 | **Nightly Build**
|
24 |
|
25 | ```bash
|
26 | npm install --save-dev @packmule/core@nightly
|
27 | ```
|
28 |
|
29 | ## API
|
30 |
|
31 | ### Methods
|
32 |
|
33 | **Packmule(mode?: 'development' | 'production' | 'none', options?: `Options`, hints?: `Hints`)**
|
34 | _Instantiate a new packmule object._
|
35 |
|
36 | **add(pack: `Pack`, hints?: `Hints`)**
|
37 | _Add a pack for configuration generation._
|
38 |
|
39 | **remove(pack: `Pack`)**
|
40 | _Remove a pack from configuration generation._
|
41 |
|
42 | **generate(pack?: `Pack`, hints?: `Hints`)**
|
43 | _Generate the final webpack configuration or optionally the configuration for a specific pack instance._
|
44 |
|
45 | ### Options
|
46 |
|
47 | | Option | Type | Default | Description |
|
48 | | --------- | --------- | -------- | -------------------------------- |
|
49 | | **mode** | `string` | `'none'` | Sets the mode for webpack. |
|
50 | | **root** | `string` | `cwd` | Sets the project root directory. |
|
51 | | **debug** | `boolean` | `false` | Enables debugging. |
|
52 |
|
53 | ### Hints
|
54 |
|
55 | Hints are passed to and used by packs to indicate which internal tasks to run.
|
56 | Packs can choose which hints to use i.e. packs often use a small subset of available hints.
|
57 |
|
58 | | Hint | Description |
|
59 | | ------------ | ------------------------------ |
|
60 | | **optimize** | Enables optimization steps. |
|
61 | | **extract** | Enables file extraction. |
|
62 | | **notify** | Enables desktop notifications. |
|
63 | | **lint** | Enables code linting. |
|
64 | | **fix** | Enables code fixing. |
|
65 | | **map** | Enables source maps. |
|
66 | | **cache** | Enables caching. |
|
67 | | **hash** | Enables filename hashing. |
|
68 | | **watch** | Enables file watching. |
|
69 |
|
70 | ### Presets
|
71 |
|
72 | Each mode (none, development, production) has an internal hints preset, e.g.
|
73 | for `production` mode the options `optimize`, `extract` and `hash` are enabled
|
74 | while all other hints are disabled. Hints can be overridden by passing them
|
75 | to the constructor directly.
|
76 |
|
77 | | Hint | none | development | production |
|
78 | | ------------ | ------- | ----------- | ---------- |
|
79 | | **optimize** | `false` | `false` | `true` |
|
80 | | **extract** | `false` | `false` | `true` |
|
81 | | **notify** | `false` | `true` | `false` |
|
82 | | **lint** | `false` | `true` | `false` |
|
83 | | **fix** | `false` | `true` | `false` |
|
84 | | **map** | `false` | `true` | `false` |
|
85 | | **cache** | `false` | `true` | `false` |
|
86 | | **hash** | `false` | `false` | `true` |
|
87 | | **watch** | `false` | `false` | `false` |
|
88 |
|
89 | ## License
|
90 |
|
91 | [MIT](https://choosealicense.com/licenses/mit/)
|
92 |
|
93 | ---
|
94 |
|
95 | [<img src="https://avatars.githubusercontent.com/u/4364197?s=64">](https://www.pixelart.at/)
|
96 |
|
97 | [npm]: https://www.npmjs.com/package/@packmule/core
|
98 | [npm-latest]: https://img.shields.io/npm/v/@packmule/core/latest?color=%230AC2FF&label=release&style=for-the-badge
|