Skip to content

Commit a4b7fb1

Browse files
Move stuff to config from schema (#846)
1 parent 601ce00 commit a4b7fb1

133 files changed

Lines changed: 2596 additions & 1579 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ flowchart LR
6666

6767
### Framework Configuration
6868

69-
- [`frameworks.ts`](./packages/results/src/frameworks.ts) selects which measurements run for each starter and app.
70-
- Put benchmark settings in [`measurements.ts`](./packages/results/src/measurements.ts). For example, `install: { runs: 5 }` runs five install measurements per job for each enabled starter. Entries like `dependencies: {}` have no configurable repeat count here.
69+
- [`frameworks-config.ts`](./packages/results/src/frameworks-config.ts) selects which measurements run for each starter and app.
70+
- Put benchmark settings in [`measurements-config.ts`](./packages/results/src/measurements-config.ts). For example, `install: { runs: 5 }` runs five install measurements per job for each enabled starter. Entries like `dependencies: null` have no configurable repeat count here.
7171

7272
Edit the TypeScript config. [`print-frameworks.ts`](./packages/stats-generator/src/print-frameworks.ts)
7373
prints it as JSON so CI can build its benchmark matrices. Astro imports the same
@@ -227,7 +227,7 @@ If approved, follow these steps:
227227

228228
2. **Create the app package** (optional): If runtime performance testing is planned, add an `app-*` package (e.g., `packages/app-my-framework`) with a more complex setup that includes features like dynamic routing or client-side interactivity. Make sure the framework dependency is pinned to the same exact version as the starter package.
229229

230-
3. **Add an entry to `packages/results/src/frameworks.ts`** using the same format as the framework configuration example above.
230+
3. **Add an entry to `packages/results/src/frameworks-config.ts`** using the same format as the framework configuration example above.
231231

232232
```ts
233233
{
@@ -247,7 +247,7 @@ If approved, follow these steps:
247247

248248
5. **Test locally**: Make sure the framework builds successfully by running the build script from inside the package directory.
249249

250-
6. CI for `sync-version` and `generate-stats` will automatically pick up the new framework from `packages/results/src/frameworks.ts`. The Benchmarks workflow runs the same measurements and validates their outputs on pull requests and on `main`; only runs on `main` save the results and create a stats update PR.
250+
6. CI for `sync-version` and `generate-stats` will automatically pick up the new framework from `packages/results/src/frameworks-config.ts`. The Benchmarks workflow runs the same measurements and validates their outputs on pull requests and on `main`; only runs on `main` save the results and create a stats update PR.
251251

252252
7. **Submit a PR**: Open a pull request with the new packages, configuration, and methodology updates. Once merged, the CI will automatically pick up the new framework and raise a PR with new metrics.
253253

‎packages/docs/src/content.config.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { file, glob } from 'astro/loaders'
33
import { docsLoader } from '@astrojs/starlight/loaders'
44
import { docsSchema } from '@astrojs/starlight/schema'
55
import { z } from 'astro/zod'
6-
import { frameworks } from '@framework-performance/results/frameworks'
6+
import { frameworksConfig } from '@framework-performance/results/frameworks-config'
77

88
const cwvCollection = defineCollection({
99
loader: file('src/content/cwv/cwv-stats.json'),
@@ -40,7 +40,7 @@ const cwvCollection = defineCollection({
4040
})
4141

4242
const frameworkSlugs = new Set(
43-
frameworks.flatMap((framework) =>
43+
frameworksConfig.flatMap((framework) =>
4444
framework.starter
4545
? [framework.starter.package.replace(/^starter-/, '')]
4646
: [],

‎packages/docs/src/lib/framework-logos.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { frameworks } from '@framework-performance/results/frameworks'
1+
import { frameworksConfig } from '@framework-performance/results/frameworks-config'
22

33
export type ThemedValue = { dark: string; light?: string }
44
export type FrameworkLogo = ThemedValue
@@ -58,14 +58,14 @@ export const frameworkBrands: Record<string, FrameworkBrand> = {
5858
}
5959

6060
const brandKeyByDisplayName = new Map<string, string>([
61-
...frameworks.map((f) => [f.displayName, f.name] as const),
61+
...frameworksConfig.map((f) => [f.displayName, f.name] as const),
6262
['Nuxt.js', 'nuxt'],
6363
['Gatsby', 'gatsby'],
6464
['WordPress', 'wordpress'],
6565
])
6666

6767
const brandKeyByPackage = new Map<string, string>(
68-
frameworks.flatMap((f) =>
68+
frameworksConfig.flatMap((f) =>
6969
[f.starter?.package, f.app?.package].flatMap((packageName) =>
7070
packageName ? [[packageName, f.name] as const] : [],
7171
),

‎packages/docs/src/lib/interaction-history.test.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ test('rendered tests take interaction phases from the run with the median total'
5757
firstPaint: metric(100),
5858
firstContentfulPaint: metric(100),
5959
interactionTests: {
60-
scenario: 'first-row-detail-navigation',
61-
source: 'lighthouse-inp-breakdown',
6260
interactionLatency: metric(30),
6361
inputDelay: metric(2),
6462
processingDuration: metric(20),
@@ -67,8 +65,6 @@ test('rendered tests take interaction phases from the run with the median total'
6765
})
6866

6967
assert.deepEqual(formatted.interactionTests, {
70-
scenario: 'first-row-detail-navigation',
71-
source: 'lighthouse-inp-breakdown',
7268
...timings(1, 20, 9),
7369
})
7470
})

‎packages/docs/src/lib/prepare-chart.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { INTERACTION_PHASES } from './interaction-phases'
22
import { stackGrays } from './chart-styles'
33
import { prepareInitialLoadResources } from './initial-load'
44
import { getCollection } from 'astro:content'
5-
import { frameworks } from '@framework-performance/results/frameworks'
5+
import { frameworksConfig } from '@framework-performance/results/frameworks-config'
66
export * from './chart-measurements'
77
import type { CombinedResult } from '@framework-performance/results/storage'
88
import { prepareRuntimeResult, prepareStarterResult } from './result-content'
@@ -17,8 +17,8 @@ const latest = Object.entries(resultFiles)
1717
.map(([, result]) => result)
1818
.sort(
1919
(a, b) =>
20-
frameworks.findIndex((f) => f.name === a.framework) -
21-
frameworks.findIndex((f) => f.name === b.framework),
20+
frameworksConfig.findIndex((f) => f.name === a.framework) -
21+
frameworksConfig.findIndex((f) => f.name === b.framework),
2222
)
2323
const history = Object.entries(resultFiles)
2424
.filter(([path]) => path.includes('/versions/'))

‎packages/docs/src/lib/prepare-table.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
} from './types'
77
import { prepareInitialLoadResources } from './initial-load'
88
import { formatChartValue } from './chart'
9-
import { frameworks } from '@framework-performance/results/frameworks'
9+
import { frameworksConfig } from '@framework-performance/results/frameworks-config'
1010
import { getCollection } from 'astro:content'
1111
import { formatBytesToMB, formatTimeMs, getFrameworkSlug } from './utils'
1212

@@ -18,8 +18,8 @@ const resultFiles = import.meta.glob<CombinedResult>(
1818
)
1919
const results = Object.values(resultFiles).sort(
2020
(a, b) =>
21-
frameworks.findIndex((f) => f.name === a.framework) -
22-
frameworks.findIndex((f) => f.name === b.framework),
21+
frameworksConfig.findIndex((f) => f.name === a.framework) -
22+
frameworksConfig.findIndex((f) => f.name === b.framework),
2323
)
2424
const starterStats = results
2525
.filter((result) => result.projects.starter)
@@ -378,7 +378,7 @@ type LatencyTableInput = {
378378
valueFormat: ChartValueFormat
379379
}
380380
const frameworkDefinition = (name: string) =>
381-
frameworks.find((f) => f.displayName === name || f.name === name)
381+
frameworksConfig.find((f) => f.displayName === name || f.name === name)
382382
function frameworkColumn(): TableColumn {
383383
return {
384384
key: 'name',

‎packages/docs/src/lib/request-throughput.test.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ const benchmark = {
3434
totalRequests: { value: 9, unit: 'requests' },
3535
bodySize: { value: 20.5, unit: 'KiB' },
3636
duplicationFactor: { value: 1.25, unit: 'ratio' },
37-
durationMs: 10_000,
38-
warmupDurationMs: 250,
39-
minimumRequests: 64,
40-
warmupMinimumRequests: 16,
41-
source: 'tinybench',
42-
path: '/ssr-throughput',
4337
} satisfies NonNullable<FrameworkResult['ssrRequestThroughput']>
4438

4539
test('throughput charts use the median of run means, not the mean or request median', () => {

‎packages/docs/src/lib/result-content.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getLoadPeakStage } from '@framework-performance/results/selection'
22
import type { CombinedResult } from '@framework-performance/results/storage'
3-
import { frameworks } from '@framework-performance/results/frameworks'
3+
import { frameworksConfig } from '@framework-performance/results/frameworks-config'
44
import type {
55
FrameworkResult,
66
InteractionTimingSchema,
@@ -130,7 +130,7 @@ function formatLoad(value: NonNullable<FrameworkResult['ssrLoad']>) {
130130
}
131131

132132
export function prepareRuntimeResult(result: CombinedResult) {
133-
const framework = frameworks.find((f) => f.name === result.framework)!
133+
const framework = frameworksConfig.find((f) => f.name === result.framework)!
134134
const value = {
135135
...result.projects.app,
136136
name: framework.displayName,
@@ -190,7 +190,7 @@ export function prepareRuntimeResult(result: CombinedResult) {
190190
}
191191
}
192192
export function prepareStarterResult(result: CombinedResult) {
193-
const framework = frameworks.find((f) => f.name === result.framework)!
193+
const framework = frameworksConfig.find((f) => f.name === result.framework)!
194194
return {
195195
...result.projects.starter,
196196
name: framework.displayName,

‎packages/results/data/astro/latest.json‎

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
"project": "app",
4949
"result": {
5050
"name": "initialLoad",
51-
"source": "lighthouse-resource-summary",
52-
"path": "/initial-load",
5351
"resources": {
5452
"total": {
5553
"requestCount": {
@@ -578,13 +576,7 @@
578576
"duplicationFactor": {
579577
"value": 1,
580578
"unit": "ratio"
581-
},
582-
"durationMs": 10000,
583-
"warmupDurationMs": 250,
584-
"minimumRequests": 64,
585-
"warmupMinimumRequests": 16,
586-
"source": "tinybench",
587-
"path": "/ssr-throughput"
579+
}
588580
}
589581
},
590582
"ssrLoad": {
@@ -1587,16 +1579,7 @@
15871579
}
15881580
]
15891581
],
1590-
"configuration": {
1591-
"stageConnections": [1, 5, 10, 25, 50, 100, 200],
1592-
"warmupDurationMs": 5000,
1593-
"recoveryMs": 5000,
1594-
"warmupAttempts": 3,
1595-
"stageDurationMs": 5000
1596-
},
15971582
"representativeIterationIndex": 2,
1598-
"source": "autocannon",
1599-
"path": "/server-side-rendered",
16001583
"totalRequests": {
16011584
"value": 139712,
16021585
"unit": "requests"
@@ -3648,8 +3631,6 @@
36483631
}
36493632
},
36503633
"interactionTests": {
3651-
"scenario": "first-row-detail-navigation",
3652-
"source": "lighthouse-inp-breakdown",
36533634
"interactionLatency": {
36543635
"unit": "ms",
36553636
"mean": 2.2696000000000005,
@@ -3957,8 +3938,6 @@
39573938
}
39583939
},
39593940
"interactionTests": {
3960-
"scenario": "first-row-detail-navigation",
3961-
"source": "lighthouse-inp-breakdown",
39623941
"interactionLatency": {
39633942
"unit": "ms",
39643943
"mean": 0.9266,
@@ -4227,5 +4206,39 @@
42274206
"project": "starter",
42284207
"result": ["@astrojs/prism", "@astrojs/telemetry", "astro"]
42294208
}
4209+
},
4210+
"configuration": {
4211+
"install": { "runs": 5 },
4212+
"build": { "runs": 5 },
4213+
"devServer": { "runs": 5 },
4214+
"dependencies": null,
4215+
"browserBaseline": null,
4216+
"nodeEngines": null,
4217+
"ssrRequestThroughput": {
4218+
"runs": 5,
4219+
"durationMs": 10000,
4220+
"warmupDurationMs": 250,
4221+
"minimumRequests": 64,
4222+
"warmupMinimumRequests": 16,
4223+
"path": "/ssr-throughput"
4224+
},
4225+
"ssrLoad": {
4226+
"runs": 3,
4227+
"stageConnections": [1, 5, 10, 25, 50, 100, 200],
4228+
"stageDurationMs": 5000,
4229+
"warmupDurationMs": 5000,
4230+
"warmupAttempts": 3,
4231+
"recoveryMs": 5000,
4232+
"path": "/server-side-rendered"
4233+
},
4234+
"clientSideRendered": {
4235+
"runs": 5,
4236+
"scenario": "first-row-detail-navigation"
4237+
},
4238+
"serverSideRendered": {
4239+
"runs": 5,
4240+
"scenario": "first-row-detail-navigation"
4241+
},
4242+
"initialLoad": { "path": "/initial-load" }
42304243
}
42314244
}

‎packages/results/data/astro/versions/7.1.6.json‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,7 @@
429429
}
430430
]
431431
],
432-
"configuration": {
433-
"stageConnections": [1, 5, 10, 25, 50, 100, 200],
434-
"warmupDurationMs": 5000
435-
},
436432
"representativeIterationIndex": 1,
437-
"source": "autocannon",
438-
"path": "/server-side-rendered",
439433
"totalRequests": { "value": 110475, "unit": "requests" },
440434
"totalErrors": { "value": 0, "unit": "errors" },
441435
"stage1": {
@@ -1016,8 +1010,6 @@
10161010
"max": 129.087
10171011
},
10181012
"interactionTests": {
1019-
"scenario": "first-row-detail-navigation",
1020-
"source": "lighthouse-inp-breakdown",
10211013
"interactionLatency": {
10221014
"unit": "ms",
10231015
"mean": 1.63925,
@@ -1111,8 +1103,6 @@
11111103
"max": 71.557
11121104
},
11131105
"interactionTests": {
1114-
"scenario": "first-row-detail-navigation",
1115-
"source": "lighthouse-inp-breakdown",
11161106
"interactionLatency": {
11171107
"unit": "ms",
11181108
"mean": 1.5494999999999999,
@@ -1205,5 +1195,26 @@
12051195
"project": "starter",
12061196
"result": { "value": 2117, "unit": "ms" }
12071197
}
1198+
},
1199+
"configuration": {
1200+
"install": { "runs": 5 },
1201+
"build": { "runs": 5 },
1202+
"devServer": { "runs": 5 },
1203+
"dependencies": null,
1204+
"browserBaseline": null,
1205+
"ssrLoad": {
1206+
"runs": 3,
1207+
"stageConnections": [1, 5, 10, 25, 50, 100, 200],
1208+
"warmupDurationMs": 5000,
1209+
"path": "/server-side-rendered"
1210+
},
1211+
"clientSideRendered": {
1212+
"runs": 4,
1213+
"scenario": "first-row-detail-navigation"
1214+
},
1215+
"serverSideRendered": {
1216+
"runs": 4,
1217+
"scenario": "first-row-detail-navigation"
1218+
}
12081219
}
12091220
}

0 commit comments

Comments
 (0)