@freeappstore/compliance 0.1.0 → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FreeAppStore
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ import type { CheckResult } from '../types.js';
2
+ /**
3
+ * Apps and games on the platform must look consistent with the storefront
4
+ * and with each other — brand colors, fonts, and layout rhythm come from
5
+ * the template, not the app. This check fails on the most common forms of
6
+ * brand-override drift:
7
+ *
8
+ * 1. Custom CSS variable overrides for the platform-defined tokens
9
+ * (--paper, --ink, --accent, --line, --panel, --muted). These are
10
+ * defined by the template; an app redefining them changes the brand.
11
+ * 2. Custom font-family declarations beyond the brand stack
12
+ * (Manrope, Fraunces) and the system / monospace fallbacks.
13
+ *
14
+ * What's allowed:
15
+ * - Using the variables (color: var(--accent)) — that's the whole point.
16
+ * - Hardcoded colors for non-brand purposes (highlight states, error
17
+ * red, etc.). We don't try to gate every hex literal — too noisy and
18
+ * too many false positives.
19
+ */
20
+ export declare function checkNoBrandOverrides(repoDir: string): Promise<CheckResult>;
21
+ export declare function scanContent(filename: string, content: string, opts?: {
22
+ skipVarRedefs?: boolean;
23
+ }): string[];
24
+ //# sourceMappingURL=no-brand-overrides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-brand-overrides.d.ts","sourceRoot":"","sources":["../../src/checks/no-brand-overrides.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAwCjF;AA2DD,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,MAAM,EAAE,CAyCV"}
@@ -0,0 +1,164 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { extname, relative } from 'node:path';
3
+ import { walk } from '../lib/walk.js';
4
+ /**
5
+ * Apps and games on the platform must look consistent with the storefront
6
+ * and with each other — brand colors, fonts, and layout rhythm come from
7
+ * the template, not the app. This check fails on the most common forms of
8
+ * brand-override drift:
9
+ *
10
+ * 1. Custom CSS variable overrides for the platform-defined tokens
11
+ * (--paper, --ink, --accent, --line, --panel, --muted). These are
12
+ * defined by the template; an app redefining them changes the brand.
13
+ * 2. Custom font-family declarations beyond the brand stack
14
+ * (Manrope, Fraunces) and the system / monospace fallbacks.
15
+ *
16
+ * What's allowed:
17
+ * - Using the variables (color: var(--accent)) — that's the whole point.
18
+ * - Hardcoded colors for non-brand purposes (highlight states, error
19
+ * red, etc.). We don't try to gate every hex literal — too noisy and
20
+ * too many false positives.
21
+ */
22
+ export async function checkNoBrandOverrides(repoDir) {
23
+ const issues = [];
24
+ for await (const file of walk(repoDir)) {
25
+ const ext = extname(file).toLowerCase();
26
+ if (!SCANNED_EXTS.has(ext))
27
+ continue;
28
+ const content = await readFile(file, 'utf8').catch(() => '');
29
+ if (!content)
30
+ continue;
31
+ const rel = relative(repoDir, file);
32
+ // Canonical theme file: the platform's CSS variables ARE defined here.
33
+ // Apps own this file post-scaffold (they can technically modify token
34
+ // values, and we accept the imperfection — the loud places where a
35
+ // brand override actually causes inconsistency are inline styles +
36
+ // per-component CSS, which this check still covers).
37
+ const isThemeFile = rel === 'web/src/index.css' || rel === 'web/src/main.css';
38
+ const fileIssues = scanContent(rel, content, { skipVarRedefs: isThemeFile });
39
+ issues.push(...fileIssues);
40
+ // Cap at 10 — beyond that the user has bigger problems and we don't
41
+ // want a 200-line failure report.
42
+ if (issues.length >= 10)
43
+ break;
44
+ }
45
+ if (issues.length === 0) {
46
+ return {
47
+ name: 'No brand overrides',
48
+ status: 'pass',
49
+ detail: 'apps inherit colors + fonts from the template',
50
+ };
51
+ }
52
+ return {
53
+ name: 'No brand overrides',
54
+ status: 'fail',
55
+ detail: `${issues.length} apparent override${issues.length === 1 ? '' : 's'}`,
56
+ suggestions: [
57
+ ...issues.slice(0, 5),
58
+ ...(issues.length > 5 ? [`...and ${issues.length - 5} more`] : []),
59
+ 'Use the template tokens (var(--accent), var(--ink), etc.) instead of redefining them.',
60
+ 'Brand fonts are Manrope (body) + Fraunces (display). Stick to those + system / monospace.',
61
+ ],
62
+ };
63
+ }
64
+ const SCANNED_EXTS = new Set(['.css', '.scss', '.tsx', '.ts', '.jsx', '.js', '.html']);
65
+ const PROTECTED_VARS = new Set([
66
+ '--paper',
67
+ '--ink',
68
+ '--muted',
69
+ '--accent',
70
+ '--line',
71
+ '--line-strong',
72
+ '--panel',
73
+ ]);
74
+ /**
75
+ * Whitelist of font-family declarations we accept. Anything outside this
76
+ * set — for ANY font name not in the brand stack and not a generic /
77
+ * system fallback — flags. The check is case-insensitive.
78
+ */
79
+ const ALLOWED_FONT_TOKENS = new Set([
80
+ // Brand stack
81
+ 'manrope',
82
+ 'fraunces',
83
+ // Generic/system fallbacks (CSS keywords)
84
+ 'serif',
85
+ 'sans-serif',
86
+ 'monospace',
87
+ 'system-ui',
88
+ 'ui-monospace',
89
+ 'ui-serif',
90
+ 'ui-sans-serif',
91
+ 'inherit',
92
+ 'initial',
93
+ 'unset',
94
+ 'revert',
95
+ // Common system stack names — these are aliases, not custom fonts.
96
+ '-apple-system',
97
+ 'blinkmacsystemfont',
98
+ 'segoe ui',
99
+ 'roboto',
100
+ 'helvetica',
101
+ 'helvetica neue',
102
+ 'arial',
103
+ 'sf mono',
104
+ 'sf pro',
105
+ 'menlo',
106
+ 'monaco',
107
+ 'consolas',
108
+ 'liberation mono',
109
+ 'courier',
110
+ 'courier new',
111
+ 'georgia',
112
+ 'noto sans',
113
+ 'noto color emoji',
114
+ 'apple color emoji',
115
+ 'segoe ui emoji',
116
+ 'segoe ui symbol',
117
+ ]);
118
+ export function scanContent(filename, content, opts = {}) {
119
+ const out = [];
120
+ // 1. CSS variable overrides for protected tokens.
121
+ // Match `--accent: <something>;` outside of var() invocations.
122
+ // The regex looks for "<two dashes><name>:" near the start of a line,
123
+ // which is how CSS declarations look. var(--accent) won't match because
124
+ // there's a `(` not a `:`.
125
+ if (!opts.skipVarRedefs) {
126
+ const varDeclRe = /(?:^|[\s;{,])(--[a-z-]+)\s*:/gim;
127
+ let m;
128
+ while ((m = varDeclRe.exec(content)) !== null) {
129
+ const name = m[1];
130
+ if (PROTECTED_VARS.has(name)) {
131
+ const line = lineNumberAt(content, m.index);
132
+ out.push(`${filename}:${line} redefines ${name} (template owns this token)`);
133
+ }
134
+ }
135
+ }
136
+ // 2. font-family overrides. Pull every string after `font-family:` (in
137
+ // CSS) or `fontFamily:` (in JSX/TS), parse the comma-separated list,
138
+ // and flag any quoted token not in ALLOWED_FONT_TOKENS.
139
+ const fontRe = /(?:font-family|fontFamily)\s*[:=]\s*["'`]?([^;"'`}\n]+)["'`]?/g;
140
+ let m;
141
+ while ((m = fontRe.exec(content)) !== null) {
142
+ const list = m[1];
143
+ const tokens = list
144
+ .split(',')
145
+ .map((t) => t.trim().replace(/^["']|["']$/g, '').toLowerCase())
146
+ .filter(Boolean);
147
+ for (const t of tokens) {
148
+ if (!ALLOWED_FONT_TOKENS.has(t)) {
149
+ const line = lineNumberAt(content, m.index);
150
+ out.push(`${filename}:${line} non-brand font "${t}"`);
151
+ break; // one warning per declaration is plenty
152
+ }
153
+ }
154
+ }
155
+ return out;
156
+ }
157
+ function lineNumberAt(content, index) {
158
+ let n = 1;
159
+ for (let i = 0; i < index; i++)
160
+ if (content.charCodeAt(i) === 10)
161
+ n++;
162
+ return n;
163
+ }
164
+ //# sourceMappingURL=no-brand-overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-brand-overrides.js","sourceRoot":"","sources":["../../src/checks/no-brand-overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAe;IACzD,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QACrC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC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,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;QAAE,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE;YAAE,CAAC,EAAE,CAAC;IACtE,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=no-brand-overrides.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-brand-overrides.test.d.ts","sourceRoot":"","sources":["../../src/checks/no-brand-overrides.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,102 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { mkdtemp, mkdir, writeFile } from 'node:fs/promises';
3
+ import { tmpdir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { checkNoBrandOverrides, scanContent } from './no-brand-overrides.js';
6
+ async function fixture(files) {
7
+ const dir = await mkdtemp(join(tmpdir(), 'fas-brand-'));
8
+ for (const [path, content] of Object.entries(files)) {
9
+ const full = join(dir, path);
10
+ await mkdir(join(full, '..'), { recursive: true });
11
+ await writeFile(full, content);
12
+ }
13
+ return dir;
14
+ }
15
+ describe('scanContent (unit)', () => {
16
+ it('flags an override of a protected CSS variable', () => {
17
+ const issues = scanContent('web/src/index.css', `
18
+ :root { --accent: hotpink; }
19
+ `);
20
+ expect(issues).toHaveLength(1);
21
+ expect(issues[0]).toMatch(/--accent/);
22
+ });
23
+ it('does NOT flag using the variable via var()', () => {
24
+ const issues = scanContent('web/src/App.tsx', `
25
+ <div style={{ color: 'var(--accent)' }} />
26
+ `);
27
+ expect(issues).toEqual([]);
28
+ });
29
+ it('does not flag a non-protected custom variable (apps can have their own)', () => {
30
+ const issues = scanContent('web/src/index.css', `
31
+ :root { --my-shadow: 0 0 4px black; }
32
+ `);
33
+ expect(issues).toEqual([]);
34
+ });
35
+ it('flags a non-brand font-family in CSS', () => {
36
+ const issues = scanContent('web/src/index.css', `
37
+ h1 { font-family: "Cormorant Garamond", serif; }
38
+ `);
39
+ expect(issues).toHaveLength(1);
40
+ expect(issues[0]).toMatch(/cormorant garamond/);
41
+ });
42
+ it('flags a non-brand font in inline JSX styles', () => {
43
+ const issues = scanContent('web/src/App.tsx', `
44
+ <h1 style={{ fontFamily: "Sora, sans-serif" }} />
45
+ `);
46
+ expect(issues).toHaveLength(1);
47
+ expect(issues[0]).toMatch(/sora/);
48
+ });
49
+ it('accepts brand fonts and system fallbacks', () => {
50
+ const issues = scanContent('web/src/index.css', `
51
+ body { font-family: "Manrope", system-ui, sans-serif; }
52
+ h1 { font-family: Fraunces, Georgia, serif; }
53
+ code { font-family: "SF Mono", Menlo, monospace; }
54
+ `);
55
+ expect(issues).toEqual([]);
56
+ });
57
+ it('reports line numbers', () => {
58
+ const issues = scanContent('web/src/index.css', `\n\n:root { --paper: red; }\n`);
59
+ expect(issues[0]).toMatch(/:3 /);
60
+ });
61
+ });
62
+ describe('checkNoBrandOverrides (integration)', () => {
63
+ it('passes when all CSS uses brand tokens', async () => {
64
+ const dir = await fixture({
65
+ 'web/src/index.css': `
66
+ :root { --my-extra: 4px; }
67
+ body { font-family: Manrope, system-ui, sans-serif; }
68
+ h1 { font-family: Fraunces, serif; color: var(--accent); }
69
+ `,
70
+ });
71
+ const r = await checkNoBrandOverrides(dir);
72
+ expect(r.status).toBe('pass');
73
+ });
74
+ it('fails when an app overrides a protected variable in a non-theme CSS file', async () => {
75
+ // web/src/index.css is the canonical theme file (exempt). Per-component
76
+ // CSS like this isn't.
77
+ const dir = await fixture({
78
+ 'web/src/components/Branding.css': `:root { --accent: deeppink; }`,
79
+ });
80
+ const r = await checkNoBrandOverrides(dir);
81
+ expect(r.status).toBe('fail');
82
+ expect(r.detail).toMatch(/override/);
83
+ expect(r.suggestions?.join(' ')).toMatch(/var\(--accent\)/);
84
+ });
85
+ it('does NOT fail when web/src/index.css legitimately defines tokens (template-owned)', async () => {
86
+ const dir = await fixture({
87
+ 'web/src/index.css': `:root { --paper: #ffffff; --ink: #1a1a1a; --accent: #2563eb; }`,
88
+ });
89
+ const r = await checkNoBrandOverrides(dir);
90
+ expect(r.status).toBe('pass');
91
+ });
92
+ it('fails when an app uses non-brand fonts', async () => {
93
+ const dir = await fixture({
94
+ 'web/src/App.tsx': `
95
+ const h1 = <h1 style={{ fontFamily: "Cormorant Garamond, serif" }} />;
96
+ `,
97
+ });
98
+ const r = await checkNoBrandOverrides(dir);
99
+ expect(r.status).toBe('fail');
100
+ });
101
+ });
102
+ //# sourceMappingURL=no-brand-overrides.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-brand-overrides.test.js","sourceRoot":"","sources":["../../src/checks/no-brand-overrides.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE7E,KAAK,UAAU,OAAO,CAAC,KAA6B;IAClD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC;IACxD,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC;AAC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AM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mFAAmF,EAAE,KAAK,IAAI,EAAE;QACjG,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;YACxB,mBAAmB,EAAE,gEAAgE;SACtF,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;YACxB,iBAAiB,EAAE;;OAElB;SACF,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { checkNoPlaceholders } from './checks/no-placeholders.js';
2
2
  import { checkNoTracking } from './checks/no-tracking.js';
