定制 babymarkt/composer-cleaner-plugin 二次开发

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

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

babymarkt/composer-cleaner-plugin

Composer 安装命令:

composer require babymarkt/composer-cleaner-plugin

包简介

A composer plugin to clean up your project directory

README 文档

README

Build Status Packagist PHP Version Support version GitHub GitHub All Releases

Install

To install the plugin use Composer:

composer require --dev babymarkt/composer-plugin-cleaner

Configure

The configuration must be placed in the extra section in composer.json. An example is:

{
  "name": "company/your-project",
  "type": "project",
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          "README*",
          ".git*"
        ],
        "paths": [
          "test",
          "artifacts"
        ],
        "exclude": [
          "test/important"
        ]
      }
    }
  },
  "require-dev": {
    "babymarkt/composer-plugin-cleaner": "*"
  }
}

The program contains a default configuration under the context default (Surprise surprise!). More detailed information can be found in the class AbstractCommand. Run

composer babymarkt:cleaner:clean default

to use it.

Configuration options

context

Each configuration set is wrapped in a cleaning context. A context is a simple string which can be used on terminal to select the configuration.

{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "your cleaner options": "..."
      }
    }
  }
}

pattern

pattern contains a list of glob pattern to select files in the project directory tree. Consult the PHP documentation or Wikipedia for more information about the glob function and patterns.

{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          "README*",
          ".git*"
        ]
      }
    }
  }
}

This example searches for files starting with README or .git in the complete project tree.

paths

By default the cleaner command use the project root directory to search files (the directory that contains the composer.json file). With the option paths you can set multiple paths to search for files in instead of the default root directory. All paths are relative to the root directory, also such starting with an /. Paths outside the root are being ommited.

{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          ".git*"
        ],
        "paths": [
          "src",
          "vendor"
        ]
      }
    }
  }
}

This example searches for files starting with .git in ./src and ./vendor, nowhere else.

exclude

This option allows you to exclude files from deletion. The list consists of RegEx patterns, without specifying the delimiter characters. The pattern is applied to the entire path and not only to the file name. The used delimiter character is the #. If you need to use it in you pattern, you must escape it.

{
  "extra": {
    "babymarkt:cleaner": {
      "context-name": {
        "pattern": [
          "data/*"
        ],
        "exclude": [
          ".*\\.important"
        ]
      }
    }
  }
}

This example searches for paths starting with data/ and NOT ends with .important.

Run

To run the command use composer:

composer babymarkt:cleaner:clean your-context-name

or add a custom script to your composer.json:

{
  "scripts": {
    "cleanup:dev": [
      "@composer babymarkt:cleaner:clean your-context-name"
    ]
  }
}

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固