UNPKG

snyk-nuget-plugin

Version:
83 lines (79 loc) 2.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generate = generate; const generator = require("./generator"); function generate() { const files = [ { name: 'Parse.csproj', contents: ` <Project Sdk='Microsoft.NET.Sdk'> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net6.0</TargetFramework> <Nullable>enable</Nullable> <RootNamespace>ShortNameToLongName</RootNamespace> <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> <RollForward>LatestMajor</RollForward> </PropertyGroup> <ItemGroup> <PackageReference Include='Newtonsoft.Json' Version='13.0.3' /> <PackageReference Include='NuGet.Frameworks' Version='6.7.0' /> </ItemGroup> </Project> `, }, { name: 'Program.cs', contents: ` using System; using NuGet.Frameworks; using Newtonsoft.Json; class Program { static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: dotnet run <shortTargetFramework>"); return; } string shortName = args[0]; try { NuGetFramework framework = NuGetFramework.Parse(shortName); string json = JsonConvert.SerializeObject(new { framework.Framework, framework.Version, framework.Platform, framework.PlatformVersion, framework.HasPlatform, framework.HasProfile, framework.Profile, framework.DotNetFrameworkName, framework.DotNetPlatformName, framework.IsPCL, framework.IsPackageBased, framework.AllFrameworkVersions, framework.IsUnsupported, framework.IsAgnostic, framework.IsAny, framework.IsSpecificFramework, ShortName = shortName }, Formatting.None); Console.Write(json); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } } } `, }, ]; const tempDir = generator.generate('csharp', files); return tempDir; } //# sourceMappingURL=nugetframeworks_parser.js.map