Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

git-essentials

Package Overview
Dependencies
Maintainers
0
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-essentials

A collection of essential Git commands for your browser and Node.js

  • 1.6.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Git Essentials

GitHub Join the community on GitHub Discussions Release codecov NPM Version

A collection of essential Git commands for your browser and Node.js written in TypeScript all without any native dependencies.

Highlights

  • The library aims for 100% interoperability with the canonical git implementation. This means it does all its operations by modifying files in a .git directory just like the git you are used to.

  • The API has been designed to provide functionality as individual functions, code bundlers can produce smaller bundles by including only the functions your application uses (tree shaking). The bundled version of the package is not included.

  • The documentation for the project is auto-generated from the source code so it will always be the most accurate representation of the actual code.

  • The project is written in TypeScript which gives more confidence in making any changes in contrast to plain JavaScript. In addition, it makes code reading and debugging much easier. Source maps are also included so you can jump right into implementation from your code.

Documentation

Visit https://noteshubapp.github.io/git-essentials to view the full documentation.

Installation

You can install it from npm:

npm i git-essentials

Examples

Node.js (server side)

import fs from 'fs/promises'
import { clone } from 'git-essentials'
import { makeNodeHttpClient } from 'git-essentials/clients/http/NodeHttpClient'

const http = makeNodeHttpClient()
const dir = 'repos/Welcome'
const url = 'https://github.com/NotesHubApp/Welcome.git'

await clone({ fs, http, dir, url })

Browser (client side)

GitHub (like many other providers) does not return proper Access-Control-Allow-Origin header for non-API requests. As a result, the browser will refuse to serve those requests. To overcome this limitation you can use CORS proxy server.

Please use the CORS proxy server from the example below only for testing purposes. You can fork this CORS proxy server and host it by your own.

import { clone } from 'git-essentials'
import { IndexedDbFsClient } from 'git-essentials/clients/fs/IndexedDbFsClient'
import { makeWebHttpClient } from 'git-essentials/clients/http/WebHttpClient'

const fs = new IndexedDbFsClient('my-repos')
const http = makeWebHttpClient({
  transformRequestUrl: url => `https://gitcorsproxy.vercel.app/api/cors?url=${encodeURIComponent(url)}`
})
const dir = '/Welcome'
const url = 'https://github.com/NotesHubApp/Welcome.git'

await clone({ fs, http, dir, url })

Contributing

Check out the CONTRIBUTING document for more instructions.

Who is using this project?

  • NotesHub - fully cross-platform, vendor-agnostic, markdown based note-taking app

Credits

This project is based on isomorphic-git library and would not be possible without the pioneering work by @wmhilton and all other amazing members of isomorphic-git community.

License

This work is released under The MIT License.

Keywords

FAQs

Package last updated on 24 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc