Ejemplo n.º 1
0
    public async Task AddMvcPackageAsync(string directory, NpmPackageInfo npmPackage, string version = null,
                                         bool skipInstallingLibs = false)
    {
        var packageJsonFilePath = Path.Combine(directory, "package.json");

        if (!File.Exists(packageJsonFilePath) ||
            File.ReadAllText(packageJsonFilePath).Contains($"\"{npmPackage.Name}\""))
        {
            return;
        }

        Logger.LogInformation($"Installing '{npmPackage.Name}' package to the project '{packageJsonFilePath}'...");


        if (version == null)
        {
            version = DetectAbpVersionOrNull(Path.Combine(directory, "package.json"));
        }

        var versionPostfix = version != null ? $"@{version}" : string.Empty;

        using (DirectoryHelper.ChangeCurrentDirectory(directory))
        {
            Logger.LogInformation("yarn add " + npmPackage.Name + versionPostfix);
            CmdHelper.RunCmd("yarn add " + npmPackage.Name + versionPostfix);

            if (skipInstallingLibs)
            {
                return;
            }

            Logger.LogInformation("Installing client-side packages...");
            await InstallLibsService.InstallLibsAsync(directory);
        }
    }
Ejemplo n.º 2
0
 protected async Task RunInstallLibsForWebTemplateAsync(ProjectBuildArgs projectArgs)
 {
     if (AppTemplateBase.IsAppTemplate(projectArgs.TemplateName) ||
         ModuleTemplateBase.IsModuleTemplate(projectArgs.TemplateName) ||
         AppNoLayersTemplateBase.IsAppNoLayersTemplate(projectArgs.TemplateName) ||
         MicroserviceServiceTemplateBase.IsMicroserviceTemplate(projectArgs.TemplateName))
     {
         Logger.LogInformation("Installing client-side packages...");
         await InstallLibsService.InstallLibsAsync(projectArgs.OutputFolder);
     }
 }
Ejemplo n.º 3
0
 protected virtual async Task RunInstallLibsAsync(string fileDirectory)
 {
     Logger.LogInformation("Installing client-side packages...");
     await InstallLibsService.InstallLibsAsync(fileDirectory);
 }