Skip to content

Commit 8406b2d

Browse files
committed
feat: Add UMD bundle
1 parent 5f32b07 commit 8406b2d

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

.github/workflows/release.yml

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

23-
- uses: actions/setup-node@v1
23+
- uses: actions/setup-node@v2
2424
with:
25-
node-version: 12
25+
node-version: 14
2626
registry-url: https://registry.npmjs.org/
2727

2828
- run: npm publish
@@ -40,13 +40,14 @@ jobs:
4040
with:
4141
version: 6.6.2
4242
run_install: true
43+
registry: https://npm.pkg.github.com
4344

4445
- name: Build
4546
run: pnpm build
4647

47-
- uses: actions/setup-node@v1
48+
- uses: actions/setup-node@v2
4849
with:
49-
node-version: 12
50+
node-version: 14
5051
registry-url: https://npm.pkg.github.com
5152

5253
- run: npm publish

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,35 @@ const example = async () => {
3838
example();
3939
```
4040

41+
### Browser Examples
42+
43+
```html
44+
<!DOCTYPE html>
45+
<html>
46+
<head>
47+
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
48+
</head>
49+
<body>
50+
51+
<h1>Exemplo</h1>
52+
53+
<script>
54+
document.addEventListener('DOMContentLoaded', function loaded() {
55+
56+
const example = async () => {
57+
const promise = new Promise((resolve) => resolve('exemple'));
58+
59+
const result = await usingTryCatch(promise);
60+
console.log(result.data); // 'example'
61+
};
62+
63+
example();
64+
});
65+
</script>
66+
</body>
67+
</html>
68+
```
69+
4170

4271
### NPM Statistics
4372

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.1.1",
2+
"version": "0.1.2",
33
"license": "MIT",
44
"name": "using-try-catch",
55
"module": "dist/esm/index.js",

rollup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import cleanup from 'rollup-plugin-cleanup';
44
export default {
55
input: 'src/index.ts',
66
output: {
7-
name: 'using-try-catch',
7+
name: 'usingTryCatch',
88
dir: 'dist',
99
format: 'umd',
1010
sourcemap: true

0 commit comments

Comments
 (0)