Exemplo n.º 1
0
 public SolutionModuleAdder(
     IJsonSerializer jsonSerializer,
     ProjectNugetPackageAdder projectNugetPackageAdder,
     DbContextFileBuilderConfigureAdder dbContextFileBuilderConfigureAdder,
     EfCoreMigrationAdder efCoreMigrationAdder,
     DerivedClassFinder derivedClassFinder,
     ProjectNpmPackageAdder projectNpmPackageAdder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     SourceCodeDownloadService sourceCodeDownloadService,
     SolutionFileModifier solutionFileModifier,
     NugetPackageToLocalReferenceConverter nugetPackageToLocalReferenceConverter,
     AngularModuleSourceCodeAdder angularModuleSourceCodeAdder)
 {
     JsonSerializer                        = jsonSerializer;
     ProjectNugetPackageAdder              = projectNugetPackageAdder;
     DbContextFileBuilderConfigureAdder    = dbContextFileBuilderConfigureAdder;
     EfCoreMigrationAdder                  = efCoreMigrationAdder;
     DerivedClassFinder                    = derivedClassFinder;
     ProjectNpmPackageAdder                = projectNpmPackageAdder;
     NpmGlobalPackagesChecker              = npmGlobalPackagesChecker;
     RemoteServiceExceptionHandler         = remoteServiceExceptionHandler;
     SourceCodeDownloadService             = sourceCodeDownloadService;
     SolutionFileModifier                  = solutionFileModifier;
     NugetPackageToLocalReferenceConverter = nugetPackageToLocalReferenceConverter;
     AngularModuleSourceCodeAdder          = angularModuleSourceCodeAdder;
     Logger = NullLogger <SolutionModuleAdder> .Instance;
 }
Exemplo n.º 2
0
 public NpmPackagesUpdater(
     PackageJsonFileFinder packageJsonFileFinder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     MyGetPackageListFinder myGetPackageListFinder,
     ICancellationTokenProvider cancellationTokenProvider)
 {
     _packageJsonFileFinder    = packageJsonFileFinder;
     _npmGlobalPackagesChecker = npmGlobalPackagesChecker;
     _myGetPackageListFinder   = myGetPackageListFinder;
     CancellationTokenProvider = cancellationTokenProvider;
     Logger = NullLogger <NpmPackagesUpdater> .Instance;
 }
Exemplo n.º 3
0
        private async Task AddNugetAndNpmReferences(ModuleWithMastersInfo module, string[] projectFiles)
        {
            foreach (var nugetPackage in module.NugetPackages)
            {
                var nugetTarget =
                    await IsProjectTiered(projectFiles) && nugetPackage.TieredTarget != NuGetPackageTarget.Undefined ?
                    nugetPackage.TieredTarget :
                    nugetPackage.Target;

                var targetProjectFile = ProjectFinder.FindNuGetTargetProjectFile(projectFiles, nugetTarget);
                if (targetProjectFile == null)
                {
                    Logger.LogDebug($"Target project is not available for this NuGet package '{nugetPackage.Name}'");
                    continue;
                }

                await ProjectNugetPackageAdder.AddAsync(targetProjectFile, nugetPackage);
            }

            if (!module.NpmPackages.IsNullOrEmpty())
            {
                var targetProjects = ProjectFinder.FindNpmTargetProjectFile(projectFiles);
                if (targetProjects.Any())
                {
                    NpmGlobalPackagesChecker.Check();

                    foreach (var targetProject in targetProjects)
                    {
                        foreach (var npmPackage in module.NpmPackages.Where(p =>
                                                                            p.ApplicationType.HasFlag(NpmApplicationType.Mvc)))
                        {
                            await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage);
                        }
                    }
                }
                else
                {
                    Logger.LogDebug("Target project is not available for NPM packages.");
                }
            }
        }