3
3
  import { checkBrandFonts } from './checks/brand-fonts.js';
4
+ import { checkNoBrandOverrides } from './checks/no-brand-overrides.js';
4
5
  import { checkManifest } from './checks/manifest.js';
5
6
  import { checkBundleSize } from './checks/bundle-size.js';
6
7
  import type { CheckResult } from './types.js';
7
8
  export type { CheckStatus, CheckResult } from './types.js';
8
- export { checkNoPlaceholders, checkNoTracking, checkBrandFonts, checkManifest, checkBundleSize, };
9
+ export { checkNoPlaceholders, checkNoTracking, checkBrandFonts, checkNoBrandOverrides, checkManifest, checkBundleSize, };
9
10
  /**
10
11
  * Runs every compliance check against `repoDir` (the root of an app, the
11
12
  * directory containing package.json + web/). Returns results in a stable
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,GAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAQvE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,eAAe,GAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CASvE"}
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { checkNoPlaceholders } from './checks/no-placeholders.js';
2
2
  import { checkNoTracking } from './checks/no-tracking.js';
3
3
  import { checkBrandFonts } from './checks/brand-fonts.js';
4
+ import { checkNoBrandOverrides } from './checks/no-brand-overrides.js';
4
5
  import { checkManifest } from './checks/manifest.js';
5
6
  import { checkBundleSize } from './checks/bundle-size.js';
6
- export { checkNoPlaceholders, checkNoTracking, checkBrandFonts, checkManifest, checkBundleSize, };
7
+ export { checkNoPlaceholders, checkNoTracking, checkBrandFonts, checkNoBrandOverrides, checkManifest, checkBundleSize, };
7
8
  /**
8
9
  * Runs every compliance check against `repoDir` (the root of an app, the
9
10
  * directory containing package.json + web/). Returns results in a stable
@@ -14,6 +15,7 @@ export async function runChecks(repoDir) {
14
15
  checkNoPlaceholders(repoDir),
15
16
  checkNoTracking(repoDir),
16
17
  checkBrandFonts(repoDir),
18
+ checkNoBrandOverrides(repoDir),
17
19
  checkManifest(repoDir),
18
20
  checkBundleSize(repoDir),
19
21
  ]);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,GAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,mBAAmB,CAAC,OAAO,CAAC;QAC5B,eAAe,CAAC,OAAO,CAAC;QACxB,eAAe,CAAC,OAAO,CAAC;QACxB,aAAa,CAAC,OAAO,CAAC;QACtB,eAAe,CAAC,OAAO,CAAC;KACzB,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,eAAe,GAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,mBAAmB,CAAC,OAAO,CAAC;QAC5B,eAAe,CAAC,OAAO,CAAC;QACxB,eAAe,CAAC,OAAO,CAAC;QACxB,qBAAqB,CAAC,OAAO,CAAC;QAC9B,aAAa,CAAC,OAAO,CAAC;QACtB,eAAe,CAAC,OAAO,CAAC;KACzB,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freeappstore/compliance",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Compliance checks for apps published on freeappstore.online — used by the CLI for local feedback and by CI for gating.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,13 +35,13 @@
35
35
  "engines": {
36
36
  "node": ">=22"
37
37
  },
38
- "scripts": {
39
- "build": "tsc",
40
- "typecheck": "tsc --noEmit"
41
- },
42
38
  "devDependencies": {
43
39
  "@types/node": "^22.0.0",
44
40
  "typescript": "^5.7.0"
45
41
  },
46
- "sideEffects": false
47
- }
42
+ "sideEffects": false,
43
+ "scripts": {
44
+ "build": "tsc",
45
+ "typecheck": "tsc --noEmit"
46
+ }
47
+ }