push-based / nx-verdaccio

Enterprise E2E setup for Nx and Verdaccio
8 stars 0 forks source link

feat: configure projects depending on environments in plugin config #20

Closed BioPhoton closed 2 weeks ago

BioPhoton commented 3 weeks ago

Precondition:

Problem

As a user of the plugin I want to be able to have a fine grained control over which packages the plugin should consider as publishable.

At the moment we can do that by adding a publishable tag in the projects project.json file:

{
  "name": "my-lib",
  // ...
   "targets": {
    "e2e": {
      "dependsOn": [
        {
          "projects": "self", "params": "forward", "target": "setup-env"
        }
      ],
       // ...
    }
}

Solution

It would be better to be able to control this dependency over plugin options:

// nx.json
{
  "plugins": [
    {
      "plugin": "@pushu-based/nx-environments",
      "options": {
         // same API as the Nx `projects` filter of `run-many`
         // https://nx.dev/nx-api/nx/documents/run-many#options
         "projectsFilter": ["e2e", "tag:e2e-verdaccio"]
      }
    }
  ]
}

Those projects are then later enriched with dependent tasks:

// taks graph after plugin run

{
  "name": "my-lib",
  // ...
   "targets": {
    "e2e": { 
      "dependsOn": [
        {
          "projects": "self", "params": "forward", "target": "setup-env"
        }
      ],
       // ...
    }
}