private static async Task InitLanguageSpecificArtifacts(WorkerRuntime workerRuntime, string language, bool managedDependenciesOption) { if (workerRuntime == Helpers.WorkerRuntime.python) { await PythonHelpers.SetupPythonProject(); } else if (workerRuntime == Helpers.WorkerRuntime.powershell) { await WriteFiles("profile.ps1", await StaticResources.PowerShellProfilePs1); if (managedDependenciesOption) { string majorVersion = await PowerShellHelper.GetLatestAzModuleMajorVersion(); var requirementsContent = await StaticResources.PowerShellRequirementsPsd1; requirementsContent = requirementsContent.Replace("MAJOR_VERSION", majorVersion); await WriteFiles("requirements.psd1", requirementsContent); } } else if (workerRuntime == Helpers.WorkerRuntime.node) { if (language == Constants.Languages.TypeScript) { await WriteFiles(".funcignore", await StaticResources.FuncIgnore); await WriteFiles("package.json", await StaticResources.PackageJson); await WriteFiles("tsconfig.json", await StaticResources.TsConfig); } else { await WriteFiles("package.json", await StaticResources.JavascriptPackageJson); } } }
private static async Task InitLanguageSpecificArtifacts(WorkerRuntime workerRuntime, string language, bool managedDependenciesOption) { if (workerRuntime == Helpers.WorkerRuntime.python) { await PythonHelpers.SetupPythonProject(); } else if (workerRuntime == Helpers.WorkerRuntime.powershell) { await WriteFiles("profile.ps1", await StaticResources.PowerShellProfilePs1); if (managedDependenciesOption) { string majorVersion = null; bool failedToGetModuleVersion = false; try { majorVersion = await PowerShellHelper.GetLatestAzModuleMajorVersion(); } catch { failedToGetModuleVersion = true; } string guidance = null; var requirementsContent = await StaticResources.PowerShellRequirementsPsd1; if (failedToGetModuleVersion) { guidance = "Uncomment the next line and replace the MAJOR_VERSION, e.g., 'Az' = '2.*'"; var warningMsg = "Failed to get Az module version. Edit the requirements.psd1 file when the powershellgallery.com is accessible."; ColoredConsole.WriteLine(WarningColor(warningMsg)); } else { guidance = string.Empty; requirementsContent = requirementsContent.Replace("# 'Az'", "'Az'"); requirementsContent = requirementsContent.Replace("MAJOR_VERSION", majorVersion); } requirementsContent = requirementsContent.Replace("[GUIDANCE]", guidance); await WriteFiles("requirements.psd1", requirementsContent); } } else if (workerRuntime == Helpers.WorkerRuntime.node) { if (language == Constants.Languages.TypeScript) { await WriteFiles(".funcignore", await StaticResources.FuncIgnore); await WriteFiles("package.json", await StaticResources.PackageJson); await WriteFiles("tsconfig.json", await StaticResources.TsConfig); } else { await WriteFiles("package.json", await StaticResources.JavascriptPackageJson); } } }
private static async Task InitLanguageSpecificArtifacts(WorkerRuntime workerRuntime, string language) { if (workerRuntime == Helpers.WorkerRuntime.python) { await PythonHelpers.SetupPythonProject(); } else if (workerRuntime == Helpers.WorkerRuntime.powershell) { await WriteFiles("profile.ps1", await StaticResources.PowerShellProfilePs1); } if (language == Constants.Languages.TypeScript) { await WriteFiles(".funcignore", await StaticResources.FuncIgnore); await WriteFiles("package.json", await StaticResources.PackageJson); await WriteFiles("tsconfig.json", await StaticResources.TsConfig); } }