MCPcopy Create free account
hub / github.com/Azure/powershell / getLatestModule

Method getLatestModule

src/Utilities/Utils.ts:78–98  ·  view source on GitHub ↗
(moduleName: string)

Source from the content-addressed store, hash-verified

76 }
77
78 static async getLatestModule(moduleName: string): Promise<string> {
79 let output: string = "";
80 const options: any = {
81 listeners: {
82 stdout: (data: Buffer) => {
83 output += data.toString();
84 }
85 }
86 };
87 await PowerShellToolRunner.executePowerShellScriptBlock(new ScriptBuilder()
88 .getLatestModuleScript(moduleName), options);
89 const outputJson = JSON.parse(output.trim());
90 if (!(Constants.Success in outputJson)) {
91 throw new Error(outputJson[Constants.Error]);
92 }
93 const azLatestVersion: string = outputJson[Constants.AzVersion];
94 if (!Utils.isValidVersion(azLatestVersion)) {
95 throw new Error(`Invalid AzPSVersion: ${azLatestVersion}`);
96 }
97 return azLatestVersion;
98 }
99
100 static async checkModuleVersion(moduleName: string, version: string) {
101 let output: string = "";

Callers 1

importAzModuleMethod · 0.45

Calls 4

toStringMethod · 0.80
getLatestModuleScriptMethod · 0.45
isValidVersionMethod · 0.45

Tested by

no test coverage detected