Skip to content
This repository was archived by the owner on Jan 7, 2019. It is now read-only.
marcelobernPublic archive

About

A git binary installed through NPM, for use with AWS Lambda

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

lambda-git

NPM Version Build Status Coverage Status

A git binary installed through NPM, for use with AWS Lambda.

To use this, just require it, and call it. E.g:

require("lambda-git")();

This call returns a promise, and once it completes your Node process will be set up to run Git as a subprocess. This extracts a lambda-built version of Git, updates the required environment variables to make it functional, and updates your process.env.PATH to make it accessible.

A larger example:

const { exec } = require('child_process');

require("lambda-git")()
	.then(function () {
		// git is now ready
    exec("git --version");
	})
	.catch(function (error) {
		// something failed
	});

If you want to do something more complicated, you can provide options to change this behaviour.

The git binary itself comes from LambCI.

Changing the installation path:

require("lambda-git")({
  targetDirectory: "/tmp/alternate/path/git" // no action taken if this directory exists
});

Managing env vars yourself:

require("lambda-git")({
  updateEnv: false
});
/* Returns:
{
  binPath: "/tmp/git/usr/bin",
  env: {
    GIT_TEMPLATE_DIR: '/tmp/git/usr/share/git-core/templates',
    GIT_EXEC_PATH: '/tmp/git/usr/libexec/git-core'
  }
} */

You'll need to extract these values and ensure they're made available to whatever process you're using to run Git.

About

A git binary installed through NPM, for use with AWS Lambda

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages