@gearbox-protocol/deploy-tools 5.49.10 → 5.49.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +40 -16
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -429515,40 +429515,44 @@ var log = log_default.child({ name: "git" });
429515
429515
  function getGithubUrl(repo, https = false) {
429516
429516
  const credentials = process.env.GIT_TOKEN ?? process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN;
429517
429517
  const githubUser = process.env.GITHUB_USER;
429518
- log.info({
429519
- GIT_TOKEN: process.env.GIT_TOKEN?.slice(-4) ?? "--",
429520
- GITHUB_TOKEN: process.env.GITHUB_TOKEN?.slice(-4) ?? "--",
429521
- GH_TOKEN: process.env.GH_TOKEN?.slice(-4) ?? "--",
429522
- GITHUB_USER: githubUser ?? "--"
429523
- }, `using git token *****${credentials?.slice(-4)}`);
429524
429518
  const path12 = repo.replace(/^@/, "").replace(/\/$/, "");
429525
429519
  let cred = "";
429526
429520
  if (credentials) {
429527
429521
  cred = githubUser ? `${githubUser}:${credentials}@` : `${credentials}@`;
429528
429522
  }
429529
429523
  const url2 = https || credentials ? `https://${cred}github.com/${path12}.git` : `git@github.com:${path12}.git`;
429524
+ const censored = credentials ? url2.replace(credentials, `*****${credentials?.slice(-4)}`) : url2;
429525
+ log.info(`github URL: ${censored}`);
429530
429526
  return url2;
429531
429527
  }
429532
429528
  async function cloneRepo(opts) {
429533
429529
  const { repo, commit, sandboxDir } = opts;
429534
429530
  const destDir = opts.destDir ?? repo.split("/")[1];
429535
429531
  const repoPath = path.resolve(sandboxDir, destDir);
429532
+ const cloneUrl = getGithubUrl(repo);
429533
+ const clearCreds = ["credential-cache", "exit"];
429534
+ spawnSync("git", clearCreds, { cwd: sandboxDir });
429535
+ const gitConfig = ["config", "--local", "credential.helper", "store"];
429536
+ spawnSync("git", gitConfig, { cwd: sandboxDir });
429536
429537
  if (existsSync(repoPath)) {
429537
429538
  log.trace(`repo ${repoPath} already exists, assuming repo already cloned`);
429538
429539
  if (opts.disablePull) {
429539
429540
  return;
429540
429541
  }
429541
429542
  } else {
429542
- const clone2 = ["clone", getGithubUrl(repo), destDir];
429543
+ const clone2 = ["clone", cloneUrl, destDir];
429543
429544
  log.debug(`cloning ${repo} at ${commit} to ${destDir}`);
429544
- await new Promise((r) => {
429545
- log.flush(r);
429546
- });
429547
429545
  const { stderr, status, error: error46 } = spawnSync("git", clone2, {
429548
- cwd: sandboxDir
429546
+ cwd: sandboxDir,
429547
+ env: {
429548
+ ...process.env,
429549
+ GIT_TERMINAL_PROMPT: "0"
429550
+ // Disable credential prompts
429551
+ }
429549
429552
  });
429550
429553
  if (error46 || status !== 0) {
429551
429554
  log.error(`Git clone failed with status ${status}: ${stderr?.toString()}`);
429555
+ log.error(`Clone command: git ${clone2.join(" ")}`);
429552
429556
  throw error46 ?? new Error(stderr?.toString());
429553
429557
  }
429554
429558
  log.debug({ clone: clone2 }, "cloned");
@@ -429557,7 +429561,12 @@ async function cloneRepo(opts) {
429557
429561
  const reset2 = ["reset", "--hard", commit, "--"];
429558
429562
  log.trace({ reset: reset2 }, "reset");
429559
429563
  const { stderr, status, error: error46 } = spawnSync("git", reset2, {
429560
- cwd: repoPath
429564
+ cwd: repoPath,
429565
+ env: {
429566
+ ...process.env,
429567
+ GIT_TERMINAL_PROMPT: "0"
429568
+ // Disable credential prompts
429569
+ }
429561
429570
  });
429562
429571
  if (error46 || status !== 0) {
429563
429572
  throw error46 ?? new Error(stderr?.toString());
@@ -429566,13 +429575,23 @@ async function cloneRepo(opts) {
429566
429575
  } else {
429567
429576
  log.trace(`fetching latest from ${repoPath}...`);
429568
429577
  const fetchResult = spawnSync("git", ["fetch", "--all"], {
429569
- cwd: path.resolve(sandboxDir, destDir)
429578
+ cwd: path.resolve(sandboxDir, destDir),
429579
+ env: {
429580
+ ...process.env,
429581
+ GIT_TERMINAL_PROMPT: "0"
429582
+ // Disable credential prompts
429583
+ }
429570
429584
  });
429571
429585
  if (fetchResult.error || fetchResult.status !== 0) {
429572
429586
  throw fetchResult.error ?? new Error(fetchResult.stderr?.toString());
429573
429587
  }
429574
429588
  const currentBranchResult = spawnSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
429575
- cwd: path.resolve(sandboxDir, destDir)
429589
+ cwd: path.resolve(sandboxDir, destDir),
429590
+ env: {
429591
+ ...process.env,
429592
+ GIT_TERMINAL_PROMPT: "0"
429593
+ // Disable credential prompts
429594
+ }
429576
429595
  });
429577
429596
  if (currentBranchResult.error || currentBranchResult.status !== 0) {
429578
429597
  throw currentBranchResult.error ?? new Error(currentBranchResult.stderr?.toString());
@@ -429580,7 +429599,12 @@ async function cloneRepo(opts) {
429580
429599
  const currentBranch = currentBranchResult.stdout.toString().trim();
429581
429600
  log.trace(`resetting ${repoPath} to latest commit in origin/${currentBranch}...`);
429582
429601
  const resetResult = spawnSync("git", ["reset", "--hard", `origin/${currentBranch}`], {
429583
- cwd: path.resolve(sandboxDir, destDir)
429602
+ cwd: path.resolve(sandboxDir, destDir),
429603
+ env: {
429604
+ ...process.env,
429605
+ GIT_TERMINAL_PROMPT: "0"
429606
+ // Disable credential prompts
429607
+ }
429584
429608
  });
429585
429609
  if (resetResult.error || resetResult.status !== 0) {
429586
429610
  throw resetResult.error ?? new Error(resetResult.stderr?.toString());
@@ -458780,7 +458804,7 @@ function getRenderer(opts) {
458780
458804
  var package_default = {
458781
458805
  name: "@gearbox-protocol/deploy-tools",
458782
458806
  description: "Gearbox deploy tools",
458783
- version: "5.49.10",
458807
+ version: "5.49.12",
458784
458808
  homepage: "https://gearbox.fi",
458785
458809
  keywords: [
458786
458810
  "gearbox"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/deploy-tools",
3
3
  "description": "Gearbox deploy tools",
4
- "version": "5.49.10",
4
+ "version": "5.49.12",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"