From cdc8080253b22121ab05e610a93c320289fbd813 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 4 Apr 2021 15:18:38 +0800 Subject: [PATCH] feat(create-vant-cli-app): update vue3 template --- .../generators/vue3/.husky/.gitignore | 1 + .../generators/vue3/.husky/commit-msg | 4 ++++ .../generators/vue3/.husky/pre-commit | 4 ++++ .../generators/vue3/package.json.tpl | 18 +++++++----------- packages/vant-cli/README.md | 6 ++++-- 5 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 packages/create-vant-cli-app/generators/vue3/.husky/.gitignore create mode 100755 packages/create-vant-cli-app/generators/vue3/.husky/commit-msg create mode 100755 packages/create-vant-cli-app/generators/vue3/.husky/pre-commit diff --git a/packages/create-vant-cli-app/generators/vue3/.husky/.gitignore b/packages/create-vant-cli-app/generators/vue3/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/packages/create-vant-cli-app/generators/vue3/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/packages/create-vant-cli-app/generators/vue3/.husky/commit-msg b/packages/create-vant-cli-app/generators/vue3/.husky/commit-msg new file mode 100755 index 000000000..59ef27686 --- /dev/null +++ b/packages/create-vant-cli-app/generators/vue3/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install vant-cli commit-lint $1 diff --git a/packages/create-vant-cli-app/generators/vue3/.husky/pre-commit b/packages/create-vant-cli-app/generators/vue3/.husky/pre-commit new file mode 100755 index 000000000..d37daa075 --- /dev/null +++ b/packages/create-vant-cli-app/generators/vue3/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install lint-staged diff --git a/packages/create-vant-cli-app/generators/vue3/package.json.tpl b/packages/create-vant-cli-app/generators/vue3/package.json.tpl index 75adcd95e..8bcba4dc1 100644 --- a/packages/create-vant-cli-app/generators/vue3/package.json.tpl +++ b/packages/create-vant-cli-app/generators/vue3/package.json.tpl @@ -13,29 +13,25 @@ "test": "vant-cli test", "lint": "vant-cli lint", "build": "vant-cli build", + "prepare": "husky install", "release": "vant-cli release", "test:coverage": "open test/coverage/index.html", "build-site": "vant-cli build-site && gh-pages -d site" }, "author": "", "license": "MIT", - "husky": { - "hooks": { - "pre-commit": "lint-staged", - "commit-msg": "vant-cli commit-lint" - } - }, "lint-staged": { - "*.{ts,tsx,js,jsx,vue}": "eslint --fix", + "*.md": "prettier --write", + "*.{ts,tsx,js,vue,less,scss}": "prettier --write", + "*.{ts,tsx,js,vue}": "eslint --fix", "*.{vue,css,less,scss}": "stylelint --fix" }, "peerDependencies": { "vue": "^3.0.0" }, "devDependencies": { - "@vant/cli": "^3.0.0", + "@vant/cli": "^3.9.0", "@vue/compiler-sfc": "^3.0.0", - "babel-plugin-import": "^1.13.0", "vue": "^3.0.0" }, "eslintConfig": { @@ -53,7 +49,7 @@ "singleQuote": true }, "browserslist": [ - "Android >= 4.0", - "iOS >= 8" + "Chrome >= 51", + "iOS >= 10" ] } diff --git a/packages/vant-cli/README.md b/packages/vant-cli/README.md index 3b5f25d88..3c335f83d 100644 --- a/packages/vant-cli/README.md +++ b/packages/vant-cli/README.md @@ -41,7 +41,9 @@ yarn add @vant/cli --dev "build-site": "vant-cli build-site" }, "lint-staged": { - "*.{js,jsx,ts,tsx,vue}": "eslint --fix", + "*.md": "prettier --write", + "*.{ts,tsx,js,vue,less,scss}": "prettier --write", + "*.{ts,tsx,js,vue}": "eslint --fix", "*.{vue,css,less,scss}": "stylelint --fix" }, "eslintConfig": { @@ -54,7 +56,7 @@ yarn add @vant/cli --dev "prettier": { "singleQuote": true }, - "browserslist": ["Android >= 4.0", "iOS >= 8"] + "browserslist": ["Chrome >= 51", "iOS >= 10"] } ```