@uxfront/site-checks 0.1.0 → 0.1.1
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 +19 -19
- package/bin/site-checks.js +3 -3
- package/index.d.ts +260 -259
- package/lib/check.js +222 -196
- package/lib/cli.js +59 -56
- package/lib/html.js +166 -137
- package/lib/rules.js +1194 -1046
- package/lib/site.js +534 -501
- package/lib/validate.js +140 -117
- package/lighthouse.d.ts +26 -24
- package/lighthouse.js +52 -48
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,10 +21,10 @@ Write a config next to your site's `package.json`. Its default export holds the
|
|
|
21
21
|
import { defineConfig } from "@uxfront/site-checks";
|
|
22
22
|
|
|
23
23
|
export default defineConfig({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
site: "https://inkline.io",
|
|
25
|
+
rules: {
|
|
26
|
+
"sitemap-pages": { paths: "lookup" },
|
|
27
|
+
},
|
|
28
28
|
});
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -32,9 +32,9 @@ Then run the check on the build:
|
|
|
32
32
|
|
|
33
33
|
```json
|
|
34
34
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
"scripts": {
|
|
36
|
+
"check:seo": "site-checks seo .output/public"
|
|
37
|
+
}
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -192,17 +192,17 @@ A check only one site needs can live in its config, and runs on the same parsed
|
|
|
192
192
|
```js
|
|
193
193
|
// site-checks.config.mjs
|
|
194
194
|
export default {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
195
|
+
site: "https://opencomponents.dev",
|
|
196
|
+
extraRules: [
|
|
197
|
+
{
|
|
198
|
+
id: "schema-cors",
|
|
199
|
+
check({ site, headersFor, report }) {
|
|
200
|
+
const url = `${site}/schemas/contract.json`;
|
|
201
|
+
const cors = headersFor(url).find(([name]) => name === "access-control-allow-origin");
|
|
202
|
+
if (cors?.[1] !== "*") report(url, "no Access-Control-Allow-Origin: *");
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
206
|
};
|
|
207
207
|
```
|
|
208
208
|
|
|
@@ -227,7 +227,7 @@ export default {
|
|
|
227
227
|
import { lighthouseConfig } from "@uxfront/site-checks/lighthouse";
|
|
228
228
|
|
|
229
229
|
export default lighthouseConfig({
|
|
230
|
-
|
|
230
|
+
collect: { staticDistDir: "dist", url: ["http://localhost/"] },
|
|
231
231
|
});
|
|
232
232
|
```
|
|
233
233
|
|
package/bin/site-checks.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { main } from "../lib/cli.js";
|
|
3
3
|
|
|
4
4
|
process.exitCode = await main(process.argv.slice(2), {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
out: (text) => process.stdout.write(text),
|
|
6
|
+
err: (text) => process.stderr.write(text),
|
|
7
|
+
cwd: process.cwd(),
|
|
8
8
|
});
|