Exemple #1
0
        private static async Task <UnpkgJsonEntry> AddPackage(string package)
        {
            var distFile = await Dist.Get(package);

            if (distFile == null)
            {
                return(null);
            }

            await DownloadPackage(package, distFile.BaseUrl, distFile.Files);

            return(UnpkgJsonEntry.Create(package, distFile));
        }
Exemple #2
0
        private static async Task <UnpkgJsonEntry> AddPackage(string package)
        {
            var distFile = await Dist.Get(package);

            if (distFile == null)
            {
                return(null);
            }

            var distDirectory = distFile.Files.FirstOrDefault(f =>
                                                              f.Type.Equals("directory", StringComparison.OrdinalIgnoreCase) && f.Path.Equals("/dist", StringComparison.OrdinalIgnoreCase));

            if (distDirectory != null)
            {
                distDirectory.BaseUrl = distFile.BaseUrl;
                distFile = distDirectory;
            }

            await DownloadPackage(package, distFile.BaseUrl, distFile.Files);

            return(UnpkgJsonEntry.Create(package, distFile));
        }
Exemple #3
0
 private static async Task <(UnpkgJsonEntry, DistFile)> GetDistFile(UnpkgJsonEntry entry)
 {
     return(entry, await Dist.Get(entry.PackageName));
 }