npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-github

v0.3.6

Published

A gulp plugin to pipe contents to github pull request comments.

Downloads

26

Readme

gulp-github

A gulp plugin to comment jscs/jshint/eslint issues to a github pull request.

npm version Dependency Status Build Status License

Features

  • See your CI issues of lint tools on github!
    • Collect gulp-jshint results.
    • Collect gulp-jscs results.
    • Collect gulp-eslint results.
    • Write collected info then comment on a github pull request.
    • Update github pull request status based on collected info.
  • A failThisTask() reporter to fail a gulp task when jscs/jshint/eslint issues found
  • TODO Collect lcov result.

Installation

npm install gulp-github

Usage

var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    jscs = require('gulp-jscs'),
    eslint = require('gulp-eslint'),
    github = require('gulp-github');

gulp.task('lint_report_github', function () {
    return gulp.src('lib/*.js')
    .pipe(jshint())
    .pipe(jscs()).on('error', function (E) {
        console.log(E.message);   // This handled jscs stream error.
    })
    .pipe(eslint())
    .pipe(github(options))       // Comment issues in github PR!
    .pipe(github.failThisTask()); // Fail this task when jscs/jshint/eslint issues found.
});

// Or, direct output your comment with same options
github.commentToPR('Yes! it works!!', options);

// Or, direct set status to a commit
github.createStatusToCommit({
   description: 'No! 2 failures...',
   context: 'my gulp task',
   state: 'failure',
   target_url: 'http://www.homerswebpage.com/'
}, options);

// Or, create a task to reject PR with merged commits
gulp.task('git_rules', function (cb) {
    git.failMergedPR(options, cb);
});

Options

{
    // Required options: git_token, git_repo
    // refer to https://help.github.com/articles/creating-an-access-token-for-command-line-use/
    git_token: 'your_github_oauth_token',

    // comment into this repo, this pr.
    git_repo: 'zordius/test',
    git_prid: '1',

    // create status to this commit, optional
    git_sha: 00000000,
    jshint_status: 'error',       // Set status to error when jshint errors, optional
    jscs_status: 'failure',       // Set git status to failure when jscs errors, optional
    eslint_status: 'error',       // Set git status to error when eslint errors, optional

    // when using github enterprise, optional
    git_option: {
        // refer to https://www.npmjs.com/package/github for more options
        host: 'github.mycorp.com',
        // You may require this when you using Enterprise Github
        pathPrefix: '/api/v3'
    },

    // Provide your own jshint reporter, optional
    jshint_reporter: function (E, file) { // gulp stream file object
        // refer to http://jshint.com/docs/reporters/ for E structure.
        return 'Error in ' + E.file + '!';
    },

    // Provide your own jscs reporter, optional
    jscs_reporter: function (E, file) { // gulp stream file object
        // refer to https://github.com/jscs-dev/node-jscs/wiki/Error-Filters for E structure.
        return 'Error in ' + E.filename + '!';
    }
}

Check this sample gulpfile to see how to migrate this with travis CI.

Check This PR to see live demo.