Skip to content

Commit

Permalink
fix: Download aos process correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Aug 15, 2024
1 parent 5fb61cf commit c38db0c
Showing 1 changed file with 4 additions and 11 deletions.
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 c38db0c

Please sign in to comment.