Skip to content

Commit

Permalink
feat(contented-pipeline): pipeline transform to include file (#592)
Browse files Browse the repository at this point in the history
#### What this PR does / why we need it:

As per title.
  • Loading branch information
fuxingloh authored Aug 28, 2023
1 parent bd684fe commit f52a8eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/contented-pipeline/src/Pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface Pipeline {
fields?: {
[name: string]: PipelineField;
};
transform?: (file: FileContent) => Promise<FileContent>;
transform?: (file: FileContent, filePath: string) => Promise<FileContent>;
sort?: (a: FileIndex, b: FileIndex) => number;
}

Expand Down Expand Up @@ -64,7 +64,7 @@ export abstract class ContentedPipeline {
if (this.pipeline.transform === undefined) {
return contents;
}
return Promise.all(contents.map(this.pipeline.transform));
return Promise.all(contents.map((content) => this.pipeline.transform!(content, file)));
}

/**
Expand Down

0 comments on commit f52a8eb

Please sign in to comment.