Skip to content

Commit

Permalink
feat: add metadata to LambdaResource
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerchi committed Oct 1, 2024
1 parent 1c393a4 commit ff84883
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/frameworks/cdkFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ export class CdkFramework implements IFramework {
define: lambdaInCdk.bundling?.define,
external: external.length > 0 ? external : undefined,
},
metadata: {
framework: 'cdk',
stackName: lambdaInCdk.stackName,
cdkPath: lambdaInCdk.cdkPath,
},
});
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/frameworks/samFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export class SamFramework implements IFramework {
handler,
packageJsonPath,
esBuildOptions,
metadata: {
framework: 'sam',
stackName,
},
};

lambdasDiscovered.push(lambdaResource);
Expand Down
3 changes: 3 additions & 0 deletions src/frameworks/slsFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ export class SlsFramework implements IFramework {
handler,
packageJsonPath,
esBuildOptions,
metadata: {
framework: 'sls',
},
};

lambdasDiscovered.push(lambdaResource);
Expand Down
3 changes: 3 additions & 0 deletions src/frameworks/terraformFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ export class TerraformFramework implements IFramework {
handler,
packageJsonPath,
esBuildOptions: undefined,
metadata: {
framework: 'terraform',
},
};

lambdasDiscovered.push(lambdaResource);
Expand Down
16 changes: 16 additions & 0 deletions src/types/resourcesDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ export type LambdaResource = {
forceBundle?: boolean;
bundlingType?: BundlingType;
esBuildOptions?: EsBuildOptions;
metadata: {
/**
* Framework name
*/
framework: string;

/**
* If framework is CDK or SAM, this is the stack name
*/
stackName?: string;

/**
* If framework is CDK, this is the construct path
*/
cdkPath?: string;
};
};

export enum BundlingType {
Expand Down

0 comments on commit ff84883

Please sign in to comment.