Skip to content

Commit

Permalink
Switch to rollup for the build
Browse files Browse the repository at this point in the history
This switches to using rollup for the build. This fixes #444 among other
things.
  • Loading branch information
matthewp committed Jan 21, 2018
1 parent 7bc0ee3 commit 3606c50
Show file tree
Hide file tree
Showing 5 changed files with 956 additions and 1,004 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
BROWSERIFY=node_modules/.bin/browserify
ROLLUP=node_modules/.bin/rollup
INFOLOG := \033[34m ▸\033[0m

page.js: index.js
@echo "$(INFOLOG) Building page.js.."
@$(BROWSERIFY) index.js --standalone page -o page.js
@$(ROLLUP) -c rollup.config.js

watch:
find index.js | entr make page.js
.PHONY: watch

clean:
@rm page.js
.PHONY: clean
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/

module.exports = page;
module.exports.default = page;
module.exports.Context = Context;
module.exports.Route = Route;
module.exports.sameOrigin = sameOrigin;
page.default = page;
page.Context = Context;
page.Route = Route;
page.sameOrigin = sameOrigin;

/**
* Short-cuts for global-object checks
Expand All @@ -25,6 +25,7 @@
var hasDocument = ('undefined' !== typeof document);
var hasWindow = ('undefined' !== typeof window);
var hasHistory = ('undefined' !== typeof history);
var hasProcess = typeof process !== 'undefined';

/**
* Detect click event
Expand Down Expand Up @@ -601,8 +602,7 @@
/**
* Handle "click" events.
*/
/* jshint -W054 */
var hasProcess = new Function('return typeof process')() !== 'undefined';

/* jshint +W054 */
function onclick(e) {
if (1 !== which(e)) return;
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
"serve": "serve test",
"test-cov": "jscoverage index.js index-cov.js; PAGE_COV=1 mocha test/tests.js -R html-cov > coverage.html",
"prepublish": "npm run make",
"make": "browserify index.js --standalone page -o page.js"
"make": "rollup -c rollup.config.js"
},
"dependencies": {
"path-to-regexp": "~1.2.1"
},
"devDependencies": {
"browserify": "^6.3.2",
"chai": "^1.10.0",
"coveralls": "^2.11.2",
"engine-dependencies": "^0.2.0",
Expand All @@ -35,6 +34,9 @@
"jshint": "^2.5.10",
"mocha": "^2.0.1",
"mocha-lcov-reporter": "0.0.1",
"rollup": "^0.54.1",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.2",
"serve": "*",
"should": "*"
},
Expand Down
Loading

0 comments on commit 3606c50

Please sign in to comment.