open-index/open-npm huggingface dataset:
npm package: @longucodes/plugin-system-cli
Description: ### Purpose
Latest version: 0.1.18

# @longucodes/plugin-system-cli

### Purpose

This package provides a companion cli to [`@longucodes/plugin-system-loader`](../plugin-system-loader/README.md). It allows for easy installation for plugins to be loaded by mentioned package.


### Usage

To allow for automatic plugin installation, run your application with `plugins-cli "your command"`. The cli will look for `plugins.json` in current directory and install necessary plugins. 
For plugin definitions, see [End user usage](../plugin-system-loader/README.md#end-user-usage).

Additional flags: 
- `-p, --pluginsPath <path>` - Set custom path to definitions file, default `./plugins.json`
- `-c, --cli <cli command>` - Set installation cli, default `npm install`
- `-h, --help` - Show command help
npm package: @longucodes/plugin-system-core
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 0.0.16

# plugin-system-core

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test plugin-system-core` to execute the unit tests via [Jest](https://jestjs.io).

## Running lint

Run `nx lint plugin-system-core` to execute the lint via [ESLint](https://eslint.org/).
npm package: @longucodes/plugin-system-loader
Description: ### Purpose
Latest version: 0.1.8

# @longucodes/plugin-system-loader

### Purpose

This package provides a Nestjs module for dynamically loading modules during runtime. The goal is to create a way of extending ready-to-go services without needing to edit their code.

### Developer usage

To use the system, import the module in your application

```typescript
import {Module} from "@nestjs/common";
import {PluginModule} from "@longucodes/plugin-system-loader";

@Module({
  imports: [
    PluginModule.forRoot({})
  ]
})
export class AppModule {}
```

Optionally, path to the definition file can be provided
```typescript
import {Module} from "@nestjs/common";
import {PluginModule} from "@longucodes/plugin-system-loader";

@Module({
  imports: [
    PluginModule.forRoot({pluginsDefinitionFilePath: '/path/to/plugins.json'})
  ]
})
export class AppModule {}
```

It's recommended to use this module in conjunction with [`@longucodes/plugin-system-cli`](../plugin-system-cli/README.md) for runtime installation of plugins.

### End-user usage

To add a plugin, add `plugins.json` file in the directory, where microservice is running and add plugin definitions.
The file should consist of an array, with each entry representing one plugin.

##### Simple definition

Simples plugin definition is just the name of the NPM package
```json
[
  "plugin-name"
]
```

The plugin will be automatically installed by the cli and  loaded into the application.

##### Advanced definition

To add more capabilities, like config or specific version, advanced definition should be used.
```json
[
  {
    "name": "plugin-name"
  }
]
```

In addition to name, following properties can be provided.

- `version` - install specific version of the package
- `mode` - can be `static` (default) and `dynamic`. Dynamic plugins will not be installed by cli
- `config` - object with configuration values

##### Config

The config object can contain direct values or read them from environment.
To use environment variable , the config value should be the name of the environment variable with `$` at the beginning.
All variables consisting only of uppercase letters and `_`, and a `$` will be treated as a environment variable read.
```json
[
  {
    "name": "plugin-name",
    "config": {
      "staticVariable": "123",
      "dynamicVariable": "$SOME_VAR"
    }
  }
]
```
Not all plugins are configurable, check documentation of used plugin.

### Plugin development

To create your own plugin, create NPM package, that default exports a Nestjs module.
If you want your package to be configurable, add static method `forRoot` returning a dynamic module.