From 107c7e6eac6088ecb59b7f6d15f873899b4fa8b0 Mon Sep 17 00:00:00 2001 From: Teng Yang Date: Sun, 11 Apr 2021 14:08:58 +0800 Subject: [PATCH] fix: support husky v6 --- src/templates/basic.ts | 7 +------ templates/basic/.husky/.gitignore | 1 + templates/basic/.husky/pre-commit | 4 ++++ templates/react-with-storybook/.husky/.gitignore | 1 + templates/react-with-storybook/.husky/pre-commit | 4 ++++ templates/react/.husky/.gitignore | 1 + templates/react/.husky/pre-commit | 4 ++++ 7 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 templates/basic/.husky/.gitignore create mode 100755 templates/basic/.husky/pre-commit create mode 100644 templates/react-with-storybook/.husky/.gitignore create mode 100755 templates/react-with-storybook/.husky/pre-commit create mode 100644 templates/react/.husky/.gitignore create mode 100755 templates/react/.husky/pre-commit diff --git a/src/templates/basic.ts b/src/templates/basic.ts index 7d077e353..169e0e067 100644 --- a/src/templates/basic.ts +++ b/src/templates/basic.ts @@ -27,7 +27,7 @@ const basicTemplate: Template = { build: 'tsdx build', test: 'tsdx test', lint: 'tsdx lint', - prepare: 'tsdx build', + prepare: 'husky install && tsdx build', size: 'size-limit', analyze: 'size-limit --why', }, @@ -44,11 +44,6 @@ const basicTemplate: Template = { }, ], */ - husky: { - hooks: { - 'pre-commit': 'tsdx lint', - }, - }, prettier: { printWidth: 80, semi: true, diff --git a/templates/basic/.husky/.gitignore b/templates/basic/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/templates/basic/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/templates/basic/.husky/pre-commit b/templates/basic/.husky/pre-commit new file mode 100755 index 000000000..f07b61935 --- /dev/null +++ b/templates/basic/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install tsdx lint diff --git a/templates/react-with-storybook/.husky/.gitignore b/templates/react-with-storybook/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/templates/react-with-storybook/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/templates/react-with-storybook/.husky/pre-commit b/templates/react-with-storybook/.husky/pre-commit new file mode 100755 index 000000000..f07b61935 --- /dev/null +++ b/templates/react-with-storybook/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install tsdx lint diff --git a/templates/react/.husky/.gitignore b/templates/react/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/templates/react/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/templates/react/.husky/pre-commit b/templates/react/.husky/pre-commit new file mode 100755 index 000000000..f07b61935 --- /dev/null +++ b/templates/react/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install tsdx lint