@quickdapp/cli 3.8.0 → 3.9.0

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.js +15 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7655,9 +7655,12 @@ function getGithubDownloadBase() {
7655
7655
  function getSampleContractsUrl() {
7656
7656
  return process.env.QUICKDAPP_SAMPLE_CONTRACTS_URL ?? "https://github.com/QuickDapp/sample-contracts.git";
7657
7657
  }
7658
+ async function fetchWithTimeout(url, timeoutMs) {
7659
+ return fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
7660
+ }
7658
7661
  function checkCommand(command, displayName) {
7659
7662
  try {
7660
- execSync(`which ${command}`, { stdio: "ignore" });
7663
+ execSync(`which ${command}`, { stdio: "ignore", timeout: 5000 });
7661
7664
  return true;
7662
7665
  } catch {
7663
7666
  console.error(`Error: ${displayName} is not installed.`);
@@ -7671,7 +7674,7 @@ function checkPrerequisites() {
7671
7674
  return hasGit && hasBun;
7672
7675
  }
7673
7676
  async function getLatestRelease() {
7674
- const response = await fetch(`${getGithubApiBase()}/repos/${GITHUB_REPO}/releases/latest`);
7677
+ const response = await fetchWithTimeout(`${getGithubApiBase()}/repos/${GITHUB_REPO}/releases/latest`, 1e4);
7675
7678
  if (!response.ok) {
7676
7679
  throw new Error(`Failed to fetch latest release: ${response.statusText}`);
7677
7680
  }
@@ -7679,7 +7682,7 @@ async function getLatestRelease() {
7679
7682
  return data.tag_name;
7680
7683
  }
7681
7684
  async function listReleases() {
7682
- const response = await fetch(`${getGithubApiBase()}/repos/${GITHUB_REPO}/releases`);
7685
+ const response = await fetchWithTimeout(`${getGithubApiBase()}/repos/${GITHUB_REPO}/releases`, 1e4);
7683
7686
  if (!response.ok) {
7684
7687
  throw new Error(`Failed to fetch releases: ${response.statusText}`);
7685
7688
  }
@@ -7690,7 +7693,7 @@ async function downloadAndExtract(variant, version, targetDir) {
7690
7693
  const assetName = `${packageName}-${version}.tar.gz`;
7691
7694
  const downloadUrl = `${getGithubDownloadBase()}/${GITHUB_REPO}/releases/download/${version}/${assetName}`;
7692
7695
  console.log(`Downloading ${assetName}...`);
7693
- const response = await fetch(downloadUrl);
7696
+ const response = await fetchWithTimeout(downloadUrl, 60000);
7694
7697
  if (!response.ok) {
7695
7698
  throw new Error(`Failed to download: ${response.statusText}`);
7696
7699
  }
@@ -7730,14 +7733,16 @@ async function cloneSampleContracts(targetDir) {
7730
7733
  Cloning sample-contracts...`);
7731
7734
  const cloneResult = spawnSync("git", ["clone", getSampleContractsUrl(), "sample-contracts"], {
7732
7735
  cwd: targetDir,
7733
- stdio: "inherit"
7736
+ stdio: "inherit",
7737
+ timeout: 120000
7734
7738
  });
7735
7739
  if (cloneResult.status !== 0) {
7736
7740
  throw new Error(`git clone failed with code ${cloneResult.status}`);
7737
7741
  }
7738
7742
  const submoduleResult = spawnSync("git", ["submodule", "update", "--init", "--recursive"], {
7739
7743
  cwd: join2(targetDir, "sample-contracts"),
7740
- stdio: "inherit"
7744
+ stdio: "inherit",
7745
+ timeout: 120000
7741
7746
  });
7742
7747
  if (submoduleResult.status !== 0) {
7743
7748
  throw new Error(`git submodule update failed with code ${submoduleResult.status}`);
@@ -7746,11 +7751,12 @@ Cloning sample-contracts...`);
7746
7751
  async function initGit(targetDir) {
7747
7752
  console.log(`
7748
7753
  Initializing git repository...`);
7749
- execSync("git init", { cwd: targetDir, stdio: "inherit" });
7750
- execSync("git add .", { cwd: targetDir, stdio: "inherit" });
7754
+ execSync("git init", { cwd: targetDir, stdio: "inherit", timeout: 1e4 });
7755
+ execSync("git add .", { cwd: targetDir, stdio: "inherit", timeout: 30000 });
7751
7756
  execSync('git commit -m "Initial commit from create-quickdapp"', {
7752
7757
  cwd: targetDir,
7753
- stdio: "inherit"
7758
+ stdio: "inherit",
7759
+ timeout: 30000
7754
7760
  });
7755
7761
  }
7756
7762
  async function createProject(projectName, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quickdapp/cli",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },