deeplink-parity 0.4.0 → 0.5.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.
Files changed (3) hide show
  1. package/README.md +29 -0
  2. package/dist/cli.js +35 -20
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -97,6 +97,35 @@ npx deeplink-parity . --sha256 "AB:CD:…" # include the fingerpri
97
97
  The Android signing fingerprint comes from Play Console → App integrity → App signing.
98
98
  Without it the fingerprint check is skipped and reported as such.
99
99
 
100
+ ### GitHub Action
101
+
102
+ ```yaml
103
+ - uses: camosss/deeplink-parity@v1
104
+ with:
105
+ paths: ios android # one per checkout; omit for a single repo
106
+ sha256: ${{ secrets.ANDROID_SHA256 }}
107
+ ```
108
+
109
+ Findings appear as annotations on the run, and counts are available to later steps:
110
+
111
+ ```yaml
112
+ - uses: camosss/deeplink-parity@v1
113
+ id: links
114
+ with:
115
+ fail-on: never # report without blocking while a backlog is cleared
116
+ - run: echo "${{ steps.links.outputs.errors }} errors, ${{ steps.links.outputs.warnings }} warnings"
117
+ ```
118
+
119
+ | Input | Default | |
120
+ |---|---|---|
121
+ | `paths` | `.` | Checkout paths, whitespace separated |
122
+ | `sha256` | — | Android signing fingerprint |
123
+ | `well-known` | — | Read from disk instead of the network |
124
+ | `fail-on` | `error` | `never` to report without failing the step |
125
+ | `version` | pinned | npm version to run |
126
+
127
+ Outputs: `errors`, `warnings`, `notices`, `domains`, `report` (path to the JSON result).
128
+
100
129
  ### In CI
101
130
 
102
131
  | Exit code | Meaning |
package/dist/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { writeFile } from 'node:fs/promises';
2
3
  import { resolve } from 'node:path';
3
4
  import { localSource, networkSource } from './fetch/wellKnown.js';
4
5
  import { exitCodeFor, printReport } from './report/console.js';
@@ -18,7 +19,8 @@ Usage
18
19
  Options
19
20
  --sha256 <fingerprint> Android signing fingerprint to look for in assetlinks.json
20
21
  --well-known <dir> Read well-known files from <dir>/<domain>/ instead of the network
21
- --json Machine-readable output
22
+ --json Machine-readable output on stdout
23
+ --output <file> Also write the JSON result to a file
22
24
  --format github GitHub Actions annotations (auto-detected on Actions)
23
25
  -h, --help Show this message
24
26
  `;
@@ -29,6 +31,7 @@ function parseArgs(argv) {
29
31
  let help = false;
30
32
  let sha256;
31
33
  let wellKnown;
34
+ let output;
32
35
  // Actions sets GITHUB_ACTIONS=true; annotate by default there
33
36
  let format = process.env.GITHUB_ACTIONS === 'true' ? 'github' : 'console';
34
37
  for (let i = 0; i < args.length; i++) {
@@ -43,6 +46,8 @@ function parseArgs(argv) {
43
46
  wellKnown = args[++i];
44
47
  else if (arg === '--format')
45
48
  format = args[++i];
49
+ else if (arg === '--output')
50
+ output = args[++i];
46
51
  else if (!arg.startsWith('-'))
47
52
  roots.push(arg);
48
53
  }
@@ -53,10 +58,11 @@ function parseArgs(argv) {
53
58
  sha256,
54
59
  wellKnown,
55
60
  format,
61
+ output,
56
62
  };
57
63
  }
58
64
  async function main() {
59
- const { roots, json, help, sha256, wellKnown, format } = parseArgs(process.argv);
65
+ const { roots, json, help, sha256, wellKnown, format, output } = parseArgs(process.argv);
60
66
  if (help) {
61
67
  console.log(USAGE);
62
68
  return;
@@ -78,27 +84,36 @@ async function main() {
78
84
  console.error('Expected a .entitlements file with applinks:, or an AndroidManifest.xml with intent-filters.');
79
85
  process.exit(2);
80
86
  }
87
+ const payload = {
88
+ ios: result.iosApps.map((a) => ({
89
+ entitlements: a.entitlementsPath,
90
+ teamId: a.teamId,
91
+ bundleId: a.bundleId,
92
+ domains: a.domains,
93
+ })),
94
+ android: result.androidApps.map((a) => ({
95
+ manifest: a.manifestPath,
96
+ packageIds: a.packageIds,
97
+ hosts: a.hosts.map((h) => h.host),
98
+ })),
99
+ summary: {
100
+ domains: result.domains.length,
101
+ error: result.findings.filter((f) => f.severity === 'error').length,
102
+ warn: result.findings.filter((f) => f.severity === 'warn').length,
103
+ info: result.findings.filter((f) => f.severity === 'info').length,
104
+ },
105
+ findings: result.findings,
106
+ };
107
+ // A file keeps stdout free, so annotations and the readable report can coexist with
108
+ // machine-readable output in the same run.
109
+ if (output)
110
+ await writeFile(output, `${JSON.stringify(payload, null, 2)}\n`);
81
111
  if (json) {
82
- console.log(JSON.stringify({
83
- ios: result.iosApps.map((a) => ({
84
- entitlements: a.entitlementsPath,
85
- teamId: a.teamId,
86
- bundleId: a.bundleId,
87
- domains: a.domains,
88
- })),
89
- android: result.androidApps.map((a) => ({
90
- manifest: a.manifestPath,
91
- packageIds: a.packageIds,
92
- hosts: a.hosts.map((h) => h.host),
93
- })),
94
- findings: result.findings,
95
- }, null, 2));
96
- }
97
- else if (format === 'github') {
98
- printGithubAnnotations(result.findings);
99
- printReport(result.findings, result.domains);
112
+ console.log(JSON.stringify(payload, null, 2));
100
113
  }
101
114
  else {
115
+ if (format === 'github')
116
+ printGithubAnnotations(result.findings);
102
117
  printReport(result.findings, result.domains);
103
118
  }
104
119
  process.exit(exitCodeFor(result.findings));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeplink-parity",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Checks that what your mobile app declares about deep links matches what is actually hosted — across iOS and Android.",
5
5
  "type": "module",
6
6
  "bin": {