Skip to content

Commit

Permalink
Replace Browserify with Rollup (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops authored Dec 22, 2023
1 parent b0e093e commit 5d72c08
Show file tree
Hide file tree
Showing 6 changed files with 605 additions and 1,447 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ run in the v8 version that your local Node.js uses, while classNames is _most_
often run across a wide variety of browsers and browser versions.

It is recommended to test possible regressions in performance in all major
browsers. This can be done by running `npm run benchmarks-browserify` in the
`./benchmarks` directory.
browsers. This can be done by running `npm run benchmarks-browser` in the
`./benchmarks` directory, the benchmark will then be served from http://localhost:8080.
12 changes: 0 additions & 12 deletions benchmarks/benchmarks.html

This file was deleted.

12 changes: 12 additions & 0 deletions benchmarks/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Benchmarks</title>
</head>
<body>
<div id="results"></div>
<div id="loader">Wait please&hellip;</div>
<script src="runInBrowser.bundle.js"></script>
</body>
</html>
11 changes: 8 additions & 3 deletions benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
"name": "classnames-benchmarks",
"scripts": {
"benchmarks": "node ./run.js",
"benchmarks-browserify": "browserify ./runInBrowser.js >./runInBrowser.bundle.js"
"benchmarks-browser": "rollup --plugin commonjs,json,node-resolve ./runInBrowser.js --file ./runInBrowser.bundle.js --format iife && http-server -o"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"benchmark": "^2.1.4",
"browserify": "^17.0.0",
"classnames-local": "file:../",
"classnames-npm": "npm:classnames@*",
"classnames-local": "file:../"
"http-server": "^14.1.1",
"lodash": "^4.17.21",
"rollup": "^4.9.1"
}
}
5 changes: 4 additions & 1 deletion benchmarks/runSuite.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
var benchmark = require('benchmark');
var _ = require('lodash');

var Suite = benchmark.runInContext({ _ }).Suite;

function runSuite (local, npm, dedupe, npmDedupe, fixture, log) {
var suite = new benchmark.Suite();
var suite = new Suite();

suite.add('local#' + fixture.description, function () {
local.apply(null, fixture.args);
Expand Down
Loading

0 comments on commit 5d72c08

Please sign in to comment.