npm package: @push-based/nx-verdaccio
Description: Nx plugin for blazing fast Verdaccio setup & testing
Latest version: 0.0.7

# @push-based/nx-verdaccio

[![npm](https://img.shields.io/npm/v/%40push-based%2Fnx-verdaccio.svg)](https://www.npmjs.com/package/@push-based/nx-verdaccio)
[![downloads](https://img.shields.io/npm/dm/%40push-based%2Fnx-verdaccio)](https://npmtrends.com/@push-based/nx-verdaccio)
[![dependencies](https://img.shields.io/librariesio/release/npm/%40push-based/nx-verdaccio)](https://www.npmjs.com/package/@push-based/nx-verdaccio?activeTab=dependencies)

## 🔌 Plugins

### Verdaccio Test Environment Plugin

Add dynamic targets to generate Verdaccion environments for other tasks, e.g. testing.

See [nx-verdaccio plugin docs](./src/plugin/README.md) for details

## Executor

### Setup Environment Executor

This executor helps to initiate an [environment folder](../../docs/benefits.md#-environment-folders-to-isolate-files-during-e2e-tests) and installs it's dependent projects.

```jsonc
// project.json
{
  "name": "my-project",
  "targets": {
    "nxv-env-setup": {
      "executor": "@code-pushup/nx-verdaccio:env-setup",
      "options": {
        "skipInstall": true,
        "keepServerRunning": true,
        "environmentRoot": "/tmp/test-npm-workspace"
      }
    }
  }
}
```

Read more under [setup executor docs](./src/executors/env-setup/README.md).

### Bootstrap Environment Executor

This executor helps to initiate [environment](../../docs/benefits.md#-environment-folders-to-isolate-files-during-e2e-tests) into a given folder.

```jsonc
// project.json
{
  "name": "my-project",
  "targets": {
    "nxv-env-bootstrap": {
      "executor": "@code-pushup/nx-verdaccio:env-bootstrap",
      "options": {
        "keepServerRunning": false,
        "environmentRoot": "/tmp/test-npm-workspace",
        "verbose": true
      }
    }
  }
}
```

Read more under [bootstrap executor docs](./src/executors/env-bootstrap/README.md).

### Kill Process Executor

This executor helps to kill processes by `ProcessID` or a JSON file containing a property `pid` as number.

```jsonc
// project.json
{
  "name": "my-project",
  "targets": {
    "nxv-kill-process": {
      "executor": "@push-based/nx-verdaccio:kill-process",
      "options": {
        "pid": "42312",
        "filePath": "/tmp/test-npm-workspace/process-id.json",
        "verbose": true
      }
    }
  }
}
```

Read more under [kill-process executor docs](./src/executors/kill-process/README.md).

### NPM Install Executor

This executor helps to install a [`publishable`](../../README.md#fine-grained-control-for-publishable-projects-) projects into a given [environment folder](../../docs/benefits.md#-environment-folders-to-isolate-files-during-e2e-tests).

In `project.json`:

```jsonc
{
  "name": "my-project",
  "targets": {
    "nxv-pkg-install": {
      "executor": "@code-pushup/nx-verdaccio:pkg-install",
      "options": {
        "pkgVersion": "1.2.3",
        "environmentRoot": "/tmp/test-npm-workspace",
        "verbose": true
      }
    }
  }
}
```

Read more under [pkg install executor docs](./src/executors/pkg-install/README.md).

### NPM Publish Executor

This executor helps to publish a [`publishable`](../../README.md#fine-grained-control-for-publishable-projects-) projects into a given [environment folder](../../docs/benefits.md#-environment-folders-to-isolate-files-during-e2e-tests).

In `project.json`:

```jsonc
{
  "name": "my-project",
  "targets": {
    "nxv-pkg-publish": {
      "executor": "@code-pushup/nx-verdaccio:pkg-publish",
      "options": {
        "pkgVersion": "1.2.3",
        "environmentRoot": "/tmp/test-npm-workspace",
        "verbose": true
      }
    }
  }
}
```

Read more under [pkg publish executor docs](./src/executors/pkg-publish/README.md).

## Debugging e2e environments

Debug full environment in 1 setup:

- `nx run utils-e2e:env-setup` - setup environment for `utils-e2e`
- `nx run utils-e2e:env-setup --keepServerRunning` - keeps Verdaccio running after setup
- `nx run utils-e2e:env-cleanup` - stops the Verdaccio server for `utils-e2e` folder and cleans up files

Debug full environment in 2 steps:

- `nx run utils-e2e:bootstrap-env` - setup folders and starts Verdaccio for `utils-e2e`
- `nx run utils-e2e:install-env` - bootstraps and installs all dependencies for `utils-e2e`
- `nx run utils-e2e:stop-verdaccio` - stops the Verdaccio server for `utils-e2e`

Debug packages:

- `nx run utils-e2e:bootstrap-env` - setup folders and starts Verdaccio for `utils-e2e`
- `nx run utils:pkg-publish --envProject utils-e2e` - publishes `utils` and `models` to the Verdaccio registry configured for `utils-e2e`
- `nx run utils:pkg-install --envProject utils-e2e` - installs `utils` and `models` from the Verdaccio registry configured for `utils-e2e`
- `nx run utils-e2e:stop-verdaccio` - stops the Verdaccio server for `utils-e2e`