定制 spryker/git-hook 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

spryker/git-hook

Composer 安装命令:

composer require spryker/git-hook

包简介

Spryker Git hooks

README 文档

README

CI Minimum PHP Version PHPStan License

GitHook for Spryker. This tool will add Git hooks to your local hooks directory.

Currently, we have only one hook named pre-commit. This will execute on every commit the applied commands.

Installation

composer require --dev spryker/git-hook

Setup

Add the Composer scripts to your composer.json

For core

    "scripts": {
        "post-install-cmd": [
        "GitHook\\Composer\\Scripts\\HookInstaller::installSprykerHooks",
        "GitHook\\Composer\\Scripts\\HookInstaller::installEcoHooks"
    ],
    "post-update-cmd": [
        "GitHook\\Composer\\Scripts\\HookInstaller::installSprykerHooks",
        "GitHook\\Composer\\Scripts\\HookInstaller::installEcoHooks"
    ]

For projects

  "scripts": {
    "post-install-cmd": [
      "GitHook\\Composer\\Scripts\\HookInstaller::installProjectHooks"
    ],
    "post-update-cmd": [
      "GitHook\\Composer\\Scripts\\HookInstaller::installProjectHooks"
    ]
  }

This will copy the git hooks to your .git/hooks/ directory.

Configuration

Place a .githook file into the root of your project. Inside of this file you can configure the commands.

You can also use your private configuration by creating a .githook_local file and ignore it in your projects .gitignore` file.

Enable commands

To enable commands you need to specify them. An example configuration could look like this:

preCommitFileCommands:
    - GitHook\Command\FileCommand\PreCommit\ArchitectureCheckCommand
    - GitHook\Command\FileCommand\PreCommit\CodeStyleCheckCommand
    - GitHook\Command\FileCommand\PreCommit\CodeStyleFixCommand
    - GitHook\Command\FileCommand\PreCommit\PhpMdCheckCommand
    - GitHook\Command\FileCommand\PreCommit\PhpStanCheckCommand

preCommitRepositoryCommands:
    - GitHook\Command\RepositoryCommand\PreCommit\ValidateBranchNameCommand
    - GitHook\Command\RepositoryCommand\PreCommit\GitAddCommand

See the full list of available commands in src/GitHook/Command/FileCommand/ and src/GitHook/Command/RepositoryCommand/.

Note: GitHook\Command\RepositoryCommand\PreCommit\GitAddCommand will automatically add all new files into commit, when other commands changed the files ( CodeStyleFixCommand does it for example), so use it only when you really need it!

PhpStanCheckCommand configuration

config:
    phpstan:
        level: 8
        config: .phpstan.neon

Commands

We have two different type of commands. FileCommands will be executed for each file of a given commit. RepositoryCommands will be executed on the whole repository.

统计信息

  • 总下载量: 845.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 61
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固