Skip to content

Commit

Permalink
Merge pull request #64 from rogerchi/feature/extend-lambda-resources-…
Browse files Browse the repository at this point in the history
…interface

feat: add metadata to LambdaResource
  • Loading branch information
ServerlessLife authored Oct 2, 2024
2 parents 1863b0b + ff84883 commit 6de7437
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 6de7437

Please sign in to comment.