Skip to content

[RFC]: Target settings support in package.json #817

@dannyvv

Description

@dannyvv

This RFC is part of a larger work proposal: #814
PR: #837

Overview

Today all configurations of targets needs to be defined in lage.config (or through cosmiconfig in the package.json at the root of the monorepo)
In large repo's this can become cumbersome to maintain centrally. It would be better if this was implemented a bit closer to where it would be needed like in the package.json file of the package.

Detailed Design

We allow package.json to have a field 'lage' (similar to how we allow it through cosmiconfig in the root package.json.
In that location we would allow a value of type PipelineDefinition. These values would not be be identical.

So instead of having

    "@lage-run/e2e-tests#test": {
      "type": "npmScript",
      "dependsOn": ["^^transpile", "lage#bundle"],
    },

in lage.config.js

One can update the package.json for this package

{
  "name": "@lage-run/e2e-tests",
  "version": "0.1.0",
  "description": "End to End Tests for Lage",
  ...
  "lage": {
    "test": {
      "type": "npmScript",
      "dependsOn": ["^^transpile", "lage#bundle"],
    },
  }
}

When the pipeline definitions are included in the main configuration object, we would prepend the package name. I.e. the example above would be identical. globally the key would be @lage-run/e2e-tests#test.

Implementation Plan

  1. Extend function createTargetGraph in CreateTargetGraph.ts .
  2. At the end of the function we'll loop over packageInfo's extract the lage field.
  3. For each pipeline rule, update the name by prepending the packageInfo.name and a #
  4. Call builder.addTargetConfig

Test Plan

Vanilla unittests

Performance, Resilience, Monitoring

There should be no major perf impact because all packages are already read and loaded.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions