deeplink-parity 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/dist/cli.js +24 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { writeFile } from 'node:fs/promises';
2
+ import { 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';
@@ -86,12 +86,35 @@ function parseArgs(argv) {
86
86
  format,
87
87
  };
88
88
  }
89
+ /**
90
+ * A mistyped path must fail loudly. Scanning a directory that does not exist would
91
+ * read exactly like an empty repository — "no candidates", "nothing declared" — and
92
+ * a wrong answer that looks like a clean one is the failure mode this tool exists
93
+ * to prevent.
94
+ */
95
+ async function assertRootsExist(roots) {
96
+ for (const root of roots) {
97
+ let ok = false;
98
+ try {
99
+ ok = (await stat(root)).isDirectory();
100
+ }
101
+ catch {
102
+ // fall through to the error below
103
+ }
104
+ if (!ok) {
105
+ console.error(`Not a directory: ${root}`);
106
+ console.error('Pass the path to each checkout, e.g. deeplink-parity ./app-ios ./app-android');
107
+ process.exit(2);
108
+ }
109
+ }
110
+ }
89
111
  async function main() {
90
112
  const opts = parseArgs(process.argv);
91
113
  if (opts.help) {
92
114
  console.log(USAGE);
93
115
  return;
94
116
  }
117
+ await assertRootsExist(opts.roots);
95
118
  if (opts.command === 'init') {
96
119
  process.exit(await runInit(opts.roots, opts.yes));
97
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeplink-parity",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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": {