diff --git a/.gitignore b/.gitignore index d65f9407f4bcad6056394d40981bea48dd540fe5..69b0a491a51e22fbcfa034cb798dbcb97ff3a736 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .env package-lock.json +dist/ bower_components/ node_modules/ sauce_connect/ diff --git a/Makefile b/Makefile index 4372e5a222d4a9a96e5b8265bded262b05f8bc95..3d3f2e72a1853636f1b3df7e3ce34dab747178cf 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/package.json b/package.json index b056d01e62a5c6d90609acd867a3fc14e52a0aff..5b1d9ab95452776b6d8186f719bf1b9bc657ddd4 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -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" } } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000000000000000000000000000000000000..d42973357a7436b042650d9ddb2add8196798c35 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,8 @@ +export default { + input: 'fetch.js', + output: { + file: 'dist/fetch.umd.js', + format: 'umd', + name: 'WHATWGFetch' + } +} diff --git a/test/test.html b/test/test.html index 8a1e48f10a58070c3025087aec993a69f7f7ac4b..338a191f651e314544248342ede537cee627afb7 100644 --- a/test/test.html +++ b/test/test.html @@ -34,7 +34,7 @@ - +