1import spawnAsync from '@expo/spawn-async';
2
3import { Prerequisite, PrerequisiteCommandError } from './Prerequisite';
4
5export class SecurityBinPrerequisite extends Prerequisite {
6  static instance = new SecurityBinPrerequisite();
7
8  async assertImplementation(): Promise<void> {
9    try {
10      // make sure we can run security
11      await spawnAsync('which', ['security']);
12    } catch {
13      throw new PrerequisiteCommandError(
14        'SECURITY_BIN',
15        "Cannot code sign project because the CLI `security` is not available on your computer.\nPlease ensure it's installed and try again."
16      );
17    }
18  }
19}
20