Skip to content

Commit

Permalink
Remove benchmarks from workspace (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops committed Dec 29, 2023
1 parent ff6dd1e commit 9331401
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:
run: npm ci

- name: Run benchmarks
run: npm run benchmarks --workspace=benchmarks
run: npm run bench
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ performance.

A benchmark utility is included so that changes may be tested against the
current published version. To run the benchmarks, run `npm install` in the
root directory then run `npm run benchmarks` in the `./benchmarks` directory.
root directory then run `npm run bench`.

Please be aware though that local benchmarks are just a smoke-signal; they will
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-browser` in the
`./benchmarks` directory, the benchmark will then be served from http://localhost:8080.
browsers. This can be done by running `npm run bench-browser`, the benchmark
will then be served from http://localhost:8080.
2 changes: 1 addition & 1 deletion benchmarks/benchmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import npmPackage from 'classnames-npm/package.json' with { type: 'json' };
if (localPackage.version !== npmPackage.version) {
console.warn(
`Your local version (${localPackage.version}) does not match the installed version (${npmPackage.version}).\n\n` +
'Please run `npm update classnames-npm` in ./benchmarks to ensure you are benchmarking against the latest version published to NPM.\n'
'Please run `npm update classnames-npm` to ensure you are benchmarking against the latest version published to NPM.\n'
);
}

Expand Down
20 changes: 1 addition & 19 deletions benchmarks/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
{
"name": "classnames-benchmarks",
"type": "module",
"scripts": {
"benchmarks": "node ./run.js",
"benchmarks-browser": "rollup --plugin commonjs,json,node-resolve ./runInBrowser.js --file ./runInBrowser.bundle.js && http-server -c-1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"classnames-local": "file:../",
"classnames-npm": "npm:classnames@*",
"http-server": "^14.1.1",
"markdown-table": "^3.0.3",
"rollup": "^4.9.1",
"tinybench": "^2.5.1"
}
}
{"type": "module"}
18 changes: 3 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
},
"scripts": {
"test": "node --test ./tests/*.mjs",
"bench": "node ./benchmarks/run.js",
"bench-browser": "rollup --plugin commonjs,json,node-resolve ./benchmarks/runInBrowser.js --file ./benchmarks/runInBrowser.bundle.js && http-server -c-1 ./benchmarks",
"check-types": "tsd"
},
"keywords": [
Expand All @@ -58,10 +60,16 @@
"*.d.ts",
"*.js"
],
"workspaces": [
"benchmarks"
],
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"classnames-local": "file:.",
"classnames-npm": "npm:classnames@*",
"http-server": "^14.1.1",
"markdown-table": "^3.0.3",
"rollup": "^4.9.1",
"tinybench": "^2.5.1",
"tsd": "^0.30.1"
},
"tsd": {
Expand Down

0 comments on commit 9331401

Please sign in to comment.