Esempio n. 1
0
    protected virtual async Task RunInstallLibsAsync(string fileDirectory)
    {
        var args = new CommandLineArgs("install-libs");

        args.Options.Add(InstallLibsCommand.Options.WorkingDirectory.Short, fileDirectory);

        await InstallLibsCommand.ExecuteAsync(args);
    }
Esempio n. 2
0
 public NpmPackagesUpdater(
     PackageJsonFileFinder packageJsonFileFinder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     ICancellationTokenProvider cancellationTokenProvider,
     CliHttpClientFactory cliHttpClientFactory,
     InstallLibsCommand ınstallLibsCommand,
     ICmdHelper cmdHelper)
 {
     _packageJsonFileFinder    = packageJsonFileFinder;
     _npmGlobalPackagesChecker = npmGlobalPackagesChecker;
     CancellationTokenProvider = cancellationTokenProvider;
     InstallLibsCommand        = ınstallLibsCommand;
     CmdHelper             = cmdHelper;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <NpmPackagesUpdater> .Instance;
 }
Esempio n. 3
0
 public ProjectNpmPackageAdder(CliHttpClientFactory cliHttpClientFactory,
                               IJsonSerializer jsonSerializer,
                               SourceCodeDownloadService sourceCodeDownloadService,
                               AngularSourceCodeAdder angularSourceCodeAdder,
                               IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
                               InstallLibsCommand ınstallLibsCommand,
                               ICmdHelper cmdHelper)
 {
     JsonSerializer                = jsonSerializer;
     SourceCodeDownloadService     = sourceCodeDownloadService;
     AngularSourceCodeAdder        = angularSourceCodeAdder;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     InstallLibsCommand            = ınstallLibsCommand;
     CmdHelper             = cmdHelper;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <ProjectNpmPackageAdder> .Instance;
 }
Esempio n. 4
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;
            }

            await InstallLibsCommand.ExecuteAsync(
                new CommandLineArgs("install-libs")
                );
        }
    }