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

🐛 Use tag versions to select CLI version on welcome screen #225

Merged
merged 2 commits into from
May 21, 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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { promisify } from "util";
import { TreeDataProvider } from "./views/tree-view";
import {
getWebviewContent,
fetchCliVersion,
fetchKernelVersionNonCLIDependent,
} from "./views/welcome-view";
import {
Expand Down Expand Up @@ -55,6 +54,7 @@ import {
import { startPortMonitoring } from "./device";
import { BrainViewProvider } from "./views/brain-view";
import { populateDocsJSON, debugDocsJson } from "./views/docs-webscrape";
import { getCurrentReleaseVersion } from "./one-click/installed";

/**
* COMMAND BLOCKER SECTION
Expand Down Expand Up @@ -377,7 +377,9 @@ export async function activate(context: vscode.ExtensionContext) {
// This gets the kernel version so we can display it on the welcome page
const newKernel = await fetchKernelVersionNonCLIDependent();
// This gets the CLI version so we can display it on the welcome page
const newCli = await fetchCliVersion();
const newCli = await getCurrentReleaseVersion(
"https://api.github.com/repos/purduesigbots/pros-cli/releases/latest"
);

// Setup google analytics preference and welcome page display preference
const useGoogleAnalytics =
Expand Down
40 changes: 0 additions & 40 deletions src/views/welcome-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,6 @@ var fetch = require("node-fetch");
*
* @returns The kernel library versions
*/
export const fetchKernelVersion = async (): Promise<string> => {
try {
const { stdout, stderr } = await promisify(child_process.exec)(
`pros c q --target v5 --machine-output`,
{
env: {
...process.env,
// eslint-disable-next-line @typescript-eslint/naming-convention
PATH: getChildProcessPath(),
},
}
);

let newKernel = "0.0.0";

for (let e of stdout.split(/\r?\n/)) {
if (e.startsWith(PREFIX)) {
let jdata = JSON.parse(e.substr(PREFIX.length));
if (jdata.type === "finalize") {
for (let ver of jdata.data) {
if (ver.name === "kernel" && gt(ver.version, newKernel)) {
newKernel = ver.version;
}
}
}
}
}

return newKernel;
} catch (error) {
return "0.0.0";
}
};

export const fetchKernelVersionNonCLIDependent = async (): Promise<string> => {
const response = await fetch(
"https://api.github.com/repos/purduesigbots/pros/releases/latest"
Expand All @@ -59,12 +25,6 @@ export const fetchKernelVersionNonCLIDependent = async (): Promise<string> => {
var v = (await response.json()).tag_name;
return v;
};
export const fetchCliVersion = async (): Promise<string> => {
const response = await axios.get(
"https://purduesigbots.github.io/pros-mainline/stable/UpgradeManifestV1.json"
);
return `${response.data.version.major}.${response.data.version.minor}.${response.data.version.patch}`;
};

export function getWebviewContent(
styleUri: vscode.Uri,
Expand Down
Loading