Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make rustup optional #141

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/commands/new_command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async function getFileTextIfExists(path: string) {
}

async function checkIfRequiredToolsExist() {
const requiredTools = ["deno", "cargo", "rustup"];
const requiredTools = ["deno", "cargo"];
const notInstalled: string[] = [];

for (const tool of requiredTools) {
Expand Down
35 changes: 22 additions & 13 deletions lib/pre_build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,28 @@ export async function runPreBuild(

verifyVersions(crate);

console.log(
`${
colors.bold(colors.green("Ensuring"))
} wasm32-unknown-unknown target installed...`,
);

const rustupAddWasm = new Deno.Command("rustup", {
args: ["target", "add", "wasm32-unknown-unknown"],
});
const rustupAddWasmOutput = await rustupAddWasm.output();
if (!rustupAddWasmOutput.success) {
console.error(`adding wasm32-unknown-unknown target failed`);
Deno.exit(1);
try {
const rustupAddWasm = new Deno.Command("rustup", {
args: ["target", "add", "wasm32-unknown-unknown"],
});
console.log(
`${
colors.bold(colors.green("Ensuring"))
} wasm32-unknown-unknown target installed...`,
);
const rustupAddWasmOutput = await rustupAddWasm.output();
if (!rustupAddWasmOutput.success) {
console.error(`adding wasm32-unknown-unknown target failed`);
Deno.exit(1);
}
} catch (error) {
if (error instanceof Deno.errors.NotFound) {
console.info(
`rustup not found. Ensure wasm32-unknown-unknown installed manually.`,
);
} else {
throw error;
}
}

console.log(
Expand Down