-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eas-cli] compute fingerprint on each build
- Loading branch information
Showing
5 changed files
with
105 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Env, Workflow } from '@expo/eas-build-job'; | ||
import spawnAsync from '@expo/spawn-async'; | ||
|
||
export async function fingerprintCommandAsync( | ||
projectDir: string, | ||
options: { | ||
workflow: Workflow; | ||
platform: string; | ||
debug?: boolean; | ||
env: Env | undefined; | ||
cwd?: string; | ||
} | ||
): Promise<{ | ||
hash: string; | ||
sources: object[]; | ||
isDebugSource: boolean; | ||
}> { | ||
const args = ['@expo/fingerprint']; | ||
if (options.platform) { | ||
args.push('--platform', options.platform); | ||
} | ||
if (options.workflow === 'managed') { | ||
args.push('--ignorePath', 'android/**/*'); | ||
args.push('--ignorePath', 'ios/**/*'); | ||
} | ||
if (options.debug) { | ||
args.push('--debug'); | ||
} | ||
const fingerprintJsonResult = ( | ||
await spawnAsync('npx', [...args, projectDir], { | ||
stdio: 'pipe', | ||
env: { ...process.env, ...options.env }, | ||
cwd: options.cwd, | ||
}) | ||
).stdout; | ||
const fingerprintResult = JSON.parse(fingerprintJsonResult); | ||
return { | ||
hash: fingerprintResult.hash, | ||
sources: fingerprintResult.fingerprintSources, | ||
isDebugSource: options.debug ?? false, | ||
}; | ||
} |