From 34b948ebd940eb5e11b05827aba438fcc4cca962 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 6 Feb 2025 23:57:40 +0800 Subject: [PATCH] fix: add `cypress install` to `prepare` script to fix pnpm 10 compatibility 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`: - --- template/config/cypress/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/template/config/cypress/package.json b/template/config/cypress/package.json index 49c1dc94..4714685a 100644 --- a/template/config/cypress/package.json +++ b/template/config/cypress/package.json @@ -1,5 +1,6 @@ { "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'" }, -- 2.39.5