This approach works with both pnpm 10 and other package managers:
- If Cypress's `postinstall` script has been run, it'll do nothing other
than print a message.
- If `postinstall` hasn't been run, it'll download the Cypress binary.
As for why using `prepare` instead of `postinstall`, please refer to the
discussion thread where `husky` decided to use `prepare`:
- <https://github.com/typicode/husky/issues/884>
{
"scripts": {
+ "prepare": "cypress install",
"test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e'",
"test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'"
},