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

gitcapsule

v0.5.0

Published

Git client on nodejs

Downloads

1

Readme

GitCapsule

Git client on nodejs

This package is in development and is very unstable as this point.

Status

Latest Version: npm version

| Branch | Build status | |----------|:------------:| | master | Build Status | | develop | Build Status |

Requirements

This package uses the git CLI. You must to have it installed on your machine to use this module. Go here to download it.

installation

This package is meant to be used by other nodejs applications and it's published on NPM

    $ npm install gitcapsule

Changes

  • Basic support to the git status command.

Examples

This example shows a basic flow using gitcapsule

const gitCapsule = require("gitcapsule");

var repositoryOptions = {
    "prepareBasePath": true
}

var gitRepository = gitCapsule.createGitRepository("/repo/testAll", repositoryOptions)
gitRepository.on("cloned", function (data) {
    var latestCommit = "";
    gitRepository.fetch(function (error, data) {
        if (error !== null) {
            console.error(error.toString());
            process.abort();
        }

        gitRepository.checkout("develop");
    });
});

gitRepository.on("checkedout", function (data) {
    gitRepository.pull(function (error, data) {
        if (error !== null) {
            console.error(error.toString());
            process.abort();
        }

        gitRepository.getLatestCommit(function (error, data) {
            if (error !== null) {
                console.error(error.toString());
                process.abort();
            }

            latestCommit = data.commit;
            console.log("Latest commit: " + latestCommit);
            process.exit();
        })
    });
});

gitRepository.on("error", function (error) {
    console.error(error.toString());
});

gitRepository.clone("https://github.com/jmtvms/GitCapsule.git");

Available events

Those are the available events on the GitRepository. Those events may be used in place of the callback functions, since those are optional.

  • error - When a error occurs on any command.
  • cloned - When the clone(sting, Function(error, cloneResponse)) function is sucessfuly executed.
  • fetched - When the fetch(Function(error, fetchResponse)) function is sucessfuly executed.
  • pulled - When the pull(Function(error, pullResponse)) function is sucessfuly executed.
  • gotLatestCommit - When the getLatestCommit(Function(error, latestCommitResponse)) function is sucessfuly executed.
  • checkedOut - When the checkout(sting, Function(error, checkoutResponse)) function is sucessfuly executed.
  • gotStatus - When the status(Function(error, statusResponse)) function is sucessfuly executed.

Responses

Those responses are passes on the callback or event functions

  • baseResponse - All responses derive from this response and have this fieds available.
    • The responses cloneResponse, fetchResponse and checkoutResponse are exactly equal to baseResponse.
{
    raw: string; //The raw output from the git CLI
    lines: string[]; //The output from the git CLI splited in lines.
}
  • pullResponse
{
    //...baseResponse fields...
    alreadyUpToDate: boolean; //If the local repository is already up to date with the remote.
}
  • latestCommitResponse
{
    //...baseResponse fields...
    commit: string; //The hash that identify the HEAD commit.
}
  • statusResponse
{
    //...baseResponse fields...
    isRepository: boolean; //If the folder is a git repository.
}
Help us to make this the best GIT package for node.

To contribute to this package, just ask us or create a pull request.