An open API service indexing awesome lists of open source software.

https://github.com/manuelgil/vscplugit

A TypeScript CLI tool for downloading, installing, and uninstalling VSCode extensions.
https://github.com/manuelgil/vscplugit

downloader vscode vsix

Last synced: 3 months ago
JSON representation

A TypeScript CLI tool for downloading, installing, and uninstalling VSCode extensions.

Awesome Lists containing this project

README

          

# vscplugit

[![NPM Version](https://img.shields.io/npm/v/vscplugit?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/vscplugit)
[![NPM Downloads](https://img.shields.io/npm/dt/vscplugit?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/vscplugit)
[![GitHub Repo Stars](https://img.shields.io/github/stars/ManuelGil/vscplugit?style=for-the-badge&logo=github)](https://github.com/ManuelGil/vscplugit)
[![GitHub License](https://img.shields.io/github/license/ManuelGil/vscplugit?style=for-the-badge&logo=github)](./LICENSE)

## Overview

**vscplugit** is an ESM-only, TypeScript-based CLI tool for downloading, installing, and uninstalling Visual Studio Code extensions. Leveraging modern packages like [inquirer](https://www.npmjs.com/package/inquirer) and [ora](https://www.npmjs.com/package/ora) alongside the robust [vscode-marketplace-client](https://www.npmjs.com/package/vscode-marketplace-client) API, vscplugit offers a streamlined way to manage your VSCode extensions directly from the command line.

## Index

- [vscplugit](#vscplugit)
- [Overview](#overview)
- [Index](#index)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Download Extension](#download-extension)
- [Install Extension](#install-extension)
- [Example: Install from Existing VSIX File](#example-install-from-existing-vsix-file)
- [Example: Download Then Install](#example-download-then-install)
- [Combined Installation Example](#combined-installation-example)
- [Debugging \& Verbose Mode](#debugging--verbose-mode)
- [Uninstall Extension](#uninstall-extension)
- [Error Handling](#error-handling)
- [Support](#support)
- [Feedback](#feedback)
- [Follow Me](#follow-me)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Changelog](#changelog)
- [License](#license)

## Features

- **Download Extensions:** Retrieve the latest VSCode extension VSIX file from the marketplace.
- **Install Extensions:** Install an extension either from an existing VSIX file or by downloading the latest version first.
- **Uninstall Extensions:** Remove a VSCode extension using its publisher and extension name.
- **ESM-Only Architecture:** Fully leverages modern ESM features in Node.js (v18+).
- **Modular Command Registration:** Built using SOLID principles for easy extension and maintenance.
- **Clear Error Handling:** Uses custom error classes to provide precise and descriptive error messages.

## Installation

Install **vscplugit** globally using npm:

```bash
npm install -g vscplugit
```

Or clone the repository and build it locally:

```bash
git clone https://github.com/ManuelGil/vscplugit.git
cd vscplugit
npm install
npm run build
```

## Usage

After installation, use **vscplugit** from your command line. Below are some examples.

### Download Extension

Download the latest VSCode extension VSIX file:

```bash
vscplugit download --publisher --extension [--output ]
```

**Options:**

- `--publisher, -p`: Publisher name of the extension.
- `--extension, -e`: Name of the extension.
- `--output, -o`: (Optional) Directory where the VSIX file will be saved (default: `./downloads`).

### Install Extension

The install command is versatile—it can download the VSIX file before installing it or install directly from an existing VSIX file.

#### Example: Install from Existing VSIX File

```bash
vscplugit install --publisher --extension --file /path/to/extension.vsix
```

**Options:**

- `--file, -f`: Path to an existing VSIX file to install.

#### Example: Download Then Install

If you do not supply a VSIX file, the tool will download the latest VSIX file from the marketplace before installing it:

```bash
vscplugit install --publisher --extension [--output ]
```

**Options:**

- `--output, -o`: (Optional) Directory to save the downloaded VSIX file (default: `./downloads`).

#### Combined Installation Example

You can combine options to customize your workflow. For example, to install an extension while specifying both a download directory and a fallback VSIX file path:

```bash
vscplugit install --publisher ms-vscode --extension cpptools --output ./my-downloads --file ./fallback/cpptools.vsix
```

In this scenario, if the fallback VSIX file isn’t found, the tool downloads the file to `./my-downloads` before proceeding with the installation.

#### Debugging & Verbose Mode

For more detailed output during execution, you can enable verbose logging (if supported by your environment):

```bash
VERBOSE=true vscplugit download --publisher ms-vscode --extension cpptools
```

> **Note:** Ensure you are using Node.js v18+ and an ESM-compatible shell.

### Uninstall Extension

Remove a VSCode extension by specifying its publisher and extension name:

```bash
vscplugit uninstall --publisher --extension
```

**Options:**

- `--publisher, -p`: Publisher name of the extension.
- `--extension, -e`: Name of the extension.

## Error Handling

vscplugit employs custom error classes for precise error management. For example:

```typescript
try {
// Execute a command
} catch (error) {
if (error instanceof ExtensionNotFoundError) {
console.error('Extension not found:', error.message);
} else if (error instanceof VersionNotFoundError) {
console.error('Version not found:', error.message);
} else if (error instanceof VsixFileNotFoundError) {
console.error('VSIX file not found:', error.message);
} else {
console.error('An unexpected error occurred:', error);
}
}
```

## Support

If you encounter any issues or have suggestions for improvements, please [open an issue](https://github.com/ManuelGil/vscplugit/issues) on GitHub.

## Feedback

If you enjoy using CodeMark+, please consider leaving a review on the [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=imgildev.vscode-marketplace-client).

## Follow Me

Stay updated on the latest features, improvements, and future projects by following me:

- [GitHub](https://github.com/ManuelGil)
- [Twitter (X)](https://twitter.com/imgildev)

## Contributing

We welcome contributions from the community! To contribute, fork the [GitHub repository](https://github.com/ManuelGil/vscplugit) and submit a pull request.

Before contributing, please review our [Contribution Guidelines](./CONTRIBUTING.md) for details on coding standards and best practices.

## Code of Conduct

We strive to create a welcoming, inclusive, and respectful environment for all contributors. Please read our [Code of Conduct](./CODE_OF_CONDUCT.md) before participating in this project.

## Changelog

See the full list of changes in the [CHANGELOG.md](./CHANGELOG.md) file.

## License

This extension is licensed under the MIT License. See the [MIT License](https://opensource.org/licenses/MIT) for more details.