From: Haoqun Jiang Date: Thu, 6 Feb 2025 15:57:40 +0000 (+0800) Subject: fix: add `cypress install` to `prepare` script to fix pnpm 10 compatibility X-Git-Tag: v3.14.1~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34b948ebd940eb5e11b05827aba438fcc4cca962;p=thirdparty%2Fvuejs%2Fcreate-vue.git 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`: - --- 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'" },