Skip to content

Commit

Permalink
build UMD bundle; Closes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Sep 7, 2018
1 parent 30e9c8a commit f53a456
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ mkdir('dist').then(_ => {
const { code } = minify(data);
const int = sizer.sync(code);
console.log(`> gzip size: ${pretty(int)}`);

// Write UMD bundle
const name = 'dset';
let UMD = `!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.${name}=t()}(this,function(){`;
UMD += code.replace(/module.exports=/, 'return ') + '});';
fs.writeFileSync(pkg.unpkg, UMD);
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "1.0.1",
"repository": "lukeed/dset",
"description": "A tiny (144B) utility for safely writing deep Object values~!",
"unpkg": "dist/dset.min.js",
"umd:main": "dist/dset.min.js",
"module": "dist/dset.es.js",
"main": "dist/dset.js",
"license": "MIT",
Expand Down

0 comments on commit f53a456

Please sign in to comment.