@theholocron/lighthouse-config 7.12.0 → 7.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,8 +22,8 @@ Create a `lighthouse.config.js` at the project root and pass it to `lhci` with `
|
|
|
22
22
|
import { defineConfig } from "@theholocron/lighthouse-config";
|
|
23
23
|
|
|
24
24
|
export default defineConfig({
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
url: "http://localhost:5173/",
|
|
26
|
+
startServerCommand: "pnpm dev",
|
|
27
27
|
});
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -37,12 +37,12 @@ pnpm lhci autorun --config=./lighthouse.config.js
|
|
|
37
37
|
|
|
38
38
|
## Options
|
|
39
39
|
|
|
40
|
-
| Option
|
|
41
|
-
|
|
42
|
-
| `url`
|
|
43
|
-
| `startServerCommand` | `string`
|
|
44
|
-
| `assertions`
|
|
45
|
-
| `uploadTarget`
|
|
40
|
+
| Option | Type | Default | Description |
|
|
41
|
+
| -------------------- | --------------------- | ---------------------------- | ------------------------------------------------- |
|
|
42
|
+
| `url` | `string \| string[]` | — | URL(s) to audit |
|
|
43
|
+
| `startServerCommand` | `string` | — | Command to start the dev server before collecting |
|
|
44
|
+
| `assertions` | `LighthouseAssertion` | `defaultAssertions` | Audit thresholds |
|
|
45
|
+
| `uploadTarget` | `string` | `"temporary-public-storage"` | Where to upload results |
|
|
46
46
|
|
|
47
47
|
## Default assertions
|
|
48
48
|
|
|
@@ -59,11 +59,11 @@ Override individual thresholds by spreading and replacing:
|
|
|
59
59
|
import { defineConfig, defaultAssertions } from "@theholocron/lighthouse-config";
|
|
60
60
|
|
|
61
61
|
export default defineConfig({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
url: "http://localhost:5173/",
|
|
63
|
+
startServerCommand: "pnpm dev",
|
|
64
|
+
assertions: {
|
|
65
|
+
...defaultAssertions,
|
|
66
|
+
"largest-contentful-paint": ["error", { minScore: 0.95 }],
|
|
67
|
+
},
|
|
68
68
|
});
|
|
69
69
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface LighthouseAssertion {
|
|
|
10
10
|
"bf-cache"?: MinScoreAssertion;
|
|
11
11
|
"errors-in-console"?: MinScoreAssertion;
|
|
12
12
|
"font-display"?: MinScoreAssertion;
|
|
13
|
-
|
|
13
|
+
label?: MinScoreAssertion;
|
|
14
14
|
"largest-contentful-paint"?: MinScoreAssertion;
|
|
15
15
|
"lcp-lazy-loaded"?: MinScoreAssertion;
|
|
16
16
|
"non-composited-animations"?: MinScoreAssertion;
|
|
@@ -24,9 +24,10 @@ interface LighthouseConfigOptions {
|
|
|
24
24
|
url: string | string[];
|
|
25
25
|
startServerCommand?: string;
|
|
26
26
|
assertions?: LighthouseAssertion;
|
|
27
|
+
/** @default "temporary-public-storage" */
|
|
27
28
|
uploadTarget?: string;
|
|
28
29
|
}
|
|
29
|
-
declare function
|
|
30
|
+
declare function defineConfig({ url, startServerCommand, assertions, uploadTarget }: LighthouseConfigOptions): {
|
|
30
31
|
ci: {
|
|
31
32
|
collect: {
|
|
32
33
|
startServerCommand?: string | undefined;
|
|
@@ -41,4 +42,4 @@ declare function lighthouseConfig({ url, startServerCommand, assertions, uploadT
|
|
|
41
42
|
};
|
|
42
43
|
};
|
|
43
44
|
//#endregion
|
|
44
|
-
export { LighthouseAssertion, LighthouseConfigOptions, defaultAssertions,
|
|
45
|
+
export { LighthouseAssertion, LighthouseConfigOptions, defaultAssertions, defineConfig };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ const defaultAssertions = {
|
|
|
3
3
|
"bf-cache": ["warn", { minScore: .9 }],
|
|
4
4
|
"errors-in-console": ["warn", { minScore: .9 }],
|
|
5
5
|
"font-display": ["warn", { minScore: .9 }],
|
|
6
|
-
|
|
6
|
+
label: ["warn", { minScore: .9 }],
|
|
7
7
|
"largest-contentful-paint": ["warn", { minScore: .9 }],
|
|
8
8
|
"lcp-lazy-loaded": ["warn", { minScore: .9 }],
|
|
9
9
|
"non-composited-animations": ["warn", { minScore: .9 }],
|
|
@@ -11,7 +11,7 @@ const defaultAssertions = {
|
|
|
11
11
|
"unused-javascript": ["warn", { maxLength: 0 }],
|
|
12
12
|
"uses-long-cache-ttl": ["warn", { maxLength: 0 }]
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function defineConfig({ url, startServerCommand, assertions = defaultAssertions, uploadTarget = "temporary-public-storage" }) {
|
|
15
15
|
return { ci: {
|
|
16
16
|
collect: {
|
|
17
17
|
url: Array.isArray(url) ? url : [url],
|
|
@@ -22,4 +22,4 @@ function lighthouseConfig({ url, startServerCommand, assertions = defaultAsserti
|
|
|
22
22
|
} };
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
|
-
export { defaultAssertions,
|
|
25
|
+
export { defaultAssertions, defineConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/lighthouse-config",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.13.2",
|
|
4
4
|
"description": "A Lighthouse CI configuration for auditing performance and accessibility within the Galaxy.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/configs/tree/main/packages/lighthouse-config#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/configs/issues",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"tsdown": "^0.22.14",
|
|
25
25
|
"typescript": "^5.9.3",
|
|
26
26
|
"vitest": "^4.1.10",
|
|
27
|
-
"@theholocron/
|
|
28
|
-
"@theholocron/
|
|
27
|
+
"@theholocron/vitest-config": "7.13.2",
|
|
28
|
+
"@theholocron/tsconfig": "7.13.2"
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|