0

I want to conditionally run scripts from package.json based on whether the user uses M1 MacBook or an Intel Mac (so based on the CPU architecture).

sina farbod
  • 497
  • 4
  • 17
  • Is there a reason you can't do this in the script itself? One script, perhaps that initiates one of two *other* scripts? https://stackoverflow.com/questions/65346260/get-real-architecture-of-m1-mac-regardless-of-rosetta should point you in the right direction for detection. – ceejayoz Dec 05 '22 at 21:26
  • yes, my package is dependent on another library that runs the script for intel macs. now I want to have both m1s and normal and don't change the dependency on them. – sina farbod Dec 05 '22 at 21:33
  • thanks @gog, I can use process.arch in package.json now. – sina farbod Dec 05 '22 at 21:49
  • @Konrad no, I want to use if/else statement in one of my scripts in package.json – sina farbod Dec 05 '22 at 21:49
  • You can use if/else in bash and you can run any bash script inside package.json, so what's wrong? – Konrad Dec 05 '22 at 21:50

0 Answers0