mirror of
https://github.com/honojs/hono.git
synced 2024-11-21 10:08:58 +01:00
chore: enable formatting perf-measures
(#3683)
This commit is contained in:
parent
53bd319b43
commit
c8f6a866c0
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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()
|
||||
|
@ -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`)
|
||||
})
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user