Skip to content

Commit f30e8d9

Browse files
committed
feat: Add Terser
1 parent ff2fa0a commit f30e8d9

File tree

8 files changed

+73
-19
lines changed

8 files changed

+73
-19
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
- name: Build
2121
run: pnpm build
2222

23+
- name: Prepare Pack
24+
run: cp package.json README.md dist/ && cd dist
25+
2326
- uses: actions/setup-node@v2
2427
with:
2528
node-version: 14

.npmignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.*.swp
33
._*
44
.DS_Store
5-
.git
5+
.git*
66
.hg
77
.npmrc
88
.lock-wscript
@@ -14,3 +14,9 @@ npm-debug.log
1414
*.log
1515
*.test.js
1616
*.spec.js
17+
coverage
18+
.vscode
19+
.github
20+
.editorconfig
21+
.eslintignore
22+
.eslintrc

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ example();
7575
<body>
7676
<h1>Example</h1>
7777

78-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].6"></script>
78+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].9/usingTryCatch.js"></script>
7979
<script>
8080
document.addEventListener('DOMContentLoaded', function loaded() {
8181

package.json

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
{
2-
"version": "0.1.6",
2+
"version": "0.1.10",
33
"license": "MIT",
44
"name": "using-try-catch",
55
"homepage": "https://github.com/Oda2/using-try-catch",
6-
"module": "dist/esm/index.js",
7-
"main": "dist/cjs/index.js",
8-
"typings": "dist/index.d.ts",
6+
"module": "esm/using-try-catch.js",
7+
"main": "cjs/using-try-catch.js",
8+
"typings": "index.d.ts",
99
"description": "Simplify the use of try-catch",
1010
"private": false,
11-
"files": [
12-
"dist",
13-
"src",
14-
"package.json",
15-
"README.md"
16-
],
1711
"author": {
1812
"name": "Renato Oda",
1913
"email": "[email protected]",
@@ -32,8 +26,7 @@
3226
"build:umd": "rollup -c rollup.config.ts",
3327
"test": "jest .",
3428
"coverage": "jest . --coverage",
35-
"lint": "eslint .",
36-
"postbuild": "cp package.json dist"
29+
"lint": "eslint ."
3730
},
3831
"devDependencies": {
3932
"@rollup/plugin-typescript": "^8.2.1",
@@ -50,6 +43,7 @@
5043
"rimraf": "^3.0.2",
5144
"rollup": "^2.50.5",
5245
"rollup-plugin-cleanup": "^3.2.1",
46+
"rollup-plugin-terser": "^7.0.2",
5347
"ts-jest": "26.5.5",
5448
"tslib": "^2.2.0",
5549
"typescript": "^4.3.2"

pnpm-lock.yaml

Lines changed: 49 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rollup.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import typescript from '@rollup/plugin-typescript';
22
import cleanup from 'rollup-plugin-cleanup';
3+
import { terser } from "rollup-plugin-terser";
34

45
export default {
5-
input: 'src/using-try-catch.ts',
6+
input: 'src/index.ts',
67
output: {
8+
file: 'dist/usingTryCatch.js',
79
name: 'usingTryCatch',
8-
dir: 'dist',
910
format: 'umd',
1011
sourcemap: true
1112
},
@@ -16,6 +17,7 @@ export default {
1617
declaration: true,
1718
outDir: 'dist'
1819
}),
19-
cleanup({ comments: 'none' })
20+
cleanup({ comments: 'none' }),
21+
terser()
2022
]
2123
};

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { default } from './using-try-catch';
2+

src/using-try-catch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface DataResult<T> {
33
error: Error | null;
44
}
55

6-
const usingTryCatch = async <T>(
6+
export const usingTryCatch = async <T>(
77
promise: Promise<T> | Array<Promise<T>>
88
): Promise<DataResult<T>> => {
99
try {

0 commit comments

Comments
 (0)