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

deegit

v2.9.1

Published

Straightforward project scaffolding

Downloads

2

Readme

deegit — straightforward project scaffolding

deegit is a fork of degit by Rich Harris with support for self-hosted GitLab

deegit makes copies of git repositories. When you run deegit some-user/some-repo, it will find the latest commit on https://github.com/some-user/some-repo and download the associated tar file to ~/.deegit/some-user/some-repo/commithash.tar.gz if it doesn't already exist locally. (This is much quicker than using git clone, because you're not downloading the entire git history.)

Requires Node 8 or above, because async and await are the cat's pyjamas

Installation

npm install -g deegit

Without Installation

If you don't want to install deegit globally, you can use npx:

npx deegit user/repo

Usage

Basics

The simplest use of deegit is to download the master branch of a repo from GitHub to the current working directory:

deegit user/repo

# these commands are equivalent
deegit github:user/repo
deegit [email protected]:user/repo
deegit https://github.com/user/repo

Or you can download from GitLab and BitBucket:

# download from GitLab
deegit gitlab:user/repo
deegit [email protected]:user/repo
deegit https://gitlab.com/user/repo

# download from self-hosted GitLab
deegit [email protected]:user/repo
deegit https://your.gitlab.com/user/repo

# download from BitBucket
deegit bitbucket:user/repo
deegit [email protected]:user/repo
deegit https://bitbucket.org/user/repo

# download from Sourcehut
deegit git.sr.ht/user/repo
deegit [email protected]:user/repo
deegit https://git.sr.ht/user/repo

Specify a tag, branch or commit

The default branch is master.

deegit user/repo#dev       # branch
deegit user/repo#v1.2.3    # release tag
deegit user/repo#1234abcd  # commit hash

Create a new folder for the project

If the second argument is omitted, the repo will be cloned to the current directory.

deegit user/repo my-new-project

Specify a subdirectory

To clone a specific subdirectory instead of the entire repo, just add it to the argument:

deegit user/repo/subdirectory

HTTPS proxying

If you have an https_proxy environment variable, deegit will use it.

Private repositories

Private repos can be cloned by specifying --mode=git (the default is tar). In this mode, deegit will use git under the hood. It's much slower than fetching a tarball, which is why it's not the default.

Note: this clones over SSH, not HTTPS.

See all options

deegit --help

Not supported

  • Private repositories

Pull requests are very welcome!

Wait, isn't this just git clone --depth 1?

A few salient differences:

  • If you git clone, you get a .git folder that pertains to the project template, rather than your project. You can easily forget to re-init the repository, and end up confusing yourself
  • Caching and offline support (if you already have a .tar.gz file for a specific commit, you don't need to fetch it again).
  • Less to type (deegit user/repo instead of git clone --depth 1 [email protected]:user/repo)
  • Composability via actions
  • Future capabilities — interactive mode, friendly onboarding and postinstall scripts

JavaScript API

You can also use deegit inside a Node script:

const degit = require('deegit');

const emitter = degit('user/repo', {
	cache: true,
	force: true,
	verbose: true,
});

emitter.on('info', info => {
	console.log(info.message);
});

emitter.clone('path/to/dest').then(() => {
	console.log('done');
});

Actions

You can manipulate repositories after they have been cloned with actions, specified in a degit.json file that lives at the top level of the working directory. Currently, there are two actions — clone and remove. Additional actions may be added in future.

clone

// degit.json
[
	{
		"action": "clone",
		"src": "user/another-repo"
	}
]

This will clone user/another-repo, preserving the contents of the existing working directory. This allows you to, say, add a new README.md or starter file to a repo that you do not control. The cloned repo can contain its own degit.json actions.

remove

// degit.json
[
	{
		"action": "remove",
		"files": ["LICENSE"]
	}
]

Remove a file at the specified path.

See also

License

MIT.