定制 phug/split 二次开发

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

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

phug/split

Composer 安装命令:

composer require phug/split

包简介

Pug (ex-Jade) facade engine for PHP, HTML template engine structured by indentation

README 文档

README

Latest Stable Version Tests

Split is a tool to handle a mono-repo that can be downloaded as single package, multiple packages or both.

Install

composer require phug/split

Usage

Put composer.json files in sub-directory of a main package repository.

vendor/bin/split update

Check options with:

vendor/bin/split update --help

Check other commands with:

vendor/bin/split --help

Passing GIT authentication via environment variables:

Export env var such as:

REPOSITORY_CREDENTIALS=my-git-username:my-authentication-token
vendor/bin/split update --git-credentials=$REPOSITORY_CREDENTIALS

Example

phug-php/phug is a library that can be required either entirely with phug/phug or as separated packages phug/parser, phug/compiler, etc.

Each package is defined by a directory in src/Phug with a dedicated composer.json file inside each of them.

Once you created a GitHuba (or other git publisher) repository, and registered each of them on packagist.org (you can submit repository with just a single composer.json file with basic infos, the split will insert the actual content later).

You can now simply run from the monorepository the vendor/bin/split update or run this automatically from a hook or a job.

For instance phug/phug uses GitHub Actions to trigger it automatically after each commit: .github/workflows/split.yml

It relies on very few steps:

  • Load PHP via shivammathur/setup-php@v2

  • Cache dependencies folder with actions/cache@v4 to make the job faster (optional)

  • Install phug/split with:

    test -f composer.json && mv composer.json composer.json.save -f
    composer require phug/split --no-interaction
    test -f composer.json.save && mv composer.json.save composer.json -f

    (mv commands are optional, it's here to install only phug/split as your other dependencies are not needed for this job)

  • Run the split update command

    - name: Split monorepository
      run: vendor/bin/split update --git-credentials=$REPOSITORY_CREDENTIALS
      env:
        REPOSITORY_CREDENTIALS: ${{ secrets.REPOSITORY_CREDENTIALS }}

    Here we pass git credentials using the git-credentials as the job runner will not have an authenticaed git user able to push to your repositories.

    The authentication variable is you git username, followed by :, followed by an authentication token you can generate via the page https://github.com/settings/tokens (See documentation: Managing your personal access tokens).

    Don't put this clear token directly in the GitHub Action file, use a repository secret (See documentation: Encrypted secrets) to keep it private.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固