diff --git a/package.json b/package.json index 4e9d3d94b..553d5e2a6 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "test:all": "bun run test && bun test:deno && bun test:bun && bun test:fastly && bun test:node && bun test:workerd && bun test:lambda && bun test:lambda-edge", "lint": "eslint src runtime-tests", "lint:fix": "eslint src runtime-tests --fix", - "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\"", - "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\"", + "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\"", + "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\"", "copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json", "build": "bun run --shell bun remove-dist && bun ./build/build.ts && bun run copy:package.cjs.json", "postbuild": "publint", @@ -654,4 +654,4 @@ "engines": { "node": ">=16.9.0" } -} +} \ No newline at end of file diff --git a/perf-measures/bundle-check/scripts/process-results.ts b/perf-measures/bundle-check/scripts/process-results.ts index e570a188f..0dc3b2164 100644 --- a/perf-measures/bundle-check/scripts/process-results.ts +++ b/perf-measures/bundle-check/scripts/process-results.ts @@ -1,14 +1,14 @@ import * as fs from 'node:fs/promises' async function main() { - const currentResult = (await fs.readFile('./generated/after.js')).byteLength - let previousResult: number | null = null - try { - previousResult = (await fs.readFile('./generated/before.js')).byteLength - } catch (e) {} - const table = ['| | Current | Previous |', '| --- | --- | --- |'] - table.push(`| Bundle Size | ${currentResult} | ${previousResult || 'N/A'} |`) - console.log(table.join('\n')) + const currentResult = (await fs.readFile('./generated/after.js')).byteLength + let previousResult: number | null = null + try { + previousResult = (await fs.readFile('./generated/before.js')).byteLength + } catch (e) {} + const table = ['| | Current | Previous |', '| --- | --- | --- |'] + table.push(`| Bundle Size | ${currentResult} | ${previousResult || 'N/A'} |`) + console.log(table.join('\n')) } main() diff --git a/perf-measures/type-check/scripts/generate-app.ts b/perf-measures/type-check/scripts/generate-app.ts index 669601df5..d792fe7e2 100644 --- a/perf-measures/type-check/scripts/generate-app.ts +++ b/perf-measures/type-check/scripts/generate-app.ts @@ -20,6 +20,8 @@ export const app = new Hono()` const routes = generateRoutes(count) writeFile(path.join(import.meta.dirname, '../generated/app.ts'), routes, (err) => { - if (err) { throw err } + if (err) { + throw err + } console.log(`${count} routes have been written to app.ts`) }) diff --git a/perf-measures/type-check/scripts/process-results.ts b/perf-measures/type-check/scripts/process-results.ts index 4e85e495a..99f56d0ed 100644 --- a/perf-measures/type-check/scripts/process-results.ts +++ b/perf-measures/type-check/scripts/process-results.ts @@ -1,18 +1,21 @@ import * as fs from 'node:fs/promises' async function main() { - const currentResult = (await fs.readFile('./result.txt')).toString().split('\n') - const previousResult = await fs.readFile('./previous-result.txt') - .then((data) => data.toString().split('\n')) - .catch(() => null) - const table = ['| | Current | Previous |', '| --- | --- | --- |'] - for (const [i, line] of currentResult.entries()) { - if (line === '') {continue} - const [name, value] = line.split(':') - const mainValue = previousResult?.[i]?.split(':')?.[1] - table.push(`| ${name?.trim()} | ${value?.trim()} | ${mainValue ? mainValue.trim() : 'N/A'} |`) + const currentResult = (await fs.readFile('./result.txt')).toString().split('\n') + const previousResult = await fs + .readFile('./previous-result.txt') + .then((data) => data.toString().split('\n')) + .catch(() => null) + const table = ['| | Current | Previous |', '| --- | --- | --- |'] + for (const [i, line] of currentResult.entries()) { + if (line === '') { + continue } - console.log(table.join('\n')) + const [name, value] = line.split(':') + const mainValue = previousResult?.[i]?.split(':')?.[1] + table.push(`| ${name?.trim()} | ${value?.trim()} | ${mainValue ? mainValue.trim() : 'N/A'} |`) + } + console.log(table.join('\n')) } main()