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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alanchenchen/gittask

v0.0.6

Published

A plugin CLI to task your git operations

Readme

GitTask

A plugin CLI to task your git operations.将git命令模块组合的CLI插件

Author:Alan Chen

E-mail: [email protected]

version: 0.0.6

date: 2018/11/16

只能通过node来执行

Feature

  • 将常用的git命令业务组件化,然后像使用插槽一样自定义git的工作流。
  • 内置14个常用命令扩展,全部是CLI中文操作,高效便捷。
  • 支持自定义命令扩展,支持链式顺序执行,支持链式命令扩展之间参数传递。

Directory tree

├─example       demo代码
├─screenshot    效果截图
└─src
    └─commands  内置的命令扩展

Usage

  • yarn add @alanchenchen/gittask or npm install @alanchenchen/gittask --save 安装依赖
  • 在项目根目录新建一个js文件,例如wrok.js,在其中调用如下:
    const { WorkFlow } = require('@alanchenchen/gittask')
    const questFlow = require('@alanchenchen/gittask/src/commands/questFlow')
    const showBranch = require('@alanchenchen/gittask/src/commands/showBranch')
    const modifyOldBranch = require('@alanchenchen/gittask/src/commands/modifyOldBranch') 
    const addModifiedFile = require('@alanchenchen/gittask/src/commands/addModifiedFile') 
    const commit = require('@alanchenchen/gittask/src/commands/commit') 
    const push = require('@alanchenchen/gittask/src/commands/push') 
    const deleteOrigin = require('@alanchenchen/gittask/src/commands/deleteOrigin')

    /* 插件内置13个常用的命令扩展,先引入,然后自由组合,task内会按照索引顺序依次执行 */
    const task = [showBranch, questFlow, modifyOldBranch, addModifiedFile, commit, push, deleteOrigin]
    WorkFlow.use(task)
  • 然后在当前目录工作区打开终端,输入node work,接下来就可以按照CLI的流程一步步操作啦~

Options

  • gittask包导出3个变量:

    1. WorkFlow, [Object], 包含一个可以使用的方法useuse支持传入一个数组,数组项必须是命令扩展(可以是自己定义的)
    2. git, [Object], 包含内置的13个命令扩展的命令参数。
    3. shell, [Function], 运行命令行的函数。参数如下:
      • cmd [Array], 必选,命令的参数数组,例如git branch -a,cmd则是['branch', '-a']
      • param [Array], 可选,默认命令参数后面的参数,默认为空数组,例如git branch alan,cmd是['branch'],param则是['alan']
      • prefixPath [String], 可选,命令行运行的程序路径,默认为git,可以是其他命令路径,支持非git操作

    13种内置命令扩展

    | name | description | return value (扩展返回值)| |:--------------:|:----------------------------------:|:------------------------:| | addModifiedFile| 将项目中发生改变的文件添加到git缓存 | 透传上一个扩展传来的值 | | checkoutBranch | 切换当前分支到指定分支 | 用户选择的新分支名 | | checkVersion | 显示当前git的版本信息 | / | | commit | 将git中的缓存提交到commit操作 | 透传上一个扩展传来的值 | | deleteBranch | 删除本地仓库某个分支 | / | | deleteOrigin | 删除远程仓库某个分支 | / | | modifyOldBranch| 将某个分支名替换为新的分支名,命名分支 | 用户选择的新分支名 | | newBranch | 新建一个本地分支 | 用户选择的新分支名 | | pull | 拉取指定分支的远程仓库 | 用户选择的拉取分支名 | | push | 将指定分支的文件提交到远程仓库,默认会取addModifiedFile传入的新分支名,如果没有,则会提交当前分支| / | | questFlow | 询问用户是否按照git工作流来配置的提问 | / | | showBranch | 显示当前所有分支,包含远程分支 | / | | showLog | 显示当前分支的log日志 | / | | showStatus | 显示当前分支文件的状态,只有当有状态变化,才能调用addModifiedFile| / |

  • 插件支持自定义命令扩展,但是格式必须如下:

    const chalk = require('chalk') // 让终端可写流文本颜色改变的模块
    const inquirer = require('inquirer') // 终端可读流交互的模块
    const { git, shell } = require('@alanchenchen/gittask') // 插件自带的shell方法和默认git参数

    // 一定要导出一个异步函数,可选接收一个参数,param是task中前一个命令扩展传入的参数
    module.exports = async (param) => {
        await shell(['-V'],[], 'node') // 异步打印出当前node版本号
        return '我是传入给下一个命令扩展的参数' // return会将参数传入给task中下一个命令扩展,可以不传
    }

License

  • MIT