Example #1
0
        public virtual async Task AddAsync(
            [NotNull] string solutionFile, [NotNull] string moduleName,
            string startupProject,
            string version,
            bool skipDbMigrations = false,
            bool withSourceCode   = false)
        {
            Check.NotNull(solutionFile, nameof(solutionFile));
            Check.NotNull(moduleName, nameof(moduleName));

            var module = await FindModuleInfoAsync(moduleName);

            Logger.LogInformation($"Installing module '{module.Name}' to the solution '{Path.GetFileNameWithoutExtension(solutionFile)}'");

            var projectFiles = ProjectFinder.GetProjectFiles(solutionFile);

            await AddNugetAndNpmReferences(module, projectFiles);

            if (withSourceCode)
            {
                var modulesFolderInSolution = Path.Combine(Path.GetDirectoryName(solutionFile), "modules");
                await DownloadSourceCodesToSolutionFolder(module, modulesFolderInSolution, version);

                await SolutionFileModifier.AddModuleToSolutionFileAsync(module, solutionFile);

                await NugetPackageToLocalReferenceConverter.Convert(module, solutionFile);

                await HandleAngularProject(modulesFolderInSolution, solutionFile);
            }

            ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations);
        }
Example #2
0
        public async Task UpdateSolutionAsync(string solutionPath, bool includePreviews = false, bool switchToStable = false)
        {
            var projectPaths = ProjectFinder.GetProjectFiles(solutionPath);

            foreach (var filePath in projectPaths)
            {
                await UpdateInternalAsync(filePath, includePreviews, switchToStable);
            }
        }