Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is there a way to use husky when creating a cra template? #8696

Comments

@cmacdonnacha
Copy link

In my package.json file I can use husky to run prettier to format my code after a commit.

"husky": {
    "hooks": {
      "pre-commit": "pretty-quick --staged"
    }
  }

Is there a way to put this into my own custom cra template? Into the template.json file?

@petetnt
Copy link
Contributor

petetnt commented Mar 24, 2020

There is! See https://create-react-app.dev/docs/custom-templates/ for more information on building custom templates!

@cmacdonnacha
Copy link
Author

cmacdonnacha commented Mar 25, 2020

Thanks @petetnt . I read those docs but missed the bit about CRA taking other keys as is so I can add whatever I like in there. Cheers.

The more I've been working on this CRA template of mine the more I'm trying to justify it over doing a simple git clone of my github project. I love CRA and would still use it in my CRA based boilerplate. Would you mind sharing your thoughts?

@lock lock bot locked and limited conversation to collaborators Apr 15, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.