Skip to content

Commit

Permalink
Add support to include pipeline configuraiton in pacakge.json files m…
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvv committed Dec 18, 2024
1 parent 62bf617 commit e8cdd33
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/cli/src/commands/run/createTargetGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,27 @@ export async function createTargetGraph(options: CreateTargetGraphOptions) {
}
}

for (const [id, definition] of Object.entries(pipeline)) {
const pipelineEntries = Object.entries(pipeline);

// Add lage pipeline configuration in the package.json files.
// They are configured in the lage field, but without the package id.
// i.e. having this package.json
// { "name": "@lage-run/globby", "lage": { "transpile": { type: "npmScript" } }}
// is equivalent to having the following in lage.config.js
// { pipeline: { "@lage-run/globby#transpile": { type: "npmScript" } }
// We conciously add these 'after' the ones in lage.config.js
// to indicate that the more specific package.json definition takes
// precedence over the global lage.config.js.
for (const [packageId, packageInfo] of Object.entries(packageInfos)) {
const packageLageDefinition = packageInfo.lage as PipelineDefinition;
if (packageLageDefinition) {
for (const [id, definition] of Object.entries(packageLageDefinition)) {
pipelineEntries.push([packageId + "#" + id, definition]);
}
}
}

for (const [id, definition] of pipelineEntries) {
if (Array.isArray(definition)) {
builder.addTargetConfig(
id,
Expand Down

0 comments on commit e8cdd33

Please sign in to comment.