Skip to content

Commit 0183d14

Browse files
authored
fix: remote-cache in json mode (#464)
* fix: remote-cache in json mode * changeset
1 parent 1bb3fc6 commit 0183d14

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.changeset/selfish-mugs-hammer.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@rnef/tools': patch
3+
'@rnef/cli': patch
4+
---
5+
6+
fix: remote-cache in json mode

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ async function remoteCache({
5151
traits: args.traits,
5252
root: projectRoot,
5353
fingerprintOptions,
54+
raw: isJsonOutput,
5455
}));
5556

5657
switch (action) {

packages/tools/src/lib/build-cache/common.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from 'node:path';
33
import { color } from '../color.js';
44
import type { FingerprintSources } from '../fingerprint/index.js';
55
import { nativeFingerprint } from '../fingerprint/index.js';
6+
import { isInteractive } from '../isInteractive.js';
67
import { getCacheRootPath } from '../project.js';
78
import { spinner } from '../prompts.js';
89

@@ -95,15 +96,26 @@ export async function formatArtifactName({
9596
traits,
9697
root,
9798
fingerprintOptions,
99+
raw,
98100
}: {
99101
platform?: 'ios' | 'android';
100102
traits?: string[];
101103
root: string;
102104
fingerprintOptions: FingerprintSources;
105+
raw?: boolean;
103106
}): Promise<string> {
104107
if (!platform || !traits) {
105108
return '';
106109
}
110+
111+
if (raw || !isInteractive()) {
112+
const { hash } = await nativeFingerprint(root, {
113+
...fingerprintOptions,
114+
platform,
115+
});
116+
return `rnef-${platform}-${traits.join('-')}-${hash}`;
117+
}
118+
107119
const loader = spinner();
108120
loader.start('Calculating project fingerprint');
109121
const { hash } = await nativeFingerprint(root, {

0 commit comments

Comments
 (0)