Skip to content

Commit

Permalink
Build UMD dist file with Rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed May 17, 2018
1 parent 0a57487 commit 432bf07
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.env
package-lock.json
dist/
bower_components/
node_modules/
sauce_connect/
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
test: node_modules/ lint
test: lint dist/fetch.umd.js
./script/test

lint: node_modules/
./node_modules/.bin/eslint --report-unused-disable-directives *.js test/*.js

dist/fetch.umd.js: fetch.js rollup.config.js node_modules/
./node_modules/.bin/rollup -c

node_modules/:
npm install

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "whatwg-fetch",
"description": "A window.fetch polyfill.",
"version": "2.0.3",
"main": "fetch.js",
"main": "./dist/fetch.umd.js",
"module": "./fetch.js",
"repository": "github/fetch",
"license": "MIT",
"devDependencies": {
Expand All @@ -12,13 +13,16 @@
"mocha": "2.1.0",
"mocha-phantomjs-core": "2.0.1",
"promise-polyfill": "6.0.2",
"rollup": "^0.59.1",
"url-search-params": "0.6.1"
},
"files": [
"LICENSE",
"dist/fetch.umd.js",
"fetch.js"
],
"scripts": {
"prepublish": "make dist/fetch.umd.js",
"test": "make"
}
}
8 changes: 8 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
input: 'fetch.js',
output: {
file: 'dist/fetch.umd.js',
format: 'umd',
name: 'WHATWGFetch'
}
}
2 changes: 1 addition & 1 deletion test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<script src="/node_modules/promise-polyfill/promise.js"></script>
<script src="/test/test.js"></script>
<script src="/fetch.js"></script>
<script src="/dist/fetch.umd.js"></script>

<script>
var runner = mocha.run();
Expand Down
2 changes: 1 addition & 1 deletion test/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ self.assert = chai.assert

importScripts('/node_modules/promise-polyfill/promise.js')
importScripts('/test/test.js')
importScripts('/fetch.js')
importScripts('/dist/fetch.umd.js')

function title(test) {
return test.fullTitle().replace(/#/g, '')
Expand Down

0 comments on commit 432bf07

Please sign in to comment.