From 93314019575be682fe5fbace1f8004c11acc416a Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Fri, 29 Dec 2023 13:42:17 +0100 Subject: [PATCH] Remove benchmarks from workspace (#350) --- .github/workflows/node.js.yml | 2 +- CONTRIBUTING.md | 6 +++--- benchmarks/benchmarks.js | 2 +- benchmarks/package.json | 20 +------------------- package-lock.json | 18 +++--------------- package.json | 14 +++++++++++--- 6 files changed, 20 insertions(+), 42 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 575f400..82577a8 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -71,4 +71,4 @@ jobs: run: npm ci - name: Run benchmarks - run: npm run benchmarks --workspace=benchmarks + run: npm run bench diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a7f5fd..095bad6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/benchmarks/benchmarks.js b/benchmarks/benchmarks.js index a20970e..b80d744 100644 --- a/benchmarks/benchmarks.js +++ b/benchmarks/benchmarks.js @@ -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' ); } diff --git a/benchmarks/package.json b/benchmarks/package.json index cbb5e9f..6990891 100644 --- a/benchmarks/package.json +++ b/benchmarks/package.json @@ -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"} diff --git a/package-lock.json b/package-lock.json index 1d7ef2c..da62e60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,25 +9,17 @@ "name": "classnames", "version": "2.5.0", "license": "MIT", - "workspaces": [ - "benchmarks" - ], - "devDependencies": { - "tsd": "^0.30.1" - } - }, - "benchmarks": { - "name": "classnames-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-local": "file:.", "classnames-npm": "npm:classnames@*", "http-server": "^14.1.1", "markdown-table": "^3.0.3", "rollup": "^4.9.1", - "tinybench": "^2.5.1" + "tinybench": "^2.5.1", + "tsd": "^0.30.1" } }, "node_modules/@babel/code-frame": { @@ -732,10 +724,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/classnames-benchmarks": { - "resolved": "benchmarks", - "link": true - }, "node_modules/classnames-local": { "resolved": "", "link": true diff --git a/package.json b/package.json index a8194bc..77a3c35 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -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": {