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

git-wrapper2

v0.2.5

Published

A wrapper around the git executable with convenience functions for common commands

Downloads

29

Readme

git-wrapper2

A wrapper around the git executable. Built on top of the original git-wrapper, git-wrapper2 provides additional convenience functions for commit git tasks, like commiting changes and pushing them to a remote repository. Additionally git-wrapper2 emits events for many tasks so that you can observe changes throughout your application.

Installation

npm install git-wrapper2

API

var git = new Git(options);

Constructor. See git(1) for available options.

  • options Object. Examples: { paginate: true } enables pagination. { 'git-dir': '../.git' } specifies a different .git directory.

git.exec(command [[, options], args], callback);

Executes a git command. See the Git Reference for available commands.

  • command String. Examples: 'init', 'log', 'commit', etc.
  • options Object. The options for a git command. E.g. { f: true } to force a command (equivalent to adding -f on the command line).
  • args Array[String]. The arguments for a git command. E.g. some files for git add.
  • callback Function. callback(err, msg).

git.isRepo(callback);

Checks to see if the directory is a git repository. Callback returns a boolean indicating whether it is or not.

  • callback Function. callback(isRepo).

git.clone(repo, dir, callback);

Clones a repository to the destination dir.

  • repo String. Remote repository.
  • dir String. Local directory to clone into.
  • cal.back Function. callback(err, msg).

git.pull([remote], [branch], callback)

Performs a git pull command against the repository. If remote or branch are not provided they will default to origin and master respectively.

  • remote String. Name of the remote target.
  • branch String. Branch name to pull.
  • callback Function. callback(err, msg).

git.add(which, callback)

Perform a git add command, staging files for a commit.

  • which String. Which files to stage, seperated by spaces.
  • callback Function. callback(err, msg).

git.commit(msg, callback)

Commits staged changes with the given msg as the commit message.

  • msg String. Body of the commit message.
  • callback Function. callback(err, msg).

git.push([remote], [branch], callback)

Pushes changes in the local repository to a remote. If remote or branch are not provided, the defaults will be origin and master respectively.

  • remote String. Name of the remote target.
  • callback Function. callback(err, msg).

git.save(msg, callback)

Convenience function for performing git.add, git.commit, and git.push in one function call. Using this will automatically stage all unstaged changes, commit, and then push.

  • msg String. Body of the commit message.
  • callback Function. callback(err, msg).

git.log(options, callback)

Performs a git log command, returning the results. options are an array of command line options you might want to provide, such as ['-n', 2] to limit the results to only the last 2 commits.

  • options Array. Command line options for the git log command.
  • calllback Function. callback(err, msg).

Events

Several events are emitted when actions are performed against a git repository.

clone

Emitted when the repository is cloned.

commit

Emitted when a commit occurs.

saved

Emitted when a full save operation is performed and completed.

Bugs and Issues

If you encounter any bugs or issues, feel free to email me at matthew at matthewphillips.info.