Skip to content

Commit

Permalink
use appropriate modules
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed Jan 19, 2024
1 parent 3b298c2 commit 9e8e4d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
24 changes: 11 additions & 13 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29964,22 +29964,20 @@ async function findStarknetFoundryDir(extractedPath) {
}

async function downloadUniversalSierraCompiler() {
const { exec } = __nccwpck_require__(2081);
const exec = __nccwpck_require__(1514);

const command =
"curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh";
const scriptUrl =
"https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh";

exec(command, (error, stdout, stderr) => {
if (error) {
console.error(
`Error while installing \`universal-sierra-compiler\`: ${error.message}`,
);
console.error(`Stderr: ${stderr}`);
return;
}
try {
const scriptPath = await tool_cache.downloadTool(scriptUrl);

console.log(`Successfully installed \`universal-sierra-compiler\``);
});
await exec.exec(`chmod +x ${scriptPath}`);

await exec.exec(scriptPath);
} catch (error) {
core.setFailed(error.message);
}
}

;// CONCATENATED MODULE: ./lib/main.js
Expand Down
27 changes: 12 additions & 15 deletions lib/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from "path";
import fs from "fs/promises";
import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as exec from "@actions/exec";
import { getOsTriplet } from "./platform";
import { versionWithPrefix } from "./versions";

Expand Down Expand Up @@ -39,20 +40,16 @@ async function findStarknetFoundryDir(extractedPath) {
}

export async function downloadUniversalSierraCompiler() {
const { exec } = require("child_process");

const command =
"curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh";

exec(command, (error, stdout, stderr) => {
if (error) {
console.error(
`Error while installing \`universal-sierra-compiler\`: ${error.message}`,
);
console.error(`Stderr: ${stderr}`);
return;
}
const scriptUrl =
"https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh";

try {
const scriptPath = await tc.downloadTool(scriptUrl);

console.log(`Successfully installed \`universal-sierra-compiler\``);
});
await exec.exec(`chmod +x ${scriptPath}`);

await exec.exec(scriptPath);
} catch (error) {
core.setFailed(error.message);
}
}

0 comments on commit 9e8e4d7

Please sign in to comment.