Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dannyvv opened this issue Nov 7, 2024 · 0 comments
Open

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

dannyvv opened this issue Nov 7, 2024 · 0 comments
Assignees

Comments

@dannyvv
Copy link
Member

dannyvv commented Nov 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants