Skip to content

Commit

Permalink
release 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
heyAyushh committed Apr 1, 2022
1 parent 75b2495 commit c98afb3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
"command": "vscode-anchor.install",
"title": "Anchor: Install CLI"
},
{
"command": "vscode-anchor.solanaInstall",
"title": "Anchor: Install Solana"
},
{
"command": "vscode-anchor.new",
"title": "Anchor: New Program (in same workspace)"
Expand Down
3 changes: 2 additions & 1 deletion src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { anchorVerify } from "./verify";
import { anchorInit } from "./scaffold";
import { anchorNew } from "./new";
import { anchorDeploy } from "./deploy";
import { anchorInstall } from "./install";
import { anchorInstall, solanaInstall } from "./install";
import { anchorUpgrade } from "./upgrade";
import { anchorAnalyze } from "./analyze";
import { anchorHelp } from "./help";
Expand All @@ -17,6 +17,7 @@ const commands = [
anchorHelp(),
anchorInit(),
anchorInstall(),
solanaInstall(),
anchorNew(),
anchorRemoveDockerImage(),
anchorTest(),
Expand Down
34 changes: 23 additions & 11 deletions src/commands/install.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
import * as vscode from 'vscode';
import * as vscode from "vscode";
import { EXT_NAME } from "../config";
import chan from "../helpers/outputChannel";
import { checkAvm, installAnchorUsingAvm, installAvm } from "../helpers/avm";
import { checkInstallSolana } from "../helpers/install";

export const anchorInstall = () => vscode.commands.registerCommand(
`${EXT_NAME}.install`,
async () => {
try{
export const anchorInstall = () =>
vscode.commands.registerCommand(`${EXT_NAME}.install`, async () => {
try {
try {
await checkAvm();
} catch (err) {
await installAvm();
} finally {
await installAnchorUsingAvm();
}
} catch(err) {
if(err instanceof Error) {
chan.appendLine(err.message);
chan.show(true);
} catch (err) {
if (err instanceof Error) {
chan.appendLine(err.message);
chan.show(true);
}
}
});

export const solanaInstall = () =>
vscode.commands.registerCommand(`${EXT_NAME}.solanaInstall`, async () => {
try {
await checkInstallSolana();
} catch (err) {
if (err instanceof Error) {
chan.appendLine(err.message);
chan.show(true);
}
}
}}
);
});

0 comments on commit c98afb3

Please sign in to comment.