diff --git a/.eslintrc b/.eslintrc index 786b7e5a..ea322d5e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -7,14 +7,13 @@ "jest": true }, "parser": "@typescript-eslint/parser", + "plugins": [ + "import" + ], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended", - "prettier" - ], - "plugins": [ - "import" + "plugin:prettier/recommended" ], "parserOptions": { "project": "tsconfig.json", diff --git a/README.md b/README.md index fd7b1cf0..08be278a 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ npm install # build the dist npm run build # run the repl (this allows you to import from ./src) -npm run ts-node +npm run tsx # run the tests npm run test # lint the source code diff --git a/benches/index.ts b/benches/index.ts index dd2d64dd..786fb5bc 100644 --- a/benches/index.ts +++ b/benches/index.ts @@ -1,13 +1,18 @@ #!/usr/bin/env ts-node -import type { Summary } from 'benny/lib/internal/common-types'; -import fs from 'fs'; -import path from 'path'; +import type { Summary } from 'benny/lib/internal/common-types.js'; +import fs from 'node:fs'; +import path from 'node:path'; +import url from 'node:url'; import si from 'systeminformation'; -import { fsWalk, resultsPath, suitesPath } from './utils'; +import { fsWalk, resultsPath, suitesPath } from './utils.js'; + +const projectPath = path.dirname(url.fileURLToPath(import.meta.url)); async function main(): Promise { - await fs.promises.mkdir(path.join(__dirname, 'results'), { recursive: true }); + await fs.promises.mkdir(path.join(projectPath, 'results'), { + recursive: true, + }); // Running all suites for await (const suitePath of fsWalk(suitesPath)) { // Skip over non-ts and non-js files @@ -39,13 +44,16 @@ async function main(): Promise { system: 'model, manufacturer', }); await fs.promises.writeFile( - path.join(__dirname, 'results', 'system.json'), + path.join(projectPath, 'results', 'system.json'), JSON.stringify(systemData, null, 2), ); } -if (require.main === module) { - void main(); +if (import.meta.url.startsWith('file:')) { + const modulePath = url.fileURLToPath(import.meta.url); + if (process.argv[1] === modulePath) { + void main(); + } } export default main; diff --git a/benches/results/baseline_tcp/baseline_tcp_1KiB.chart.html b/benches/results/baseline_tcp/baseline_tcp_1KiB.chart.html index 4baaf506..abb59da0 100644 --- a/benches/results/baseline_tcp/baseline_tcp_1KiB.chart.html +++ b/benches/results/baseline_tcp/baseline_tcp_1KiB.chart.html @@ -28,7 +28,7 @@
- +