简体   繁体   English

Flutter husky package 用于创建 git 挂钩

[英]Flutter husky package for creating git hooks

I already have a pre-commit hook in my project, but I want to force all people in my project to use it.我的项目中已经有一个预提交挂钩,但我想强制我项目中的所有人使用它。 For that purpose, I want to write a flutter library for creating files in a flutter project directory(like a husky in js world)!为此,我想编写一个 flutter 库,用于在 flutter 项目目录中创建文件(就像 js 世界中的哈士奇一样)! All that I have searched are about widgets libraries and so on!我搜索的所有内容都是关于小部件库等等!

I know that in js libraries in package.json there is a script object with install property.我知道在 package.json 的 js 库中,有一个带有安装属性的脚本 object。 In this property, anybody can write to run a script.在此属性中,任何人都可以编写运行脚本。 Is there an opportunity to do the same thing in dart or flutter?在 dart 或 flutter 中是否有机会做同样的事情?

You can apply Git hooks in Flutter projects using Lefthook.您可以使用 Lefthook 在 Flutter 项目中应用 Git 挂钩。 I've written about it here .我在这里写过。 However, a pre-commit hook can be bypassed with the --no-verify flag, so I'd suggest you to also integrate checks on a pipeline.但是,可以使用 --no-verify 标志绕过预提交钩子,因此我建议您也将检查集成到管道上。 I've written about this using GitHub Actions and GitLab CI in case you're using one of these services.我已经使用GitHub ActionsGitLab CI编写了有关此内容的文章,以防您使用其中一种服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM