@njweber/app-check 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +63 -2
- package/bin/app-check.mjs +114 -0
- package/package.json +23 -4
- package/src/run.mjs +43 -0
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,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# app-check
|
|
2
2
|
|
|
3
|
-
|
|
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 | [`ipa-check`](https://github.com/nwebersoftware/ipa-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` · `icon-check`.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync, readdirSync } from 'node:fs';
|
|
3
|
+
import { extname, join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
import { classify, 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
|
+
const co = { label: file };
|
|
83
|
+
if (kind === 'icon' && opts.android) co.platform = 'android';
|
|
84
|
+
if (kind === 'ios' && opts.bundleId) co.bundleId = opts.bundleId;
|
|
85
|
+
results.push(runCheck(kind, buf, co));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const failed = results.filter((r) => !r.report.ok).length;
|
|
89
|
+
|
|
90
|
+
if (opts.json) {
|
|
91
|
+
const payload = {
|
|
92
|
+
ok: failed === 0 && results.length > 0,
|
|
93
|
+
files: results.map((r) => ({
|
|
94
|
+
file: r.label,
|
|
95
|
+
tool: r.name,
|
|
96
|
+
ok: !!r.report.ok,
|
|
97
|
+
error: r.error,
|
|
98
|
+
checks: r.report.checks ?? undefined,
|
|
99
|
+
failures: r.report.failures?.map((f) => f.abi),
|
|
100
|
+
})),
|
|
101
|
+
};
|
|
102
|
+
process.stdout.write(JSON.stringify(payload, null, 2) + '\n');
|
|
103
|
+
} else {
|
|
104
|
+
for (const r of results) {
|
|
105
|
+
process.stdout.write(r.text + '\n');
|
|
106
|
+
process.stdout.write('\n' + '─'.repeat(60) + '\n\n');
|
|
107
|
+
}
|
|
108
|
+
const n = results.length;
|
|
109
|
+
const summary = `app-check: ${n} check${n === 1 ? '' : 's'}, ${failed} failed.`;
|
|
110
|
+
process.stdout.write(failed === 0 ? `✓ ${summary}\n` : `✗ ${summary}\n`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (results.length === 0) process.exit(2);
|
|
114
|
+
process.exit(failed > 0 ? 1 : 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@njweber/app-check",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"icon-check": "^0.1.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/run.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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 { checkIcon, formatReport as fmtIcon } from 'icon-check/src/check.mjs';
|
|
4
|
+
|
|
5
|
+
const TOOLS = {
|
|
6
|
+
android: { name: 'store-check', run: (buf) => checkArtifact(buf), fmt: fmtAndroid },
|
|
7
|
+
ios: { name: 'ipa-check', run: (buf, o) => checkIpa(buf, o), fmt: fmtIpa },
|
|
8
|
+
icon: { name: 'icon-check', run: (buf, o) => checkIcon(buf, o), fmt: fmtIcon },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Map a file path to the check that applies, by extension. */
|
|
12
|
+
export function classify(file) {
|
|
13
|
+
const lower = String(file).toLowerCase();
|
|
14
|
+
if (lower.endsWith('.aab') || lower.endsWith('.apk')) return 'android';
|
|
15
|
+
if (lower.endsWith('.ipa')) return 'ios';
|
|
16
|
+
if (lower.endsWith('.png')) return 'icon';
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Run one check, never throwing: a bad artifact becomes a failing result, not a crash.
|
|
22
|
+
* Returns { kind, name, label, report, text, error }.
|
|
23
|
+
*/
|
|
24
|
+
export function runCheck(kind, buf, opts = {}) {
|
|
25
|
+
const t = TOOLS[kind];
|
|
26
|
+
if (!t) throw new Error(`unknown check kind: ${kind}`);
|
|
27
|
+
const label = opts.label ?? '';
|
|
28
|
+
try {
|
|
29
|
+
const report = t.run(buf, opts);
|
|
30
|
+
return { kind, name: t.name, label, report, text: t.fmt(report, label), error: null };
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return {
|
|
33
|
+
kind,
|
|
34
|
+
name: t.name,
|
|
35
|
+
label,
|
|
36
|
+
report: { ok: false },
|
|
37
|
+
text: `${t.name} — could not check ${label || 'input'}\n ${e.message}`,
|
|
38
|
+
error: e.message,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const SUPPORTED = ['.aab', '.apk', '.ipa', '.png'];
|