@faststore/lighthouse 4.1.0-dev.1 → 4.1.0-dev.10
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 +87 -0
- package/package.json +6 -7
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://developers.vtex.com/docs/guides/faststore">
|
|
3
|
+
<img alt="Faststore" src="../ui/static/logo.png" width="60" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">
|
|
7
|
+
Faststore Lighthouse
|
|
8
|
+
</h1>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>
|
|
11
|
+
Lighthouse CI configuration generator for FastStore
|
|
12
|
+
</strong>
|
|
13
|
+
</p>
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.npmjs.com/package/@faststore/lighthouse">
|
|
16
|
+
<img src="https://badge.fury.io/js/%40faststore%2Flighthouse.svg" alt="npm version" />
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
`@faststore/lighthouse` generates a [Lighthouse CI](https://github.com/GoogleChrome/lighthouse-ci) configuration object with FastStore's default performance budgets and assertions. It is used by `@faststore/core` via `lighthouserc.js` to enforce quality gates on every CI run.
|
|
22
|
+
|
|
23
|
+
## Default budgets
|
|
24
|
+
|
|
25
|
+
The generated config enforces the following minimum scores:
|
|
26
|
+
|
|
27
|
+
| Category | Threshold |
|
|
28
|
+
| :--- | :--- |
|
|
29
|
+
| Performance | ≥ 0.95 |
|
|
30
|
+
| Accessibility | 1.0 |
|
|
31
|
+
| Best Practices | 1.0 |
|
|
32
|
+
| SEO | 1.0 |
|
|
33
|
+
|
|
34
|
+
Key metric budgets: FCP ≤ 1800ms, LCP ≤ 2500ms, TBT ≤ 350ms, CLS ≤ 0.1, total resource size ≤ 600 KB.
|
|
35
|
+
|
|
36
|
+
## How to use
|
|
37
|
+
|
|
38
|
+
In your store's `lighthouserc.js`:
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
const lhConfig = require('@faststore/lighthouse').default
|
|
42
|
+
|
|
43
|
+
module.exports = lhConfig({
|
|
44
|
+
urls: ['/'], // pages to audit
|
|
45
|
+
server: 'https://your-store.com',
|
|
46
|
+
assertions: {
|
|
47
|
+
// override or extend default assertions
|
|
48
|
+
'csp-xss': 'off',
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The `BASE_SITE_URL` environment variable can be used instead of `server` when running in CI.
|
|
54
|
+
|
|
55
|
+
## How to develop
|
|
56
|
+
All logic lives in a single file: `src/index.ts`. To make changes:
|
|
57
|
+
1. Edit `src/index.ts`
|
|
58
|
+
|
|
59
|
+
2. Run `pnpm build` to compile
|
|
60
|
+
|
|
61
|
+
3. Verify the output in `packages/core` — since it's a workspace dependency, `lighthouserc.js` will pick up your local build automatically. Changes to default budgets or assertions are validated through the actual Lighthouse CI run. If you update a threshold, check whether `packages/core/lighthouserc.js` overrides it, as store-level assertions take precedence.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## How to run
|
|
65
|
+
|
|
66
|
+
### Prerequisites
|
|
67
|
+
|
|
68
|
+
- Node.js ≥ 20
|
|
69
|
+
- pnpm
|
|
70
|
+
|
|
71
|
+
### Local setup
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# 1. Install dependencies (from the repo root)
|
|
75
|
+
pnpm install
|
|
76
|
+
|
|
77
|
+
# 2. Build the package
|
|
78
|
+
pnpm build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## How to publish
|
|
82
|
+
|
|
83
|
+
Versioning and publishing are managed at the monorepo root by Lerna. Do not publish this package independently. Refer to the [Contributing guidelines](../../CONTRIBUTING.MD) for the full release workflow.
|
|
84
|
+
|
|
85
|
+
## Documentation
|
|
86
|
+
|
|
87
|
+
- **Lighthouse CI:** [github.com/GoogleChrome/lighthouse-ci](https://github.com/GoogleChrome/lighthouse-ci)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/lighthouse",
|
|
3
|
-
"version": "4.1.0-dev.
|
|
3
|
+
"version": "4.1.0-dev.10",
|
|
4
4
|
"author": "Emerson Laurentino",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,12 +21,11 @@
|
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "20.19.13"
|
|
26
|
+
},
|
|
24
27
|
"scripts": {
|
|
25
28
|
"dev": "tsc --watch",
|
|
26
29
|
"build": "tsc"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
"@types/node": "catalog:"
|
|
30
|
-
},
|
|
31
|
-
"gitHead": "05674217b8f15f6fa8aa4d84148ab18f03a55c66"
|
|
32
|
-
}
|
|
30
|
+
}
|
|
31
|
+
}
|