-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathlist.js
More file actions
executable file
·30 lines (25 loc) · 890 Bytes
/
list.js
File metadata and controls
executable file
·30 lines (25 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env node
import { MetricBudget } from 'calibre'
// Returns a list of metric budgets for a site, including:
// - The budget threshold value, e.g. 2500
// - Budget status, e.g. "met", "unmet", "at_risk"
// - Metric, e.g. "largestContentfulPaint"
// - Each page and test profile associated with the budget, with:
// - Last observed value
// - Whether the budget is within the threshold
const listMetricBudgets = async () => {
const site = 'calibre' // site slug
const count = 1 // number of metric budgets to return (maximum=5)
const metric = 'largestContentfulPaint' // specify a metric (default=budgets for all metrics are returned)
try {
const metricBudgets = await MetricBudget.list({
site,
metric,
count
})
console.log(JSON.stringify(metricBudgets, null, 2))
} catch (error) {
console.error(error)
}
}
listMetricBudgets()