Skip to content

Commit 044bfd4

Browse files
committed
chore: add readme
1 parent c17c4b0 commit 044bfd4

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# terser-config-atomic
2+
3+
The Terser configuration used in atom-community.
4+
5+
## Installation
6+
7+
```
8+
npm install --save-dev terser-config-atomic
9+
```
10+
11+
<details>
12+
<summary>This package also needs `Terser`.</summary>
13+
14+
Either add the following to your `.npmrc` if using `pnpm` to hoist the Terser bundled with the config
15+
16+
```
17+
public-hoist-pattern[]=*
18+
```
19+
20+
Or install `terser` yourself in your `devDependencies`.
21+
22+
If using `npm`, the terser dependency is hoisted automatically.
23+
24+
If you use `Parcel` or `rullup-plugin-atomic`, `Terser` is already included.
25+
26+
</details>
27+
28+
## Usage
29+
30+
Create a `.terserrc.js` with the following content
31+
32+
.terserrc.js
33+
34+
```js
35+
module.exports = require("terser-config-atomic")
36+
```
37+
38+
The config is adapted based on `NODE_ENV`, so make sure to run your scripts with the correct `NODE_ENV`:
39+
40+
- test: `cross-env NODE_ENV=test your_test_script`
41+
- development: `cross-env NODE_ENV=development your_dev_script`
42+
- production: `cross-env NODE_ENV=production your_prod_script`
43+
44+
**Node**: [`cross-env`](https://www.npmjs.com/package/cross-env) is an npm package that you need to install.
45+
46+
## Modifying the config
47+
48+
To change the config use the following pattern:
49+
50+
.terserrc.js
51+
52+
```js
53+
const TerserAtomic = require("terser-config-atomic")
54+
55+
module.exports = {
56+
...TerserAtomic,
57+
// your config here
58+
}
59+
```
60+
61+
To change the deep properties such as `compress`, use the following pattern as an example:
62+
63+
```js
64+
const TerserAtomic = require("terser-config-atomic")
65+
66+
module.exports = {
67+
...TerserAtomic,
68+
compress: {
69+
...TerserAtomic.compress,
70+
ecma: 2020,
71+
},
72+
}
73+
```

0 commit comments

Comments
 (0)