@nikovirtala/projen-bundle-lambda-function-code 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.kiro/steering/product.md +15 -0
- package/.kiro/steering/structure.md +56 -0
- package/.kiro/steering/tech.md +61 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Product Overview
|
|
2
|
+
|
|
3
|
+
A Projen component that automates AWS Lambda function code bundling using esbuild. The library provides auto-discovery of Lambda handlers, generates CDK constructs with pre-bundled code, and integrates seamlessly into Projen-based TypeScript projects.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- Auto-discovers Lambda handler files by extension (e.g., `.lambda.ts`)
|
|
8
|
+
- Bundles Lambda code using esbuild for fast, efficient builds
|
|
9
|
+
- Generates CDK constructs (`aws_lambda.Code.fromAsset`) for each Lambda function
|
|
10
|
+
- Integrates into Projen's build lifecycle (pre-compile phase)
|
|
11
|
+
- Supports customizable bundling options per function
|
|
12
|
+
|
|
13
|
+
## Target Users
|
|
14
|
+
|
|
15
|
+
Developers building AWS CDK applications with Projen who want automated Lambda bundling without manual configuration.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Project Structure
|
|
2
|
+
|
|
3
|
+
## Directory Layout
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
.
|
|
7
|
+
├── src/ # Source code
|
|
8
|
+
│ ├── index.ts # Main exports: LambdaFunctionCodeBundler
|
|
9
|
+
│ ├── bundler.ts # Core Bundler component and esbuild integration
|
|
10
|
+
│ ├── lambda-function-code.ts # LambdaFunctionCodeBundle component
|
|
11
|
+
│ └── utils.ts # Utility functions
|
|
12
|
+
├── .projenrc.ts # Projen project configuration
|
|
13
|
+
├── biome.jsonc # Biome formatter/linter config
|
|
14
|
+
└── package.json # NPM package manifest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Source Code Organization
|
|
18
|
+
|
|
19
|
+
### `src/index.ts`
|
|
20
|
+
- Exports `LambdaFunctionCodeBundler` class
|
|
21
|
+
- Auto-discovery component that finds Lambda handlers by extension
|
|
22
|
+
- Extends `cdk.AutoDiscoverBase` from Projen
|
|
23
|
+
|
|
24
|
+
### `src/bundler.ts`
|
|
25
|
+
- Core `Bundler` component for esbuild integration
|
|
26
|
+
- Manages bundle tasks and esbuild configuration
|
|
27
|
+
- Provides `addBundle()` method for creating individual bundles
|
|
28
|
+
- Singleton pattern via `Bundler.of(project)`
|
|
29
|
+
|
|
30
|
+
### `src/lambda-function-code.ts`
|
|
31
|
+
- `LambdaFunctionCodeBundle` component for individual Lambda functions
|
|
32
|
+
- Generates TypeScript construct files with `aws_lambda.Code.fromAsset()`
|
|
33
|
+
- Handles path resolution between source and bundled assets
|
|
34
|
+
|
|
35
|
+
### `src/utils.ts`
|
|
36
|
+
- Helper functions for path manipulation and naming conventions
|
|
37
|
+
|
|
38
|
+
## Generated Files
|
|
39
|
+
|
|
40
|
+
During build, the following are generated:
|
|
41
|
+
|
|
42
|
+
- `assets/*/` - Bundled Lambda function code (gitignored, included in npm package)
|
|
43
|
+
- `src/*-code.ts` - Generated CDK construct files for each Lambda handler
|
|
44
|
+
|
|
45
|
+
## Naming Conventions
|
|
46
|
+
|
|
47
|
+
- Lambda handlers: `*.lambda.ts` (configurable extension)
|
|
48
|
+
- Generated constructs: `*-code.ts` (e.g., `hello-world.lambda.ts` → `hello-world-code.ts`)
|
|
49
|
+
- Construct names: PascalCase with `FunctionCode` suffix (e.g., `HelloWorldFunctionCode`)
|
|
50
|
+
- Bundle task names: `bundle:<name>` (e.g., `bundle:hello-world`)
|
|
51
|
+
|
|
52
|
+
## Configuration Files
|
|
53
|
+
|
|
54
|
+
- `.projenrc.ts` - Single source of truth for project configuration
|
|
55
|
+
- `biome.jsonc` - Generated from Projen config, do not edit directly
|
|
56
|
+
- `tsconfig.json` - Generated from Projen config
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Technology Stack
|
|
2
|
+
|
|
3
|
+
## ⚠️ Projen-Managed Project
|
|
4
|
+
|
|
5
|
+
This project is **entirely managed by projen**. Key implications:
|
|
6
|
+
|
|
7
|
+
- **DO NOT** manually edit generated files (package.json, tsconfig.json, etc.)
|
|
8
|
+
- **ALL** configuration changes must be made in `.projenrc.ts`
|
|
9
|
+
- After modifying `.projenrc.ts`, run `npx projen` to regenerate files
|
|
10
|
+
- Dependencies, scripts, and tooling are defined in `.projenrc.ts`, not package.json
|
|
11
|
+
|
|
12
|
+
## Build System
|
|
13
|
+
|
|
14
|
+
- **Projen**: Project configuration and task management
|
|
15
|
+
- **TypeScript**: Primary language (TypeScript 5.9+)
|
|
16
|
+
- **pnpm**: Package manager (v10)
|
|
17
|
+
- **Biome**: Code formatting and linting (replaces ESLint/Prettier)
|
|
18
|
+
|
|
19
|
+
## Key Dependencies
|
|
20
|
+
|
|
21
|
+
- `projen`: Core framework for project configuration
|
|
22
|
+
- `case`: String case conversion utilities
|
|
23
|
+
- `esbuild`: JavaScript bundler (added as build dependency)
|
|
24
|
+
- `constructs`: AWS CDK constructs library
|
|
25
|
+
|
|
26
|
+
## Code Quality
|
|
27
|
+
|
|
28
|
+
- **Biome** for formatting and linting
|
|
29
|
+
- 4-space indentation
|
|
30
|
+
- 120 character line width
|
|
31
|
+
- Double quotes for JavaScript/TypeScript
|
|
32
|
+
- No ESLint, Prettier, or Jest (configured out)
|
|
33
|
+
|
|
34
|
+
## Common Commands
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Install dependencies
|
|
38
|
+
pnpm install
|
|
39
|
+
|
|
40
|
+
# Build the project (compiles TypeScript)
|
|
41
|
+
pnpm build
|
|
42
|
+
|
|
43
|
+
# Run Biome formatter and linter
|
|
44
|
+
pnpm biome
|
|
45
|
+
|
|
46
|
+
# Update Projen configuration
|
|
47
|
+
npx projen
|
|
48
|
+
|
|
49
|
+
# Bundle Lambda functions (runs during pre-compile)
|
|
50
|
+
npx projen bundle
|
|
51
|
+
|
|
52
|
+
# Release new version
|
|
53
|
+
pnpm release
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Development Workflow
|
|
57
|
+
|
|
58
|
+
1. Modify `.projenrc.ts` for project configuration changes
|
|
59
|
+
2. Run `npx projen` to regenerate project files
|
|
60
|
+
3. Use `pnpm build` to compile and bundle
|
|
61
|
+
4. Biome runs automatically on save (VSCode integration)
|
package/package.json
CHANGED