Skip to content

Commit 65ba8a8

Browse files
authored
fix: filter null fingerprint sources; output sources to stderr when --raw (#409)
* fix: filter null fingerprint sources; output sources to stderr when --raw * changeset
1 parent e45fc32 commit 65ba8a8

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.changeset/fifty-donkeys-joke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rnef/cli': patch
3+
---
4+
5+
fix: filter null fingerprint sources; output sources to stderr when --raw

packages/cli/src/lib/plugins/fingerprint.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,24 @@ export async function nativeFingerprintCommand(
2525
const platform = options.platform;
2626
const readablePlatformName = platform === 'ios' ? 'iOS' : 'Android';
2727

28-
if (options?.raw || !isInteractive()) {
28+
if (options.raw || !isInteractive()) {
2929
const fingerprint = await nativeFingerprint(path, {
3030
platform,
3131
extraSources,
3232
ignorePaths,
3333
});
3434
console.log(fingerprint.hash);
35+
// log sources to stderr to avoid polluting the standard output
36+
console.error(
37+
JSON.stringify(
38+
{
39+
hash: fingerprint.hash,
40+
sources: fingerprint.sources.filter((source) => source.hash != null),
41+
},
42+
null,
43+
2
44+
)
45+
);
3546
return;
3647
}
3748

@@ -50,7 +61,14 @@ export async function nativeFingerprintCommand(
5061

5162
loader.stop(`Fingerprint calculated: ${fingerprint.hash}`);
5263

53-
logger.debug('Sources:', JSON.stringify(fingerprint.sources, null, 2));
64+
logger.debug(
65+
'Sources:',
66+
JSON.stringify(
67+
fingerprint.sources.filter((source) => source.hash != null),
68+
null,
69+
2
70+
)
71+
);
5472
logger.debug(`Duration: ${(duration / 1000).toFixed(1)}s`);
5573

5674
outro('Success 🎉.');

0 commit comments

Comments
 (0)