chancedai / folder2branch

用于把项目的子目录部署到对应的 git 分支

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

folder2branch: 把某个文件夹内容推送到某个分支

使用场景

  • 在一个前端项目中,把构建出来的文件(如 dist 下的分支),推送到一个专门用于管理部署文件的分支(如 fe);方便保持源文件分支清晰,方便做自动部署。

使用方法

  • 安装
#全局
npm i -D git+ssh://git@git.staff.sina.com.cn:ssfe/folder2branch.git
  • 调用
const folder2branch = require('folder2branch');
new folder2branch.Deployer({

    folder: 'test/_dist',
    // debug:true,
    // 不部署 html 
    pattern: '**/!(*.html)',
    branch:'fe',
    repo:'https://git.staff.sina.com.cn/ssfe/folder2branch',
    finish: function () {

    }
});

new folder2branch.Deployer({

    folder: 'test/_dist',
    // debug: false,
    // 只部署 html
    pattern: '**/*.html',
    branch:'be',
    repo:'https://git.staff.sina.com.cn/ssfe/folder2branch',
    finish: function () {

    }
});

About

用于把项目的子目录部署到对应的 git 分支


Languages

Language:JavaScript 99.1%Language:CSS 0.5%Language:HTML 0.4%