deeplink-parity 0.6.2 → 0.6.3
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/dist/cli.js +20 -2
- package/dist/report/console.js +6 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { readFile, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { localSource, networkSource } from './fetch/wellKnown.js';
|
|
5
5
|
import { exitCodeFor, printReport } from './report/console.js';
|
|
@@ -28,6 +28,7 @@ Options
|
|
|
28
28
|
--output <file> Also write the JSON result to a file
|
|
29
29
|
--format github GitHub Actions annotations (auto-detected on Actions)
|
|
30
30
|
--yes init only: accept the top suggestion without prompting
|
|
31
|
+
-v, --version Print the version
|
|
31
32
|
-h, --help Show this message
|
|
32
33
|
|
|
33
34
|
The check reads the repositories and GETs two public well-known files per domain —
|
|
@@ -39,6 +40,7 @@ function parseArgs(argv) {
|
|
|
39
40
|
const positional = [];
|
|
40
41
|
let json = false;
|
|
41
42
|
let help = false;
|
|
43
|
+
let version = false;
|
|
42
44
|
let printRoutes = false;
|
|
43
45
|
let yes = false;
|
|
44
46
|
let sha256;
|
|
@@ -53,6 +55,8 @@ function parseArgs(argv) {
|
|
|
53
55
|
json = true;
|
|
54
56
|
else if (arg === '-h' || arg === '--help')
|
|
55
57
|
help = true;
|
|
58
|
+
else if (arg === '-v' || arg === '--version')
|
|
59
|
+
version = true;
|
|
56
60
|
else if (arg === '--print-routes')
|
|
57
61
|
printRoutes = true;
|
|
58
62
|
else if (arg === '--yes')
|
|
@@ -77,6 +81,7 @@ function parseArgs(argv) {
|
|
|
77
81
|
roots: roots.length ? roots : [resolve('.')],
|
|
78
82
|
json,
|
|
79
83
|
help,
|
|
84
|
+
version,
|
|
80
85
|
printRoutes,
|
|
81
86
|
yes,
|
|
82
87
|
sha256,
|
|
@@ -110,6 +115,11 @@ async function assertRootsExist(roots) {
|
|
|
110
115
|
}
|
|
111
116
|
async function main() {
|
|
112
117
|
const opts = parseArgs(process.argv);
|
|
118
|
+
const pkg = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
119
|
+
if (opts.version) {
|
|
120
|
+
console.log(pkg.version);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
113
123
|
if (opts.help) {
|
|
114
124
|
console.log(USAGE);
|
|
115
125
|
return;
|
|
@@ -150,6 +160,8 @@ async function main() {
|
|
|
150
160
|
console.log();
|
|
151
161
|
}
|
|
152
162
|
const payload = {
|
|
163
|
+
version: pkg.version,
|
|
164
|
+
routeConfig: configPath,
|
|
153
165
|
ios: result.iosApps.map((a) => ({
|
|
154
166
|
entitlements: a.entitlementsPath,
|
|
155
167
|
teamId: a.teamId,
|
|
@@ -181,13 +193,19 @@ async function main() {
|
|
|
181
193
|
// machine-readable output in the same run.
|
|
182
194
|
if (opts.output)
|
|
183
195
|
await writeFile(opts.output, `${JSON.stringify(payload, null, 2)}\n`);
|
|
196
|
+
const routesLine = configPath
|
|
197
|
+
? `routes: ${configPath}` +
|
|
198
|
+
(result.routes
|
|
199
|
+
? ` (iOS ${result.routes.ios?.paths.length ?? 0} · Android ${result.routes.android?.paths.length ?? 0})`
|
|
200
|
+
: '')
|
|
201
|
+
: 'routes: no config found — run "deeplink-parity init" to compare route tables';
|
|
184
202
|
if (opts.json) {
|
|
185
203
|
console.log(JSON.stringify(payload, null, 2));
|
|
186
204
|
}
|
|
187
205
|
else {
|
|
188
206
|
if (opts.format === 'github')
|
|
189
207
|
printGithubAnnotations(result.findings);
|
|
190
|
-
printReport(result.findings, result.domains);
|
|
208
|
+
printReport(result.findings, result.domains, { version: pkg.version, routesLine });
|
|
191
209
|
}
|
|
192
210
|
process.exit(exitCodeFor(result.findings));
|
|
193
211
|
}
|
package/dist/report/console.js
CHANGED
|
@@ -10,10 +10,14 @@ const LABEL = { error: 'ERROR', warn: 'WARN ', info: 'INFO ' };
|
|
|
10
10
|
const ORDER = ['error', 'warn', 'info'];
|
|
11
11
|
const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
12
12
|
const paint = (s, c) => (useColor ? `${c}${s}${RESET}` : s);
|
|
13
|
-
export function printReport(findings, checkedDomains) {
|
|
13
|
+
export function printReport(findings, checkedDomains, meta) {
|
|
14
14
|
// every escape goes through paint(), which is a no-op when stdout is not a terminal
|
|
15
15
|
const separator = paint('·', DIM);
|
|
16
|
-
|
|
16
|
+
const version = meta ? ` ${paint(`v${meta.version}`, DIM)}` : '';
|
|
17
|
+
console.log(`\n${paint('deeplink-parity', BOLD)}${version} ${separator} ${checkedDomains.length} domain(s) checked`);
|
|
18
|
+
if (meta)
|
|
19
|
+
console.log(paint(meta.routesLine, DIM));
|
|
20
|
+
console.log();
|
|
17
21
|
if (findings.length === 0) {
|
|
18
22
|
console.log(paint('No problems found', '[32m'));
|
|
19
23
|
console.log();
|
package/package.json
CHANGED