{"id":13393894,"url":"https://github.com/Rich-Harris/degit","last_synced_at":"2025-03-13T19:31:52.088Z","repository":{"id":37270348,"uuid":"98913789","full_name":"Rich-Harris/degit","owner":"Rich-Harris","description":"Straightforward project scaffolding","archived":false,"fork":false,"pushed_at":"2024-01-27T07:20:31.000Z","size":697,"stargazers_count":7036,"open_issues_count":93,"forks_count":245,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-10-29T11:12:31.469Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rich-Harris.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-07-31T17:44:38.000Z","updated_at":"2024-10-29T04:23:03.000Z","dependencies_parsed_at":"2023-02-08T03:30:28.356Z","dependency_job_id":"4e0bde3d-9cb7-4d52-be3f-eaf5d5b045ff","html_url":"https://github.com/Rich-Harris/degit","commit_stats":{"total_commits":234,"total_committers":17,"mean_commits":"13.764705882352942","dds":0.6623931623931624,"last_synced_commit":"64b80577acf3313b669840f7452800ee8d09fbf3"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rich-Harris%2Fdegit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rich-Harris%2Fdegit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rich-Harris%2Fdegit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rich-Harris%2Fdegit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rich-Harris","download_url":"https://codeload.github.com/Rich-Harris/degit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243469226,"owners_count":20295715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:01:02.010Z","updated_at":"2025-03-13T19:31:52.050Z","avatar_url":"https://github.com/Rich-Harris.png","language":"JavaScript","readme":"# degit — straightforward project scaffolding\n\n[![Travis CI build status](https://badgen.net/travis/Rich-Harris/degit/master)](https://travis-ci.org/Rich-Harris/degit)\n[![AppVeyor build status](https://badgen.net/appveyor/ci/Rich-Harris/degit/master)](https://ci.appveyor.com/project/Rich-Harris/degit/branch/master)\n[![Known Vulnerabilities](https://snyk.io/test/npm/degit/badge.svg)](https://snyk.io/test/npm/degit)\n[![install size](https://badgen.net/packagephobia/install/degit)](https://packagephobia.now.sh/result?p=degit)\n[![npm package version](https://badgen.net/npm/v/degit)](https://npm.im/degit)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n\n**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.)\n\n_Requires Node 8 or above, because `async` and `await` are the cat's pyjamas_\n\n## Installation\n\n```bash\nnpm install -g degit\n```\n\n## Usage\n\n### Basics\n\nThe simplest use of degit is to download the master branch of a repo from GitHub to the current working directory:\n\n```bash\ndegit user/repo\n\n# these commands are equivalent\ndegit github:user/repo\ndegit git@github.com:user/repo\ndegit https://github.com/user/repo\n```\n\nOr you can download from GitLab and BitBucket:\n\n```bash\n# download from GitLab\ndegit gitlab:user/repo\ndegit git@gitlab.com:user/repo\ndegit https://gitlab.com/user/repo\n\n# download from BitBucket\ndegit bitbucket:user/repo\ndegit git@bitbucket.org:user/repo\ndegit https://bitbucket.org/user/repo\n\n# download from Sourcehut\ndegit git.sr.ht/user/repo\ndegit git@git.sr.ht:user/repo\ndegit https://git.sr.ht/user/repo\n```\n\n### Specify a tag, branch or commit\n\nThe default branch is `master`.\n\n```bash\ndegit user/repo#dev       # branch\ndegit user/repo#v1.2.3    # release tag\ndegit user/repo#1234abcd  # commit hash\n````\n\n### Create a new folder for the project\n\nIf the second argument is omitted, the repo will be cloned to the current directory.\n\n```bash\ndegit user/repo my-new-project\n```\n\n### Specify a subdirectory\n\nTo clone a specific subdirectory instead of the entire repo, just add it to the argument:\n\n```bash\ndegit user/repo/subdirectory\n```\n\n### HTTPS proxying\n\nIf you have an `https_proxy` environment variable, Degit will use it.\n\n### Private repositories\n\nPrivate 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.\n\nNote: this clones over SSH, not HTTPS.\n\n### See all options\n\n```bash\ndegit --help\n```\n\n## Not supported\n\n- Private repositories\n\nPull requests are very welcome!\n\n## Wait, isn't this just `git clone --depth 1`?\n\nA few salient differences:\n\n- 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\n- Caching and offline support (if you already have a `.tar.gz` file for a specific commit, you don't need to fetch it again).\n- Less to type (`degit user/repo` instead of `git clone --depth 1 git@github.com:user/repo`)\n- Composability via [actions](#actions)\n- 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)\n\n## JavaScript API\n\nYou can also use degit inside a Node script:\n\n```js\nconst degit = require('degit');\n\nconst emitter = degit('user/repo', {\n\tcache: true,\n\tforce: true,\n\tverbose: true,\n});\n\nemitter.on('info', info =\u003e {\n\tconsole.log(info.message);\n});\n\nemitter.clone('path/to/dest').then(() =\u003e {\n\tconsole.log('done');\n});\n```\n\n## Actions\n\nYou 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.\n\n### clone\n\n```json\n// degit.json\n[\n\t{\n\t\t\"action\": \"clone\",\n\t\t\"src\": \"user/another-repo\"\n\t}\n]\n```\n\nThis 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.\n\n### remove\n\n```json\n// degit.json\n[\n\t{\n\t\t\"action\": \"remove\",\n\t\t\"files\": [\"LICENSE\"]\n\t}\n]\n```\n\nRemove a file at the specified path.\n\n## See also\n\n- [zel](https://github.com/vutran/zel) by [Vu Tran](https://twitter.com/tranvu)\n- [gittar](https://github.com/lukeed/gittar) by [Luke Edwards](https://twitter.com/lukeed05)\n\n## License\n\n[MIT](LICENSE.md).\n","funding_links":[],"categories":["JavaScript","Usage","Repository","templates","Code Reviews","Developer Experience (DX)","CLI 相关","others","Uncategorized","Scaffolding"],"sub_categories":["Git","editor tools","How to Embed","Uncategorized","Javascript \u0026 Typescript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRich-Harris%2Fdegit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRich-Harris%2Fdegit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRich-Harris%2Fdegit/lists"}