@njweber/app-check 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Boolean Build (a Boolean Bros project)
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.
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ # app-check
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **One command to check a mobile build before the stores do.** `app-check` auto-detects the artifact,
4
+ runs the right audit, and aggregates the result:
5
+
6
+ ```bash
7
+ npx @njweber/app-check ./build/app-release.aab ./build/YourApp.ipa ./assets/icon.png
8
+ ```
9
+
10
+ | Artifact | What it's checked for | Under the hood |
11
+ |---|---|---|
12
+ | `*.aab`, `*.apk` | Android 16 KB page-size compliance | [`store-check`](https://github.com/nwebersoftware/store-check) |
13
+ | `*.ipa` | App Store submission pitfalls **and** privacy usage descriptions | [`ipa-check`](https://github.com/nwebersoftware/ipa-check) + [`privacy-check`](https://github.com/nwebersoftware/privacy-check) |
14
+ | `*.png` | icon size / alpha rules | [`icon-check`](https://github.com/nwebersoftware/icon-check) |
15
+
16
+ ```
17
+ ✓ store-check — 16 KB page-size audit
18
+ …
19
+ ✓ ipa-check — iOS submission audit
20
+ …
21
+ ✗ icon-check — app icon audit
22
+ ✗ ios-alpha has an alpha channel — the App Store icon must have NO transparency
23
+
24
+ ✗ app-check: 3 checks, 1 failed.
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```bash
30
+ # explicit files
31
+ npx @njweber/app-check ./app-release.aab ./YourApp.ipa
32
+
33
+ # scan a build directory (recursive; skips node_modules/.git/ios/android)
34
+ npx @njweber/app-check --dir ./dist
35
+
36
+ # options
37
+ npx @njweber/app-check ./assets/icon.png --android # adaptive-icon foreground rules
38
+ npx @njweber/app-check ./YourApp.ipa --bundle-id com.acme.app
39
+ npx @njweber/app-check --dir ./dist --json # machine-readable
40
+ ```
41
+
42
+ **Exit codes:** `0` all good · `1` at least one blocking issue · `2` bad input.
43
+
44
+ ## CI
45
+
46
+ ```yaml
47
+ - uses: nwebersoftware/app-check@main
48
+ with:
49
+ path: dist
50
+ ```
51
+
52
+ ## What it is not
53
+
54
+ It's a fast, offline pre-flight — not a substitute for the store's own validation. It catches the
55
+ *mechanical* rejections (alignment, plist shape, icon alpha) that are cheap to check and expensive
56
+ to discover mid-review.
57
+
58
+ ## Family
59
+
60
+ Each check is also its own focused tool: `store-check` · `ipa-check` · `privacy-check` · `icon-check`.
61
+
62
+ An `.ipa` deliberately runs **two** audits — submission shape (`ipa-check`) and privacy declarations
63
+ (`privacy-check`).
64
+
65
+ ## License
66
+
67
+ MIT.
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync, readdirSync } from 'node:fs';
3
+ import { extname, join } from 'node:path';
4
+
5
+ import { classify, checksFor, runCheck, SUPPORTED } from '../src/run.mjs';
6
+
7
+ const HELP = `app-check — check a mobile build before the stores do
8
+
9
+ Usage:
10
+ app-check <path...> [options]
11
+
12
+ Checks (auto-detected by extension):
13
+ *.aab, *.apk Android — 16 KB page size (store-check)
14
+ *.ipa iOS — submission pitfalls (ipa-check)
15
+ *.png icon rules (icon-check)
16
+
17
+ Options:
18
+ --dir <dir> also scan a directory for the above (recursive)
19
+ --android treat PNGs as Android adaptive-icon foregrounds
20
+ --bundle-id <id> expected iOS CFBundleIdentifier
21
+ --json machine-readable output
22
+ -h, --help
23
+
24
+ Exit: 0 all good · 1 blocking issue(s) · 2 bad input.
25
+ `;
26
+
27
+ function parse(argv) {
28
+ const paths = [];
29
+ const opts = { json: false, android: false, dir: null, bundleId: null };
30
+ for (let i = 0; i < argv.length; i++) {
31
+ const a = argv[i];
32
+ if (a === '--json') opts.json = true;
33
+ else if (a === '--android') opts.android = true;
34
+ else if (a === '--dir') opts.dir = argv[++i];
35
+ else if (a === '--bundle-id') opts.bundleId = argv[++i];
36
+ else if (a === '-h' || a === '--help') { process.stdout.write(HELP); process.exit(0); }
37
+ else if (a.startsWith('-')) { process.stderr.write(`unknown flag: ${a}\n`); process.exit(2); }
38
+ else paths.push(a);
39
+ }
40
+ return { paths, opts };
41
+ }
42
+
43
+ const SKIP = new Set(['node_modules', '.git', 'ios', 'android', '.expo']);
44
+
45
+ function collect(dir, out = []) {
46
+ for (const e of readdirSync(dir, { withFileTypes: true })) {
47
+ if (e.name.startsWith('.') || SKIP.has(e.name)) continue;
48
+ const p = join(dir, e.name);
49
+ if (e.isDirectory()) collect(p, out);
50
+ else if (SUPPORTED.includes(extname(e.name).toLowerCase())) out.push(p);
51
+ }
52
+ return out;
53
+ }
54
+
55
+ const { paths, opts } = parse(process.argv.slice(2));
56
+ const files = [...paths];
57
+ if (opts.dir) files.push(...collect(opts.dir));
58
+
59
+ if (files.length === 0) {
60
+ process.stderr.write(HELP);
61
+ process.exit(2);
62
+ }
63
+
64
+ const results = [];
65
+ let badInput = false;
66
+
67
+ for (const file of files) {
68
+ const kind = classify(file);
69
+ if (!kind) {
70
+ process.stderr.write(`skipped (unrecognized): ${file}\n`);
71
+ badInput = true;
72
+ continue;
73
+ }
74
+ let buf;
75
+ try {
76
+ buf = readFileSync(file);
77
+ } catch (e) {
78
+ process.stderr.write(`cannot read ${file}: ${e.message}\n`);
79
+ badInput = true;
80
+ continue;
81
+ }
82
+ for (const k of checksFor(kind)) {
83
+ const co = { label: file };
84
+ if (k === 'icon' && opts.android) co.platform = 'android';
85
+ if (k === 'ios' && opts.bundleId) co.bundleId = opts.bundleId;
86
+ results.push(runCheck(k, buf, co));
87
+ }
88
+ }
89
+
90
+ const failed = results.filter((r) => !r.report.ok).length;
91
+
92
+ if (opts.json) {
93
+ const payload = {
94
+ ok: failed === 0 && results.length > 0,
95
+ files: results.map((r) => ({
96
+ file: r.label,
97
+ tool: r.name,
98
+ ok: !!r.report.ok,
99
+ error: r.error,
100
+ checks: r.report.checks ?? undefined,
101
+ failures: r.report.failures?.map((f) => f.abi),
102
+ })),
103
+ };
104
+ process.stdout.write(JSON.stringify(payload, null, 2) + '\n');
105
+ } else {
106
+ for (const r of results) {
107
+ process.stdout.write(r.text + '\n');
108
+ process.stdout.write('\n' + '─'.repeat(60) + '\n\n');
109
+ }
110
+ const n = results.length;
111
+ const summary = `app-check: ${n} check${n === 1 ? '' : 's'}, ${failed} failed.`;
112
+ process.stdout.write(failed === 0 ? `✓ ${summary}\n` : `✗ ${summary}\n`);
113
+ }
114
+
115
+ if (results.length === 0) process.exit(2);
116
+ process.exit(failed > 0 ? 1 : 0);
package/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "@njweber/app-check",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "One command to check a mobile build before the stores do — Android 16 KB page size, iOS .ipa pitfalls, and icon rules.",
5
+ "type": "module",
6
+ "bin": {
7
+ "app-check": "bin/app-check.mjs"
8
+ },
9
+ "files": ["bin", "src", "README.md", "LICENSE"],
10
+ "scripts": {
11
+ "test": "node --test"
12
+ },
13
+ "keywords": ["ios", "android", "app-store", "google-play", "release", "submission", "react-native", "expo", "cli"],
14
+ "repository": { "type": "git", "url": "git+https://github.com/nwebersoftware/app-check.git" },
15
+ "homepage": "https://github.com/nwebersoftware/app-check#readme",
16
+ "bugs": { "url": "https://github.com/nwebersoftware/app-check/issues" },
17
+ "author": "Boolean Build (a Boolean Bros project)",
18
+ "license": "MIT",
19
+ "engines": { "node": ">=18" },
20
+ "dependencies": {
21
+ "@njweber/store-check": "^0.1.0",
22
+ "@njweber/ipa-check": "^0.1.0",
23
+ "@njweber/privacy-check": "^0.1.0",
24
+ "icon-check": "^0.1.0"
25
+ }
26
+ }
package/src/run.mjs ADDED
@@ -0,0 +1,51 @@
1
+ import { checkArtifact, formatReport as fmtAndroid } from '@njweber/store-check/src/check.mjs';
2
+ import { checkIpa, formatReport as fmtIpa } from '@njweber/ipa-check/src/check.mjs';
3
+ import { checkPrivacy, formatReport as fmtPrivacy } from '@njweber/privacy-check/src/check.mjs';
4
+ import { checkIcon, formatReport as fmtIcon } from 'icon-check/src/check.mjs';
5
+
6
+ const TOOLS = {
7
+ android: { name: 'store-check', run: (buf) => checkArtifact(buf), fmt: fmtAndroid },
8
+ ios: { name: 'ipa-check', run: (buf, o) => checkIpa(buf, o), fmt: fmtIpa },
9
+ privacy: { name: 'privacy-check', run: (buf) => checkPrivacy(buf), fmt: fmtPrivacy },
10
+ icon: { name: 'icon-check', run: (buf, o) => checkIcon(buf, o), fmt: fmtIcon },
11
+ };
12
+
13
+ /** Map a file path to the primary check that applies, by extension. */
14
+ export function classify(file) {
15
+ const lower = String(file).toLowerCase();
16
+ if (lower.endsWith('.aab') || lower.endsWith('.apk')) return 'android';
17
+ if (lower.endsWith('.ipa')) return 'ios';
18
+ if (lower.endsWith('.png')) return 'icon';
19
+ return null;
20
+ }
21
+
22
+ /** Every check that should run for an artifact kind (an .ipa gets two audits). */
23
+ export function checksFor(kind) {
24
+ if (kind === 'ios') return ['ios', 'privacy'];
25
+ return [kind];
26
+ }
27
+
28
+ /**
29
+ * Run one check, never throwing: a bad artifact becomes a failing result, not a crash.
30
+ * Returns { kind, name, label, report, text, error }.
31
+ */
32
+ export function runCheck(kind, buf, opts = {}) {
33
+ const t = TOOLS[kind];
34
+ if (!t) throw new Error(`unknown check kind: ${kind}`);
35
+ const label = opts.label ?? '';
36
+ try {
37
+ const report = t.run(buf, opts);
38
+ return { kind, name: t.name, label, report, text: t.fmt(report, label), error: null };
39
+ } catch (e) {
40
+ return {
41
+ kind,
42
+ name: t.name,
43
+ label,
44
+ report: { ok: false },
45
+ text: `${t.name} — could not check ${label || 'input'}\n ${e.message}`,
46
+ error: e.message,
47
+ };
48
+ }
49
+ }
50
+
51
+ export const SUPPORTED = ['.aab', '.apk', '.ipa', '.png'];