From f5a328d79fbe271f8845d04d053ec221199a5bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Thu, 22 Aug 2024 11:26:46 +0800 Subject: [PATCH] =?UTF-8?q?Husky=20=E9=81=87=E5=88=B0=20command=20not=20fo?= =?UTF-8?q?und:=20husky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-commit | 9 ++++++++- README.md | 45 ++++++--------------------------------------- 2 files changed, 14 insertions(+), 40 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 7aa3b62..31c799b 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,9 @@ echo "Running pre-commit hook..." -pnpm exec lint-staged \ No newline at end of file + +if command -v pnpm >/dev/null 2>&1; then + # 如果 pnpm 可用,直接使用它 + pnpm exec lint-staged +else + # 如果 pnpm 不可用,使用 $HOME/.local/bin/pnpm + "$HOME"/.local/bin/pnpm exec lint-staged +fi \ No newline at end of file diff --git a/README.md b/README.md index c7a21f2..68954e6 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,12 @@ -# vue-ts +# vue-ts-example This template should help get you started developing with Vue 3 in Vite. -## Recommended IDE Setup +### Husky 遇到 command not found: husky -[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). +- https://typicode.github.io/husky/zh/troubleshoot.html#找不到命令-command-not-found +- https://typicode.github.io/husky/zh/how-to.html#node-版本管理器和-gui -## Type Support for `.vue` Imports in TS - -TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. - -## Customize configuration - -See [Vite Configuration Reference](https://vitejs.dev/config/). - -## Project Setup - -```sh -pnpm install -``` - -### Compile and Hot-Reload for Development - -```sh -pnpm dev -``` - -### Type-Check, Compile and Minify for Production - -```sh -pnpm build -``` - -### Run Unit Tests with [Vitest](https://vitest.dev/) - -```sh -pnpm test:unit -``` - -### Lint with [ESLint](https://eslint.org/) - -```sh -pnpm lint +```shell +ln -s $(which pnpm) $HOME/.local/bin/pnpm ```