Skip to content

Commit

Permalink
Merge pull request #6 from pawanpaudel93/fix/aos-process-download
Browse files Browse the repository at this point in the history
fix: Download aos process correctly
  • Loading branch information
pawanpaudel93 authored Aug 15, 2024
2 parents 5fb61cf + 01b940a commit 149fe83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-eagles-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-ao-contract": patch
---

fix: Download aos process correctly
15 changes: 4 additions & 11 deletions src/helpers/downloadAosProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import fse from "fs-extra";
import path from "path";
import { getAosProcessPath } from "@/utils/getAosProcessPath.js";

const zipUrl = "https://github.com/permaweb/aos/archive/refs/heads/main.zip";
const folderToCopy = "aos-main/process";
const maxRetries = 3;
const retryDelay = 2000; // 2 seconds
const zipUrl = "https://github.com/pawanpaudel93/ao-deploy-config/raw/main/process.zip";
const folderToCopy = "process";
const maxRetries = 10;
const retryDelay = 3000; // 3 seconds

async function fetchWithRetry(url: string, retries: number, delay: number) {
for (let attempt = 1; attempt <= retries; attempt++) {
Expand Down Expand Up @@ -73,13 +73,6 @@ export async function downloadAosProcess(projectDir: string) {

// Copy everything inside testing Directory
const testingDir = path.join(projectDir, "src", "libs", "testing");
const aoResponse = await fetchWithRetry(
"https://raw.githubusercontent.com/permaweb/ao/main/dev-cli/container/src/ao.lua",
maxRetries,
retryDelay
)
const aoCode = await aoResponse?.text()
await fse.writeFile(path.join(testingDir, "ao.lua"), aoCode!)
await fse.copy(testingDir, destinationDir);
await fse.remove(testingDir);

Expand Down

0 comments on commit 149fe83

Please sign in to comment.