Skip to content

Commit

Permalink
feat: remove isomorphic-git dependency in favor of local git command (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ErwanRaulo authored Jul 15, 2024
1 parent 67f74b8 commit 70a3ea7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"esbuild": "^0.23.0",
"filenamify": "^6.0.0",
"frequency-set": "^1.0.2",
"isomorphic-git": "^1.26.3",
"kleur": "^4.1.5",
"puppeteer": "22.12.1",
"sade": "^1.8.1",
Expand Down
25 changes: 7 additions & 18 deletions src/utils/cloneGITRepository.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Import Node.js Dependencies
import fs from "node:fs";

// Import Third-party Dependencies
import git from "isomorphic-git";
import http from "isomorphic-git/http/node/index.js";
import { execFile } from "node:child_process";
import { promisify } from "node:util";

const execFilePromise = promisify(execFile);
/**
* @async
* @function cloneGITRepository
Expand All @@ -14,19 +12,10 @@ import http from "isomorphic-git/http/node/index.js";
*
* @returns {Promise<string>}
*/
export async function cloneGITRepository(
dir,
url
) {
await git.clone({
fs,
http,
dir,
url,
token: process.env.GIT_TOKEN,
singleBranch: true,
oauth2format: "github"
});
export async function cloneGITRepository(dir, url) {
const oauthUrl = url.replace("https://", `https://oauth2:${process.env.GIT_TOKEN}@`);

await execFilePromise("git", ["clone", oauthUrl, dir]);

return dir;
}

0 comments on commit 70a3ea7

Please sign in to comment.