Comparing version 1.1.3 to 1.2.0
@@ -34,2 +34,4 @@ interface GitInfo { | ||
auth?: string; | ||
install?: boolean; | ||
silent?: boolean; | ||
} | ||
@@ -36,0 +38,0 @@ type DownloadTemplateResult = Omit<TemplateInfo, "dir" | "source"> & { |
{ | ||
"name": "giget", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Download templates and git repositories with pleasure!", | ||
@@ -9,10 +9,12 @@ "repository": "unjs/giget", | ||
"type": "module", | ||
"bin": { | ||
"giget": "./dist/cli.mjs" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.cjs" | ||
"import": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/index.d.cts", | ||
"default": "./dist/index.cjs" | ||
} | ||
} | ||
@@ -23,2 +25,5 @@ }, | ||
"types": "./dist/index.d.ts", | ||
"bin": { | ||
"giget": "./dist/cli.mjs" | ||
}, | ||
"files": [ | ||
@@ -39,7 +44,8 @@ "dist" | ||
"dependencies": { | ||
"colorette": "^2.0.20", | ||
"defu": "^6.1.2", | ||
"https-proxy-agent": "^7.0.2", | ||
"mri": "^1.2.0", | ||
"node-fetch-native": "^1.4.0", | ||
"citty": "^0.1.5", | ||
"consola": "^3.2.3", | ||
"defu": "^6.1.3", | ||
"node-fetch-native": "^1.6.1", | ||
"nypm": "^0.3.3", | ||
"ohash": "^1.1.3", | ||
"pathe": "^1.1.1", | ||
@@ -49,15 +55,15 @@ "tar": "^6.2.0" | ||
"devDependencies": { | ||
"@types/node": "^20.8.2", | ||
"@types/tar": "^6.1.6", | ||
"@vitest/coverage-v8": "^0.34.6", | ||
"@types/node": "^20.10.5", | ||
"@types/tar": "^6.1.10", | ||
"@vitest/coverage-v8": "^1.1.0", | ||
"changelogen": "^0.5.5", | ||
"eslint": "^8.50.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-unjs": "^0.2.1", | ||
"jiti": "^1.20.0", | ||
"prettier": "^3.0.3", | ||
"typescript": "^5.2.2", | ||
"jiti": "^1.21.0", | ||
"prettier": "^3.1.1", | ||
"typescript": "^5.3.3", | ||
"unbuild": "^2.0.0", | ||
"vitest": "^0.34.6" | ||
"vitest": "^1.1.0" | ||
}, | ||
"packageManager": "pnpm@8.8.0" | ||
"packageManager": "pnpm@8.12.1" | ||
} |
@@ -1,6 +0,6 @@ | ||
# ✨ giget | ||
# giget | ||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![Github Actions][github-actions-src]][github-actions-href] | ||
[![bundle][bundle-src]][bundle-href] | ||
[![Codecov][codecov-src]][codecov-href] | ||
@@ -12,16 +12,20 @@ | ||
✔ Support popular git providers (GitHub, GitLab, Bitbucket, Sourcehut) out of the box. | ||
✨ Support popular git providers (GitHub, GitLab, Bitbucket, Sourcehut) out of the box. | ||
✔ Built-in and custom [template registry](#template-registry). | ||
✨ Built-in and custom [template registry](#template-registry). | ||
✔ Fast cloning using tarball gzip without depending on local `git` and `tar`. | ||
✨ Fast cloning using tarball gzip without depending on local `git` and `tar`. | ||
✔ Works online and offline with disk cache support. | ||
✨ Works online and offline with disk cache support. | ||
✔ Custom template provider support with programmatic usage. | ||
✨ Custom template provider support with programmatic usage. | ||
✔ Support extracting with a subdir. | ||
✨ Support extracting with a sub dir. | ||
✔ Authorization support to download private templates | ||
✨ Authorization support to download private templates | ||
✨ Optionally install dependencies after clone using [unjs/nypm](https://github.com/unjs/nypm) | ||
✨ HTTP proxy support and native fetch via [unjs/node-fetch-native](https://github.com/unjs/node-fetch-native) | ||
## Usage (CLI) | ||
@@ -35,3 +39,3 @@ | ||
- **template**: Template name or a a URI describing provider, repository, subdir, and branch/ref. (See [Examples](#examples)) | ||
- **template**: Template name or a URI describing provider, repository, sub dir, and branch/ref. (See [Examples](#examples)) | ||
- **dir**: A relative or absolute path where to extract the template. | ||
@@ -42,11 +46,12 @@ | ||
- `--force`: Clone to existing directory even if exists. | ||
- `--offline`: Do not attempt to download and use cached version. | ||
- `--offline`: Do not attempt to download and use the cached version. | ||
- `--prefer-offline`: Use cache if exists otherwise try to download. | ||
- `--force-clean`: ⚠️ Remove any existing directory or file recusively before cloning. | ||
- `--shell`: ⚠️ Open a new shell with current working directory in cloned dir. (Experimental). | ||
- `--registry`: URL to a custom registry. (Can be overriden with `GIGET_REGISTRY` environment variable). | ||
- `--force-clean`: ⚠️ Remove any existing directory or file recursively before cloning. | ||
- `--shell`: ⚠️ Open a new shell with the current working directory in cloned dir. (Experimental). | ||
- `--registry`: URL to a custom registry. (Can be overridden with `GIGET_REGISTRY` environment variable). | ||
- `--no-registry`: Disable registry lookup and functionality. | ||
- `--verbose`: Show verbose debugging info. | ||
- `--cwd`: Set current working directory to resolve dirs relative to it. | ||
- `--auth`: Custom Authorization token to use for downloading template. (Can be overriden with `GIGET_AUTH` environment variable). | ||
- `--cwd`: Set the current working directory to resolve dirs relative to it. | ||
- `--auth`: Custom Authorization token to use for downloading template. (Can be overridden with `GIGET_AUTH` environment variable). | ||
- `--install`: Install dependencies after cloning using [unjs/nypm](https://github.com/unjs/nypm). | ||
@@ -79,2 +84,8 @@ ### Examples | ||
npx giget@latest sourcehut:pi0/unjs-template | ||
# Clone from https URL (tarball) | ||
npx giget@latest https://api.github.com/repos/unjs/template/tarball/main | ||
# Clone from https URL (JSON) | ||
npx giget@latest https://raw.githubusercontent.com/unjs/giget/main/templates/unjs.json | ||
``` | ||
@@ -84,9 +95,9 @@ | ||
Giget has a built-in HTTP registry system for resolving templates. This way you can support template name shortcuts and meta-data. Default registry is served from [unjs/giget/templates](./templates/). | ||
Giget has a built-in HTTP registry system for resolving templates. This way you can support template name shortcuts and meta-data. The default registry is served from [unjs/giget/templates](./templates/). | ||
If you want to add your template to the built-in registry, just drop a PR to add it to the [./templates](./templates) directory. Slugs are added on first-come first-served basis but this might change in the future. | ||
If you want to add your template to the built-in registry, just drop a PR to add it to the [./templates](./templates) directory. Slugs are added on a first-come first-served basis but this might change in the future. | ||
### Custom Registry | ||
A custom registry should provide an endpoint with dynamic path `/:template.json` that returns a JSON response with keys same as [custom providers](#custom-providers). | ||
A custom registry should provide an endpoint with the dynamic path `/:template.json` that returns a JSON response with keys the same as [custom providers](#custom-providers). | ||
@@ -100,3 +111,3 @@ - `name`: (required) Name of the template. | ||
Because of the simplicity, you can even use a GitHub repository as template registry but also you can build something more powerful by bringing your own API. | ||
Because of the simplicity, you can even use a GitHub repository as a template registry but also you can build something more powerful by bringing your own API. | ||
@@ -142,13 +153,13 @@ ## Usage (Programmatic) | ||
- `provider`: (string) Either `github`, `gitlab`, `bitbucket` or `sourcehut`. The default is `github`. | ||
- `repo`: (string) Name of repository in format of `{username}/{reponame}`. | ||
- `repo`: (string) Name of the repository in the format of `{username}/{reponame}`. | ||
- `ref`: (string) Git ref (branch or commit or tag). The default value is `main`. | ||
- `subdir`: (string) Directory of the repo to clone from. The default value is none. | ||
- `force`: (boolean) Extract to the exisiting dir even if already exsists. | ||
- `forceClean`: (boolean) ⚠️ Clean ups any existing directory or file before cloning. | ||
- `offline`: (boolean) Do not attempt to download and use cached version. | ||
- `force`: (boolean) Extract to the existing dir even if already exists. | ||
- `forceClean`: (boolean) ⚠️ Clean up any existing directory or file before cloning. | ||
- `offline`: (boolean) Do not attempt to download and use the cached version. | ||
- `preferOffline`: (boolean) Use cache if exists otherwise try to download. | ||
- `providers`: (object) A map from provider name to custom providers. Can be used to override built-ins too. | ||
- `registry`: (string or false) Set to `false` to disable registry. Set to a URL string (without trailing slash) for custom registry. (Can be overriden with `GIGET_REGISTRY` environment variable). | ||
- `registry`: (string or false) Set to `false` to disable registry. Set to a URL string (without trailing slash) for custom registry. (Can be overridden with `GIGET_REGISTRY` environment variable). | ||
- `cwd`: (string) Current working directory to resolve dirs relative to it. | ||
- `auth`: (string) Custom Authorization token to use for downloading template. (Can be overriden with `GIGET_AUTH` environment variable). | ||
- `auth`: (string) Custom Authorization token to use for downloading template. (Can be overridden with `GIGET_AUTH` environment variable). | ||
@@ -162,7 +173,7 @@ **Return value:** | ||
- [other provider template keys] | ||
- `url`: (string) URL of repostiroy that can be opened in browser. Useful for logging. | ||
- `url`: (string) URL of the repository that can be opened in the browser. Useful for logging. | ||
## Custom Providers | ||
Using programmatic method, you can make your own custom template providers. | ||
Using the programmatic method, you can make your custom template providers. | ||
@@ -203,5 +214,11 @@ ```ts | ||
## Providing token for private repositories | ||
For private repositories and sources, you might need a token. In order to provide it, using CLI, you can use `--auth`, using programmatic API using `auth` option and in both modes also it is possible to use `GIGET_AUTH` environment variable to set it. The value will be set in `Authorization: Bearer ...` header by default. | ||
**Note:** For github private repository access with Fine-grained access tokens, you need to give **Contents** and **Metadata** repository permissions. | ||
## Related projects | ||
Giget wouldn't be possible without inspiration from former projects. In comparison, giget does not depend on any local command which increases stability and performance, supports custom template providers, auth and many more features out of the box. | ||
Giget wouldn't be possible without inspiration from former projects. In comparison, giget does not depend on any local command which increases stability and performance and supports custom template providers, auth, and many more features out of the box. | ||
@@ -227,9 +244,9 @@ - https://github.com/samsonjs/gitter | ||
[npm-version-src]: https://img.shields.io/npm/v/giget?style=flat-square | ||
[npm-version-href]: https://npmjs.com/package/giget | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/giget?style=flat-square | ||
[npm-downloads-href]: https://npmjs.com/package/giget | ||
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/giget/ci/main?style=flat-square | ||
[github-actions-href]: https://github.com/unjs/giget/actions?query=workflow%3Aci | ||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/giget/main?style=flat-square | ||
[codecov-href]: https://codecov.io/gh/unjs/giget | ||
[npm-version-src]: https://img.shields.io/npm/v/packageName?style=flat&colorA=18181B&colorB=F0DB4F | ||
[npm-version-href]: https://npmjs.com/package/packageName | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/packageName?style=flat&colorA=18181B&colorB=F0DB4F | ||
[npm-downloads-href]: https://npmjs.com/package/packageName | ||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/packageName/main?style=flat&colorA=18181B&colorB=F0DB4F | ||
[codecov-href]: https://codecov.io/gh/unjs/packageName | ||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/packageName?style=flat&colorA=18181B&colorB=F0DB4F | ||
[bundle-href]: https://bundlephobia.com/result?p=packageName |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
48268
1110
243
24
1
8
+ Addedcitty@^0.1.5
+ Addedconsola@^3.2.3
+ Addednypm@^0.3.3
+ Addedohash@^1.1.3
+ Addedacorn@8.14.0(transitive)
+ Addedcitty@0.1.6(transitive)
+ Addedconfbox@0.1.8(transitive)
+ Addedconsola@3.2.3(transitive)
+ Addedcross-spawn@7.0.5(transitive)
+ Addedexeca@8.0.1(transitive)
+ Addedget-stream@8.0.1(transitive)
+ Addedhuman-signals@5.0.0(transitive)
+ Addedis-stream@3.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@4.0.0(transitive)
+ Addedmlly@1.7.2(transitive)
+ Addednpm-run-path@5.3.0(transitive)
+ Addednypm@0.3.12(transitive)
+ Addedohash@1.1.4(transitive)
+ Addedonetime@6.0.0(transitive)
+ Addedpath-key@3.1.14.0.0(transitive)
+ Addedpkg-types@1.2.1(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstrip-final-newline@3.0.0(transitive)
+ Addedufo@1.5.4(transitive)
+ Addedwhich@2.0.2(transitive)
- Removedcolorette@^2.0.20
- Removedhttps-proxy-agent@^7.0.2
- Removedmri@^1.2.0
- Removedagent-base@7.1.1(transitive)
- Removedcolorette@2.0.20(transitive)
- Removeddebug@4.3.7(transitive)
- Removedhttps-proxy-agent@7.0.5(transitive)
- Removedmri@1.2.0(transitive)
- Removedms@2.1.3(transitive)
Updateddefu@^6.1.3
Updatednode-fetch-native@^1.6.1