承接 slowprog/composer-copy-file 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

slowprog/composer-copy-file

最新稳定版本:0.3.3

Composer 安装命令:

composer require slowprog/composer-copy-file

包简介

Composer script copying your files after install

关键字:

README 文档

README

Build Status Latest Stable Version Total Downloads

Composer copy file

Composer script copying your files after install. Supports copying of entire directories, individual files and complex nested directories.

For example copy fonts:

{
    "require":{
        "twbs/bootstrap": "~3.3",
        "slowprog/composer-copy-file": "~0.3"
    },
    "scripts": {
        "post-install-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ],
        "post-update-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ]
    },
    "extra": {
        "copy-file": {
            "vendor/twbs/bootstrap/fonts/": "web/fonts/"
        }
    }
}

In a development you may use -dev suffix. For example copy non-minified in development and minified in production:

{
    "require":{
        "twbs/bootstrap": "~3.3",
        "slowprog/composer-copy-file": "~0.3"
    },
    "scripts": {
        "post-install-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ],
        "post-update-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ]
    },
    "extra": {
        "copy-file": {
            "vendor/twbs/bootstrap/dist/js/bootstrap.min.js": "web/js/bootstrap.js"
        },
        "copy-file-dev": {
            "vendor/twbs/bootstrap/dist/js/bootstrap.js": "web/js/bootstrap.js"
        }
    }
}

Use cases

You need to be careful when using a last slash. The file-destination is different from the directory-destination with the slash.

If in destination directory already exists copy of file, then it will be override. To overwrite only older files append ? in end of destination path.

Source directory hierarchy:

dir/
    subdir/
        file1.txt
        file2.txt
  1. Dir-to-dir:

    {
        "extra": {
            "copy-file": {
                "dir/subdir/": "web/other/"
            }
        }
    }
    

    Result:

    web/
        other/
            file1.txt
            file2.txt
    
  2. File-to-dir:

    {
        "extra": {
            "copy-file": {
                "dir/subdir/file1.txt": "web/other/",
                "dir/subdir/file2.txt": "web/other/file2.txt/"
            }
        }
    }
    

    Result:

    web/
        other/
            file1.txt
            file2.txt/
                file2.txt
    
  3. File-to-file:

    {
        "extra": {
            "copy-file": {
                "dir/subdir/file1.txt": "web/other/file1.txt",
                "dir/subdir/file2.txt": "web/other/file_rename.txt"
            }
        }
    }
    

    Result:

    web/
        other/
            file1.txt
            file_rename.txt
    
  4. Override only older files:

    {
        "extra": {
            "copy-file": {
                "dir/subdir/": "web/other/?"
            }
        }
    }
    

    Preset:

    web/
        other/
            file1.txt - Recently modified
            file2.txt - Old rotten file
    

    Result:

    web/
        other/
            file1.txt - Not changed
            file2.txt - Replaced
    
  5. Filter source files by regexp pattern

    {
        "extra": {
            "copy-file": {
                "dir/subdir#1\.\w{3}$": "web/other/"
            }
        }
    }
    

    Result:

    web/
        other/
            file1.txt
    

统计信息

  • 总下载量: 978.48k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 49
  • 点击次数: 1
  • 依赖项目数: 38
  • 推荐数: 0

GitHub 信息

  • Stars: 48
  • Watchers: 3
  • Forks: 15
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-02