Atata.Cli.Npm is a .NET library that provides an API for NPM.
The package targets .NET Standard 2.0, which supports .NET 5+, .NET Framework 4.6.1+ and .NET Core/Standard 2.0+.
- Checks whether NPM is installed.
- Checks whether package is installed.
- Gets installed package version.
- Installs package.
- Uninstalls package.
Install Atata.Cli.Npm
NuGet package.
-
Package Manager:
Install-Package Atata.Cli.Npm
-
.NET CLI:
dotnet add package Atata.Cli.Npm
The main class is NpmCli
located in Atata.Cli.Npm
namespace.
There is also GlobalNpmPackageCli<TCli>
, which can be used as a base class of specific NPM package CLI.
bool isNpmInstalled = new NpmCli()
.IsItInstalled();
new NpmCli()
.EnsureItIsInstalled();
If NPM isn't installed, throws NpmNotFoundException
.
NpmCli.InDirectory("some/dir")
.Install("npm-package-name-1")
.Install("npm-package-name-2", "1.2.3");
new NpmCli()
.Install("html-validate", global: true);
NpmCli.InBaseDirectory()
.InstallIfMissing("html-validate", global: true);
bool isPackageInstalled = new NpmCli()
.IsInstalled("html-validate", global: true);
bool isPackageVersionInstalled = new NpmCli()
.IsInstalled("html-validate", "5.0.0", global: true);
string packageVersion = new NpmCli()
.GetInstalledVersion("html-validate", global: true);
new NpmCli()
.Uninstall("html-validate", global: true);
Any feedback, issues and feature requests are welcome.
If you faced an issue please report it to Atata.Cli.Npm Issues, ask a question on Stack Overflow using atata tag or use another Atata Contact way.
Atata Framework follows Semantic Versioning 2.0. Thus backward compatibility is followed and updates within the same major version (e.g. from 1.3 to 1.4) should not require code changes.
Atata is an open source software, licensed under the Apache License 2.0. See LICENSE for details.