Skip to content

Commit 5d72c08

Browse files
authored
Replace Browserify with Rollup (#332)
1 parent b0e093e commit 5d72c08

File tree

6 files changed

+605
-1447
lines changed

6 files changed

+605
-1447
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ run in the v8 version that your local Node.js uses, while classNames is _most_
2121
often run across a wide variety of browsers and browser versions.
2222

2323
It is recommended to test possible regressions in performance in all major
24-
browsers. This can be done by running `npm run benchmarks-browserify` in the
25-
`./benchmarks` directory.
24+
browsers. This can be done by running `npm run benchmarks-browser` in the
25+
`./benchmarks` directory, the benchmark will then be served from http://localhost:8080.

benchmarks/benchmarks.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

benchmarks/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Benchmarks</title>
6+
</head>
7+
<body>
8+
<div id="results"></div>
9+
<div id="loader">Wait please&hellip;</div>
10+
<script src="runInBrowser.bundle.js"></script>
11+
</body>
12+
</html>

benchmarks/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
"name": "classnames-benchmarks",
33
"scripts": {
44
"benchmarks": "node ./run.js",
5-
"benchmarks-browserify": "browserify ./runInBrowser.js >./runInBrowser.bundle.js"
5+
"benchmarks-browser": "rollup --plugin commonjs,json,node-resolve ./runInBrowser.js --file ./runInBrowser.bundle.js --format iife && http-server -o"
66
},
77
"devDependencies": {
8+
"@rollup/plugin-commonjs": "^25.0.7",
9+
"@rollup/plugin-json": "^6.1.0",
10+
"@rollup/plugin-node-resolve": "^15.2.3",
811
"benchmark": "^2.1.4",
9-
"browserify": "^17.0.0",
12+
"classnames-local": "file:../",
1013
"classnames-npm": "npm:classnames@*",
11-
"classnames-local": "file:../"
14+
"http-server": "^14.1.1",
15+
"lodash": "^4.17.21",
16+
"rollup": "^4.9.1"
1217
}
1318
}

benchmarks/runSuite.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
var benchmark = require('benchmark');
2+
var _ = require('lodash');
3+
4+
var Suite = benchmark.runInContext({ _ }).Suite;
25

36
function runSuite (local, npm, dedupe, npmDedupe, fixture, log) {
4-
var suite = new benchmark.Suite();
7+
var suite = new Suite();
58

69
suite.add('local#' + fixture.description, function () {
710
local.apply(null, fixture.args);

0 commit comments

Comments
 (0)