@proappstore/compliance 0.2.3 → 0.2.4
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.
|
@@ -2,13 +2,15 @@ import type { FileSource } from '../lib/file-source.js';
|
|
|
2
2
|
import type { CheckResult } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Verifies `web/index.html` declares the basics: a `lang` attribute, a
|
|
5
|
-
* viewport meta,
|
|
5
|
+
* viewport meta, a non-empty `<title>`, and shared-link preview images.
|
|
6
|
+
* These together cover:
|
|
6
7
|
*
|
|
7
8
|
* - lang → screen readers + auto-translate work correctly
|
|
8
9
|
* - viewport → mobile rendering is sized to device, not desktop default
|
|
9
10
|
* - title → the only thing visible in tabs, history, search results
|
|
11
|
+
* - preview images → the app URL shares with the app's own visual identity
|
|
10
12
|
*
|
|
11
|
-
*
|
|
13
|
+
* These fields are baked into the canonical template — this check exists
|
|
12
14
|
* to catch creators who edited index.html and accidentally stripped
|
|
13
15
|
* something they needed.
|
|
14
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-meta.d.ts","sourceRoot":"","sources":["../../src/checks/html-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C
|
|
1
|
+
{"version":3,"file":"html-meta.d.ts","sourceRoot":"","sources":["../../src/checks/html-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAoC5E"}
|
package/dist/checks/html-meta.js
CHANGED
|
@@ -2,13 +2,15 @@ import { stripHtmlComments } from '../lib/strip.js';
|
|
|
2
2
|
const HTML_PATH = 'web/index.html';
|
|
3
3
|
/**
|
|
4
4
|
* Verifies `web/index.html` declares the basics: a `lang` attribute, a
|
|
5
|
-
* viewport meta,
|
|
5
|
+
* viewport meta, a non-empty `<title>`, and shared-link preview images.
|
|
6
|
+
* These together cover:
|
|
6
7
|
*
|
|
7
8
|
* - lang → screen readers + auto-translate work correctly
|
|
8
9
|
* - viewport → mobile rendering is sized to device, not desktop default
|
|
9
10
|
* - title → the only thing visible in tabs, history, search results
|
|
11
|
+
* - preview images → the app URL shares with the app's own visual identity
|
|
10
12
|
*
|
|
11
|
-
*
|
|
13
|
+
* These fields are baked into the canonical template — this check exists
|
|
12
14
|
* to catch creators who edited index.html and accidentally stripped
|
|
13
15
|
* something they needed.
|
|
14
16
|
*/
|
|
@@ -36,15 +38,19 @@ export async function checkHtmlMeta(source) {
|
|
|
36
38
|
const titleMatch = html.match(/<title>([\s\S]*?)<\/title>/i);
|
|
37
39
|
if (!titleMatch || titleMatch[1].trim() === '')
|
|
38
40
|
missing.push('non-empty <title>');
|
|
41
|
+
if (!/<meta[^>]*\bproperty\s*=\s*["']og:image["'][^>]*\bcontent\s*=/i.test(html))
|
|
42
|
+
missing.push('og:image');
|
|
43
|
+
if (!/<meta[^>]*\bname\s*=\s*["']twitter:image["'][^>]*\bcontent\s*=/i.test(html))
|
|
44
|
+
missing.push('twitter:image');
|
|
39
45
|
if (missing.length === 0) {
|
|
40
|
-
return { name: 'HTML meta tags', status: 'pass', detail: 'lang + viewport + title present' };
|
|
46
|
+
return { name: 'HTML meta tags', status: 'pass', detail: 'lang + viewport + title + share images present' };
|
|
41
47
|
}
|
|
42
48
|
return {
|
|
43
49
|
name: 'HTML meta tags',
|
|
44
50
|
status: 'fail',
|
|
45
51
|
detail: `missing: ${missing.join(', ')}`,
|
|
46
52
|
suggestions: [
|
|
47
|
-
'Restore the canonical <head>: `<html lang="en">`,
|
|
53
|
+
'Restore the canonical <head>: `<html lang="en">`, viewport, title, and `og:image` / `twitter:image` pointing at `/og-image.png`.',
|
|
48
54
|
],
|
|
49
55
|
};
|
|
50
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-meta.js","sourceRoot":"","sources":["../../src/checks/html-meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"html-meta.js","sourceRoot":"","sources":["../../src/checks/html-meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAkB;IACpD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO;YACL,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,GAAG,SAAS,YAAY;SACjC,CAAC;IACJ,CAAC;IACD,gEAAgE;IAChE,qEAAqE;IACrE,wCAAwC;IACxC,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAClF,IAAI,CAAC,0CAA0C,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC1F,kEAAkE;IAClE,2EAA2E;IAC3E,yCAAyC;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,6BAA6B,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