• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

mikaelbr/gulp-gitmodified: A plugin for Gulp to get an object stream of modified ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

mikaelbr/gulp-gitmodified

开源软件地址(OpenSource Url):

https://github.com/mikaelbr/gulp-gitmodified

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-gitmodified

NPM version Build Status Dependency Status

gitmodified plugin for gulp

Usage

A plugin for Gulp to get an object stream of git status files on git (e.g. modified, deleted, untracked, etc).

First, install gulp-gitmodified as a development dependency:

npm install --save-dev gulp-gitmodified

Then, add it to your gulpfile.js:

var gitmodified = require('gulp-gitmodified');

var files = gulp.src('./src/*.ext')
  .pipe(gitmodified('modified'));

files.on('data', function (file) {
  console.log('Modified file:', file);
});

API

gitmodified(statusMode|options)

For statusMode, you can pass a single string value or an array of string values.

gulp-gitmodified extends the vinyl file format gulp uses to have a method for checking if file is deleted. isDeleted is true if checking for deleted files (see below), and false otherwise.

options

gitCwd can be used to override from which directory git should be executed. This is handy in case you have your gulpfile in a different directory than your where your repo resides.

stagedOnly can be used to process only staged files.

// Options can be the following:
{
  gitCwd: String,
  stagedOnly: Boolean,
  modes: statusMode
}

modes is the value from below. If not defined it will default to modified.

statusMode

Type: String || Array Default: 'modified'

What status mode to look for. From git documentation:

M = modified
A = added
D = deleted
R = renamed
C = copied
U = updated but unmerged
?? = untracked
!! = ignored

(and more if in short format (e.g. AM), see Short Format on git status man page)

Examples

// All added files
gulp.src('./**/*')
    .pipe(gitmodified('added'))
// Equal to the one before
gulp.src('./**/*')
    .pipe(gitmodified('A'))
// All added and modified files
gulp.src('./**/*')
    .pipe(gitmodified(['added', 'modified']))
// All added and modified staged files, from different git directory
gulp.src('./**/*')
    .pipe(gitmodified({
      modes: ['added', 'modified'],
      stagedOnly: true,
      gitCwd: '../../differentDirectory'
    }))
// All deleted files.
gulp.src('./**/*')
    .pipe(gitmodified('deleted'))
    .on('data', function (file) {
      console.log(file.isDeleted()); //=> true
    });

License

MIT License




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
manabuyasuda/equip: Gulp, EJS, Sass(ECSS), Aigis, iconfont发布时间:2022-07-09
下一篇:
stevelacy/gulp-git: Git plugin for gulp (gulpjs.com)发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap