@4th-motion/git-hooks 中文文档教程
@4th-motion/git-hooks
易于设置可以在项目之间共享的 git 挂钩。
在一个地方处理所有 git hooks 并在项目之间共享它们。 可以随时进行更改 - 旧配置会自动覆盖,因为只有一个真实来源。
Installation
将此包作为 devDependency 添加到您的项目中:
yarn add --dev @4th-motion/git-hooks
Usage
安装包后,您可以通过以下方式启动它:
yarn 4th-git-hooks
现在您可以指定要在特定挂钩上执行的任务。 任务必须出现在 package.json 的 script
字段中。
{
"git": {
"pre-commit": ["lint", "test"]
}
}
请注意,commit-msg
挂钩始终会执行。 这确保只能使用特定关键字(例如 feat
、fix
……)推送提交,而永远不会推送到 master 分支。 如果您不想激活此挂钩,只需将其从 hooks/
文件夹中删除。
Behind the scenes
初始化过程将 package.json 文件扩展为如下:
{
"scripts": {
"postinstall": "4th-git-hooks"
}
}
这将在每次安装期间从 hooks/
目录复制所有 git-hooks。 您始终可以编辑现有的挂钩或添加新的挂钩。 可以在此处 找到所有 git 钩子的列表。
Further documents
Related projects
@4th-motion/eslint-config | @4th-motion/stylelint-config |
---|---|
License
版权所有 © 2020 4th motion GmbH。 根据 MIT 许可 发布。
@4th-motion/git-hooks
Easy to set up git hooks that can be shared between your projects.
Handle all your git hooks in one place and share them between your projects. Changes can be made at any time - old configurations are automatically overwritten because there's only one source of truth.
Installation
Add this package as a devDependency to your project:
yarn add --dev @4th-motion/git-hooks
Usage
Once the package is installed, you can initiate it with:
yarn 4th-git-hooks
Now you can specify the tasks to be performed on a particular hook. The tasks must be present in the script
field in package.json.
{
"git": {
"pre-commit": ["lint", "test"]
}
}
Note that the commit-msg
hook is always executed. This ensures that commits can only be pushed with certain keywords (e.g. feat
, fix
, …) and never to the master branch. If you do not want to activate this hook, just remove it from the hooks/
folder.
Behind the scenes
The initialization process extends the package.json file as follows:
{
"scripts": {
"postinstall": "4th-git-hooks"
}
}
This will copy all git-hooks from the hooks/
directory during each installation. You can always edit existing hooks or add new hooks. A list off all git hooks can be found here.
Further documents
Related projects
@4th-motion/eslint-config | @4th-motion/stylelint-config |
---|---|
License
Copyright © 2020 by 4th motion GmbH. Released under the MIT License.
你可能也喜欢
- 1ba2d7b199994c1bad0767d0f4cbdcca 中文文档教程
- @0x111/react-user-avatar 中文文档教程
- @0xaio/create-react-app 中文文档教程
- @1hive/gardens-dao-list 中文文档教程
- @55hudong/modal 中文文档教程
- @99cloud/bpmn-viewer 中文文档教程
- @aaronmaturen/monofun-password 中文文档教程
- @aaronrory/js-dropdownmenu 中文文档教程
- @abpdz/ng.identity 中文文档教程
- @aceandtate/styled-ui 中文文档教程