https://github.com/atata-framework/atata-cli-npm
.NET library that provides an API for NPM
https://github.com/atata-framework/atata-cli-npm
api atata cli npm
Last synced: 6 months ago
JSON representation
.NET library that provides an API for NPM
- Host: GitHub
- URL: https://github.com/atata-framework/atata-cli-npm
- Owner: atata-framework
- License: apache-2.0
- Created: 2021-06-24T08:56:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-28T13:27:26.000Z (8 months ago)
- Last Synced: 2025-04-10T04:26:16.398Z (6 months ago)
- Topics: api, atata, cli, npm
- Language: C#
- Size: 96.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Atata.Cli.Npm
[](https://www.nuget.org/packages/Atata.Cli.Npm/)
[](https://github.com/atata-framework/atata-cli-npm/releases)
[](https://dev.azure.com/atata-framework/atata-cli-npm/_build/latest?definitionId=44&branchName=main)
[](https://join.slack.com/t/atata-framework/shared_invite/zt-5j3lyln7-WD1ZtMDzXBhPm0yXLDBzbA)
[](https://atata.io)
[](https://twitter.com/AtataFramework)**Atata.Cli.Npm** is a .NET library that provides an API for [NPM](https://www.npmjs.com/).
*The package targets .NET Standard 2.0, which supports .NET 5+, .NET Framework 4.6.1+ and .NET Core/Standard 2.0+.*
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Feedback](#feedback)
- [SemVer](#semver)
- [License](#license)## Features
- Checks whether NPM is installed.
- Checks whether package is installed.
- Gets installed package version.
- Installs package.
- Uninstalls package.## Installation
Install [`Atata.Cli.Npm`](https://www.nuget.org/packages/Atata.Cli.Npm/) NuGet package.
- Package Manager:
```
Install-Package Atata.Cli.Npm
```- .NET CLI:
```
dotnet add package Atata.Cli.Npm
```## Usage
The main class is `NpmCli` located in `Atata.Cli.Npm` namespace.
There is also `GlobalNpmPackageCli`, which can be used as a base class of specific NPM package CLI.
### Check NPM is Installed
```cs
bool isNpmInstalled = new NpmCli()
.IsItInstalled();
```### Ensure NPM is Installed
```cs
new NpmCli()
.EnsureItIsInstalled();
```If NPM isn't installed, throws `NpmNotFoundException`.
### Install Package Into Directory
```cs
NpmCli.InDirectory("some/dir")
.Install("npm-package-name-1")
.Install("npm-package-name-2", "1.2.3");
```### Install Package Globally
```cs
new NpmCli()
.Install("html-validate", global: true);
```### Install Package If Missing
```cs
NpmCli.InBaseDirectory()
.InstallIfMissing("html-validate", global: true);
```### Check Package is Installed
```cs
bool isPackageInstalled = new NpmCli()
.IsInstalled("html-validate", global: true);
```### Check Specific Package Version is Installed
```cs
bool isPackageVersionInstalled = new NpmCli()
.IsInstalled("html-validate", "5.0.0", global: true);
```### Get Installed Package Version
```cs
string packageVersion = new NpmCli()
.GetInstalledVersion("html-validate", global: true);
```### Uninstall Package
```cs
new NpmCli()
.Uninstall("html-validate", global: true);
```## Feedback
Any feedback, issues and feature requests are welcome.
If you faced an issue please report it to [Atata.Cli.Npm Issues](https://github.com/atata-framework/atata-cli-npm/issues),
[ask a question on Stack Overflow](https://stackoverflow.com/questions/ask?tags=atata+csharp) using [atata](https://stackoverflow.com/questions/tagged/atata) tag
or use another [Atata Contact](https://atata.io/contact/) way.## SemVer
Atata Framework follows [Semantic Versioning 2.0](https://semver.org/).
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.## License
Atata is an open source software, licensed under the Apache License 2.0.
See [LICENSE](LICENSE) for details.