Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for self-hosted git provider #358

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"deegit"
]
}
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# degit changelog

## v2.9.1


### 💅 Refactors

- Deegit (3289509)

### ❤️ Contributors

- Dnldsht ([@dnldsht](http://github.com/dnldsht))

## v2.9.0


### 🚀 Enhancements

- Add support for self-hosted git provider (69f954b)

### 🩹 Fixes

- Remove gitlab for tar download (74dfcf3)

### 💅 Refactors

- Degit -> de-git (05cc31b)

### 📖 Documentation

- Self hosted gitlab example (7e0d5ff)

### ❤️ Contributors

- Dnldsht ([@dnldsht](http://github.com/dnldsht))

## 2.8.4

* Whoops
Expand Down
79 changes: 43 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,104 @@
# degit — straightforward project scaffolding
# deegit — straightforward project scaffolding

[![Travis CI build status](https://badgen.net/travis/Rich-Harris/degit/master)](https://travis-ci.org/Rich-Harris/degit)
[![AppVeyor build status](https://badgen.net/appveyor/ci/Rich-Harris/degit/master)](https://ci.appveyor.com/project/Rich-Harris/degit/branch/master)
[![Known Vulnerabilities](https://snyk.io/test/npm/degit/badge.svg)](https://snyk.io/test/npm/degit)
[![install size](https://badgen.net/packagephobia/install/degit)](https://packagephobia.now.sh/result?p=degit)
[![npm package version](https://badgen.net/npm/v/degit)](https://npm.im/degit)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
>deegit is a fork of [degit](https://github.com/Rich-Harris/degit) by [Rich Harris](https://twitter.com/Rich_Harris) with support for self-hosted GitLab

**degit** makes copies of git repositories. When you run `degit 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 `~/.degit/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.)

**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

```bash
npm install -g degit
npm install -g deegit
```

## Without Installation

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

```bash
npx deegit user/repo
```

## Usage

### Basics

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

```bash
degit user/repo
deegit user/repo

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

Or you can download from GitLab and BitBucket:

```bash
# download from GitLab
degit gitlab:user/repo
degit [email protected]:user/repo
degit https://gitlab.com/user/repo
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
degit bitbucket:user/repo
degit [email protected]:user/repo
degit https://bitbucket.org/user/repo
deegit bitbucket:user/repo
deegit [email protected]:user/repo
deegit https://bitbucket.org/user/repo

# download from Sourcehut
degit git.sr.ht/user/repo
degit [email protected]:user/repo
degit https://git.sr.ht/user/repo
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`.

```bash
degit user/repo#dev # branch
degit user/repo#v1.2.3 # release tag
degit user/repo#1234abcd # commit hash
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.

```bash
degit user/repo my-new-project
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:

```bash
degit user/repo/subdirectory
deegit user/repo/subdirectory
```

### HTTPS proxying

If you have an `https_proxy` environment variable, Degit will use it.
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, Degit will use `git` under the hood. It's much slower than fetching a tarball, which is why it's not the default.
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

```bash
degit --help
deegit --help
```

## Not supported
Expand All @@ -106,16 +113,16 @@ 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 (`degit user/repo` instead of `git clone --depth 1 [email protected]:user/repo`)
- Less to type (`deegit user/repo` instead of `git clone --depth 1 [email protected]:user/repo`)
- Composability via [actions](#actions)
- Future capabilities — [interactive mode](https://github.com/Rich-Harris/degit/issues/4), [friendly onboarding and postinstall scripts](https://github.com/Rich-Harris/degit/issues/6)
- Future capabilities — [interactive mode](https://github.com/Rich-Harris/deegit/issues/4), [friendly onboarding and postinstall scripts](https://github.com/Rich-Harris/deegit/issues/6)

## JavaScript API

You can also use degit inside a Node script:
You can also use deegit inside a Node script:

```js
const degit = require('degit');
const degit = require('deegit');

const emitter = degit('user/repo', {
cache: true,
Expand Down
File renamed without changes.
152 changes: 76 additions & 76 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
{
"name": "degit",
"version": "2.8.4",
"engines": {
"node": ">=8.0.0"
},
"description": "Straightforward project scaffolding",
"main": "dist/index.js",
"bin": {
"degit": "degit"
},
"scripts": {
"lint": "eslint --color --ignore-path .gitignore .",
"dev": "npm run build -- --watch",
"build": "rollup -c",
"test": "mocha",
"pretest": "npm run build",
"prepublishOnly": "npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Rich-Harris/degit.git"
},
"keywords": [
"scaffolding",
"template",
"git"
],
"author": "Rich Harris",
"license": "MIT",
"bugs": {
"url": "https://github.com/Rich-Harris/degit/issues"
},
"homepage": "https://github.com/Rich-Harris/degit#readme",
"devDependencies": {
"@rollup/plugin-commonjs": "18.0.0",
"@rollup/plugin-node-resolve": "11.2.1",
"chalk": "4.1.0",
"enquirer": "2.3.6",
"eslint": "7.23.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-import": "2.22.1",
"fuzzysearch": "1.0.3",
"home-or-tmp": "3.0.0",
"https-proxy-agent": "5.0.0",
"husky": "6.0.0",
"lint-staged": "10.5.4",
"mocha": "8.3.2",
"mri": "1.1.6",
"prettier": "2.2.1",
"rimraf": "3.0.2",
"rollup": "2.44.0",
"rollup-plugin-commonjs": "10.1.0",
"sander": "0.6.0",
"source-map-support": "0.5.19",
"tar": "6.1.0",
"tiny-glob": "0.2.8"
},
"files": [
"help.md",
"dist"
],
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js}": [
"eslint --fix",
"git add"
],
"*.{js, json, yml, md}": [
"prettier --write",
"git add"
]
}
"name": "deegit",
"version": "2.9.1",
"engines": {
"node": ">=8.0.0"
},
"description": "Straightforward project scaffolding",
"main": "dist/index.js",
"bin": {
"deegit": "deegit"
},
"scripts": {
"lint": "eslint --color --ignore-path .gitignore .",
"dev": "npm run build -- --watch",
"build": "rollup -c",
"test": "mocha",
"pretest": "npm run build",
"prepublishOnly": "npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dnldsht/deegit"
},
"keywords": [
"scaffolding",
"template",
"git"
],
"author": "Rich Harris",
"license": "MIT",
"bugs": {
"url": "https://github.com/dnldsht/deegit/issues"
},
"homepage": "https://github.com/dnldsht/deegit#readme",
"devDependencies": {
"@rollup/plugin-commonjs": "18.0.0",
"@rollup/plugin-node-resolve": "11.2.1",
"chalk": "4.1.0",
"enquirer": "2.3.6",
"eslint": "7.23.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-import": "2.22.1",
"fuzzysearch": "1.0.3",
"home-or-tmp": "3.0.0",
"https-proxy-agent": "5.0.0",
"husky": "6.0.0",
"lint-staged": "10.5.4",
"mocha": "8.3.2",
"mri": "1.1.6",
"prettier": "2.2.1",
"rimraf": "3.0.2",
"rollup": "2.44.0",
"rollup-plugin-commonjs": "10.1.0",
"sander": "0.6.0",
"source-map-support": "0.5.19",
"tar": "6.1.0",
"tiny-glob": "0.2.8"
},
"files": [
"help.md",
"dist"
],
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js}": [
"eslint --fix",
"git add"
],
"*.{js, json, yml, md}": [
"prettier --write",
"git add"
]
}
}
Loading