@begit/core
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,2 +0,2 @@ | ||
import{join as f}from"path";import{createWriteStream as y}from"fs";import{mkdir as g}from"fs/promises";import{Readable as w}from"stream";import{finished as b}from"stream/promises";import{homedir as O,tmpdir as x}from"os";import{dirname as u,join as m}from"path";var $=()=>{let r=process.env.XDG_CACHE_HOME??x();return m(r,".begit")},p=()=>m($(),"cache"),l=async(r,e,t)=>{t=t??"HEAD";let o=await fetch(`https://github.com/${r}/${e}/tarball/${t}`);return{body:o.body,name:o.url.split("/").pop()}},h=async(r,e)=>{await g(u(r.toString()),{recursive:!0});let t=y(r);await b(w.fromWeb(e.body).pipe(t))},d=async(r,e)=>(await(await fetch(`https://api.github.com/repos/${r}/${e}/commits?per_page=1`)).json())[0].sha;import{existsSync as E}from"fs";import{extract as P,list as S}from"tar";import{mkdir as k}from"fs/promises";var A=async(r,e={cache:!0})=>{let{owner:t,name:o,branch:n}=r,i=await d(t,o),a=f(p(),`${t}-${o}-${i}.tar.gz`);if(E(a))return a;let s=await l(t,o,n);return await h(a,s),a},L=async r=>{let e=[];return await S({file:r,onentry:t=>e.push(t.path)}),e},R=async(r,e,t=null)=>{t&&(t=t?.startsWith("/")?t:`/${t}`,t=t?.endsWith("/")?t:`${t}/`),await k(e,{recursive:!0});let n=(await L(r)).find(a=>t?a.includes(t):!1);if(t&&!n)throw new Error("Subdirectory not found");let i=n?n.split("/").length-1:1;await new Promise((a,s)=>P({file:r.toString(),strip:i,C:e},n?[n]:void 0,c=>{c&&s(c),a()}))},z=async({repo:r,dest:e,cwd:t})=>{t=t??process.cwd(),e=e??r.name;let o=await A(r);await R(o,f(t,e),r.subdir)};export{z as downloadAndExtract,A as downloadToFile,R as extractFile}; | ||
import{join as f}from"path";import{createWriteStream as g}from"fs";import{mkdir as y}from"fs/promises";import{Readable as w}from"stream";import{finished as b}from"stream/promises";import{homedir as O,tmpdir as x}from"os";import{dirname as u,join as m}from"path";var $=()=>{let r=process.env.XDG_CACHE_HOME??x();return m(r,".begit")},p=()=>m($(),"cache"),l=async(r,o,t)=>{t=t??"HEAD";let e=await fetch(`https://github.com/${r}/${o}/tarball/${t}`);return{body:e.body,name:e.url.split("/").pop()}},h=async(r,o)=>{await y(u(r.toString()),{recursive:!0});let t=g(r);await b(w.fromWeb(o.body).pipe(t))},d=async(r,o)=>(await(await fetch(`https://api.github.com/repos/${r}/${o}/commits?per_page=1`)).json())[0].sha;import{existsSync as E}from"fs";import{extract as S,list as A}from"tar";import{mkdir as P}from"fs/promises";var R=async(r,o={cache:!0})=>{let{owner:t,name:e,branch:a}=r,i=await d(t,e),n=f(p(),`${t}-${e}-${i}.tar.gz`);if(E(n))return n;let s=await l(t,e,a);return await h(n,s),n},C=async r=>{let o=[];return await A({file:r,onentry:t=>o.push(t.path)}),o},D=async(r,o,t=null)=>{t&&(t=t?.startsWith("/")?t:`/${t}`,t=t?.endsWith("/")?t:`${t}/`),await P(o,{recursive:!0});let a=(await C(r)).find(n=>t?n.includes(t):!1);if(t&&!a)throw new Error("Subdirectory not found");let i=a?a.split("/").length-1:1;await new Promise((n,s)=>S({file:r.toString(),strip:i,C:o},a?[a]:void 0,c=>{c&&s(c),n()}))},z=async({repo:r,dest:o,cwd:t})=>{t=t??process.cwd(),o=o??r.name;let e=await R(r);await D(e,f(t,o),r.subdir)};export{z as downloadAndExtract,R as downloadToFile,D as extractFile}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@begit/core", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Blazingly fast tool for cloning git repositories, with no reliance on local `git`, or `tar` installs", | ||
"author": "", | ||
"license": "MIT", | ||
"homepage": "https://github.com/Tommypop2/begit", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Tommypop2/begit" | ||
}, | ||
"type": "module", | ||
@@ -13,2 +20,3 @@ "files": [ | ||
"types": "./types/index.d.ts", | ||
"default": "./dist/index.js", | ||
"import": "./dist/index.js" | ||
@@ -18,10 +26,8 @@ } | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^20.6.0", | ||
"@types/tar": "^6.1.5", | ||
"@types/node": "^20.7.2", | ||
"@types/tar": "^6.1.6", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.34.4" | ||
"vitest": "^0.34.6" | ||
}, | ||
@@ -28,0 +34,0 @@ "dependencies": { |
@@ -1,2 +0,1 @@ | ||
import { PathLike } from "fs"; | ||
export type Repository = { | ||
@@ -13,4 +12,4 @@ owner: string; | ||
}; | ||
export declare const downloadToFile: (repo: Repository, options?: Options) => Promise<PathLike>; | ||
export declare const extractFile: (tarPath: PathLike, dest: string, subdir?: string | null) => Promise<void>; | ||
export declare const downloadToFile: (repo: Repository, options?: Options) => Promise<string>; | ||
export declare const extractFile: (tarPath: string, dest: string, subdir?: string | null) => Promise<void>; | ||
type DownloadAndExtract = { | ||
@@ -17,0 +16,0 @@ repo: Installable; |
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
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
10973
1
5
39