Skip to content

Commit 5bc0cc5

Browse files
committed
fix: rename to builTerserOptions + add missing deps
1 parent e77e7a3 commit 5bc0cc5

9 files changed

Lines changed: 60 additions & 47 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ The config is adapted based on `NODE_ENV`, so make sure to run your scripts with
4848
You can import the builder function to create a custom config:
4949

5050
```ts
51-
import { getTerserOptions } from "terser-config-atomic/dist/index.js"
52-
module.exports = getTerserOptions(process.env.NODE_ENV, process.env.BABEL_ENV)
51+
import { buildTerserOptions } from "terser-config-atomic/dist/builder.js"
52+
module.exports = buildTerserOptions(process.env.NODE_ENV, process.env.BABEL_ENV)
5353
```
5454

5555
The builder function:
@@ -62,7 +62,7 @@ The builder function:
6262
@param BABEL_ENV - The Babel environment (defaults to NODE_ENV).
6363
@param unsafeCompress - Whether to use unsafe compression options (defaults to false).
6464
*/
65-
export function getTerserOptions(
65+
export function buildTerserOptions(
6666
NODE_ENV: string = "production",
6767
BABEL_ENV: string | undefined = undefined,
6868
unsafeCompress: boolean = false,

__tests__/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import assert from "assert"
2-
import { getTerserOptions } from "../src"
2+
import { buildTerserOptions } from "../src/builder"
33

44
describe("Terser-Config-Atomic", () => {
55
it("production", () => {
6-
const TerserOptions = getTerserOptions("production", undefined)
6+
const TerserOptions = buildTerserOptions("production", undefined)
77

88
expect(typeof TerserOptions).toBe("object")
99
assert(typeof TerserOptions.compress === "object")
@@ -20,7 +20,7 @@ describe("Terser-Config-Atomic", () => {
2020
it("development", () => {
2121
process.env.NODE_ENV = "development"
2222

23-
const TerserOptions = getTerserOptions("development", undefined)
23+
const TerserOptions = buildTerserOptions("development", undefined)
2424

2525
expect(typeof TerserOptions).toBe("object")
2626
expect(TerserOptions.compress).toBe(false)
@@ -30,7 +30,7 @@ describe("Terser-Config-Atomic", () => {
3030
it("test", () => {
3131
process.env.NODE_ENV = "test"
3232

33-
const TerserOptions = getTerserOptions("test", undefined)
33+
const TerserOptions = buildTerserOptions("test", undefined)
3434

3535
expect(typeof TerserOptions).toBe("object")
3636
assert(typeof TerserOptions.compress === "object")

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "terser-config-atomic",
3-
"dist": "./dist/.terserrc.js",
3+
"main": "dist/terserrc.js",
44
"version": "0.1.1",
55
"files": [
6-
"src"
6+
"src",
7+
"dist"
78
],
89
"author": "Amin Yahyaabadi",
910
"description": "The Terser configuration used in atom-community",
@@ -16,7 +17,7 @@
1617
"repository": "https://github.com/atom-community/terser-config-atomic",
1718
"license": "MIT",
1819
"scripts": {
19-
"build": "tsc",
20+
"build": "tsc -p tsconfig.build.json",
2021
"prepublishOnly": "npm run build",
2122
"format": "prettier --write .",
2223
"test.format": "prettier . --check",
@@ -29,11 +30,13 @@
2930
"devDependencies": {
3031
"@swc/jest": "^0.2.29",
3132
"@types/jest": "^29.5.4",
33+
"@types/node": "^20.5.9",
3234
"eslint": "^8.48.0",
3335
"eslint-config-atomic": "^1.19.3",
3436
"jest": "^29.6.4",
3537
"prettier": "^3.0.3",
3638
"prettier-config-atomic": "^3.1.0",
37-
"ts-node": "^10.9.1"
39+
"ts-node": "^10.9.1",
40+
"typescript": "^5.2.2"
3841
}
3942
}

pnpm-lock.yaml

Lines changed: 38 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/.terserrc.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/index.ts renamed to src/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@param BABEL_ENV - The Babel environment (defaults to NODE_ENV).
66
@param unsafeCompress - Whether to use unsafe compression options (defaults to false).
77
*/
8-
export function getTerserOptions(
8+
export function buildTerserOptions(
99
NODE_ENV: string = "production",
1010
BABEL_ENV: string | undefined = undefined,
1111
unsafeCompress: boolean = false,

src/terserrc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { buildTerserOptions } from "./builder.js"
2+
module.exports = buildTerserOptions(process.env.NODE_ENV, process.env.BABEL_ENV)

tsconfig.build.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["./src/"]
4+
}

0 commit comments

Comments
 (0)