Skip to content

Commit

Permalink
Add rollup to make UMD releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbobeirne committed Jan 19, 2019
1 parent 26a1919 commit 4acfabc
Show file tree
Hide file tree
Showing 7 changed files with 555 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
lib
dist
*.log
.rpt2_cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Promise<WebLNProvider> (see below) that's already been `enable()`d.
#### Example

```ts
import { requestProvider } from 'webln/lib/client';
import { requestProvider } from 'webln';

let webln;
try {
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
"description": "Spec and tools around implementing WebLN",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"unpkg": "dist/webln.js",
"license": "MIT",
"files": [
"lib"
"lib",
"dist"
],
"scripts": {
"build": "tsc",
"build": "tsc && rollup -c",
"prepublish": "npm run build"
},
"devDependencies": {
"rollup": "1.1.0",
"rollup-plugin-terser": "4.0.2",
"rollup-plugin-typescript2": "0.19.2",
"typescript": "3.1.3"
},
"dependencies": {
"@types/chrome": "0.0.74"
}
},
"sideEffects": false
}
36 changes: 36 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import typescript from 'rollup-plugin-typescript2';
import { terser } from 'rollup-plugin-terser';

export default [
// UMD (Development)
{
input: 'src/index.ts',
output: {
file: 'dist/webln.js',
format: 'umd',
name: 'WebLN',
},
plugins: [typescript()],
},
// UMD (Production)
{
input: 'src/index.ts',
output: {
file: 'dist/webln.min.js',
format: 'umd',
name: 'WebLN',
indent: false,
},
plugins: [
typescript(),
terser({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
}),
],
},
]
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './client';
export * from './provider';
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"module": "esnext",
"outDir": "lib",
"rootDir": "src/",
"declaration": true,
"strict": true,
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitAny": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["es2017", "dom"]
},
"include": ["src"]
Expand Down
Loading

0 comments on commit 4acfabc

Please sign in to comment.