@jttc/projen-project-types 1.0.0-beta.2 → 1.0.0-beta.3
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/.cz-config.js +8 -1
- package/.jsii +440 -5
- package/API.md +9621 -252
- package/README.md +186 -29
- package/docs/components/cdk8s.md +724 -0
- package/docs/index.md +74 -13
- package/docs/project-types/cdk-app.md +481 -0
- package/docs/project-types/cdk-library.md +16 -108
- package/docs/project-types/cdk8s-library.md +442 -0
- package/lib/cdk/cdk-app-project.d.ts +9 -0
- package/lib/cdk/cdk-app-project.js +27 -0
- package/lib/cdk/cdk-library-project.js +1 -1
- package/lib/cdk/cdk8s-library-project.d.ts +12 -0
- package/lib/cdk/cdk8s-library-project.js +37 -0
- package/lib/components/cdk8s/cdk8s.d.ts +11 -0
- package/lib/components/cdk8s/cdk8s.js +98 -0
- package/lib/components/cdk8s/index.d.ts +2 -0
- package/lib/components/cdk8s/index.js +19 -0
- package/lib/components/cdk8s/interfaces/Cdk8s.d.ts +39 -0
- package/lib/components/cdk8s/interfaces/Cdk8s.js +12 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +18 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +4 -1
- package/mkdocs.yml +4 -0
- package/package.json +6 -6
package/docs/index.md
CHANGED
|
@@ -29,26 +29,87 @@ While projen provides excellent base project types, real-world projects often re
|
|
|
29
29
|
|
|
30
30
|
## Getting Started
|
|
31
31
|
|
|
32
|
-
Choose from our available project types:
|
|
32
|
+
Choose from our available project types and components:
|
|
33
33
|
|
|
34
|
-
###
|
|
34
|
+
### 📦 Project Types
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
| Project Type | Description | Use Case | Quick Start |
|
|
37
|
+
|--------------|-------------|----------|-------------|
|
|
38
|
+
| **[CDK Library](project-types/cdk-library.md)** | AWS CDK construct libraries | Creating reusable CDK constructs | `npx projen new --from @jttc/projen-project-types cdk-library` |
|
|
39
|
+
| **[CDK App](project-types/cdk-app.md)** | AWS CDK applications | Building deployable AWS infrastructure | `npx projen new --from @jttc/projen-project-types cdk-app` |
|
|
40
|
+
| **[CDK8s Library](project-types/cdk8s-library.md)** | CDK8s construct libraries with Kubernetes support | Creating reusable Kubernetes constructs | `npx projen new --from @jttc/projen-project-types cdk8s-library` |
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
- VSCode workspace setup with recommended extensions
|
|
40
|
-
- Best practices for CDK library development
|
|
41
|
-
- Fully customizable while maintaining sensible defaults
|
|
42
|
+
### 🧩 Components
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
| Component | Description | Integration | Documentation |
|
|
45
|
+
|-----------|-------------|-------------|---------------|
|
|
46
|
+
| **[CDK8s Component](components/cdk8s.md)** | Kubernetes manifest generation with CDK8s | Can be added to any project type | [View Details](components/cdk8s.md) |
|
|
47
|
+
|
|
48
|
+
### ⚙️ Common Features
|
|
49
|
+
|
|
50
|
+
All project types include:
|
|
51
|
+
|
|
52
|
+
- **[Prettier Configuration](default-configurations.md#prettier-configuration)** - Consistent code formatting
|
|
53
|
+
- **[VSCode Integration](default-configurations.md#vscode-configuration)** - Optimized editor experience
|
|
54
|
+
- **TypeScript Setup** - Best practices and configurations
|
|
55
|
+
- **Testing Framework** - Jest with appropriate configurations
|
|
56
|
+
- **CI/CD Ready** - GitHub Actions workflows included
|
|
47
57
|
|
|
48
58
|
!!! tip "Getting Started"
|
|
49
|
-
After running
|
|
59
|
+
After running any project creation command, follow the interactive prompts to configure your project, then customize further by editing `.projenrc.ts`
|
|
60
|
+
|
|
61
|
+
## Quick Examples
|
|
62
|
+
|
|
63
|
+
### CDK Library Example
|
|
64
|
+
```typescript title=".projenrc.ts"
|
|
65
|
+
import { CdkLibrary } from '@jttc/projen-project-types';
|
|
66
|
+
|
|
67
|
+
const project = new CdkLibrary({
|
|
68
|
+
name: 'my-awesome-constructs',
|
|
69
|
+
author: 'Your Name',
|
|
70
|
+
authorAddress: 'your@email.com',
|
|
71
|
+
repositoryUrl: 'https://github.com/yourusername/my-awesome-constructs.git',
|
|
72
|
+
cdkVersion: '2.1.0',
|
|
73
|
+
defaultReleaseBranch: 'main',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
project.synth();
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### CDK8s Library Example
|
|
80
|
+
```typescript title=".projenrc.ts"
|
|
81
|
+
import { Cdk8sLibrary, K8sVersion } from '@jttc/projen-project-types';
|
|
82
|
+
|
|
83
|
+
const project = new Cdk8sLibrary({
|
|
84
|
+
name: 'my-k8s-constructs',
|
|
85
|
+
author: 'Your Name',
|
|
86
|
+
authorAddress: 'your@email.com',
|
|
87
|
+
repositoryUrl: 'https://github.com/yourusername/my-k8s-constructs.git',
|
|
88
|
+
cdkVersion: '2.1.0',
|
|
89
|
+
defaultReleaseBranch: 'main',
|
|
90
|
+
k8sVersion: K8sVersion.V1_31,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
project.synth();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Architecture
|
|
97
|
+
|
|
98
|
+
This project follows a modular architecture:
|
|
99
|
+
|
|
100
|
+
- **Project Types**: Complete project templates with full configuration
|
|
101
|
+
- **Components**: Reusable functionality that can be added to any project
|
|
102
|
+
- **Common Configurations**: Shared settings applied across all project types
|
|
103
|
+
|
|
104
|
+
## Roadmap
|
|
105
|
+
|
|
106
|
+
Future project types and components planned:
|
|
50
107
|
|
|
51
|
-
|
|
108
|
+
- **Next.js Projects** - Full-stack TypeScript applications
|
|
109
|
+
- **Node.js APIs** - REST and GraphQL API templates
|
|
110
|
+
- **React Libraries** - Component library templates
|
|
111
|
+
- **Terraform Modules** - Infrastructure as Code templates
|
|
112
|
+
- **Docker Components** - Containerization support
|
|
52
113
|
|
|
53
114
|
## Contributing
|
|
54
115
|
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
# CDK App Project
|
|
2
|
+
|
|
3
|
+
The CDK App Project type provides an opinionated setup for creating AWS CDK applications with best practices and common configurations pre-configured.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This project type extends the standard `AwsCdkTypeScriptApp` from projen with additional features:
|
|
8
|
+
|
|
9
|
+
- **Prettier configuration** with sensible defaults
|
|
10
|
+
- **VSCode settings and extensions** for enhanced development experience
|
|
11
|
+
- **Common project structure** and tooling setup
|
|
12
|
+
- **Configurable options** that respect user preferences
|
|
13
|
+
- **CDK app-specific setup** with sample application code
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
To create a new CDK App project, use the projen CLI:
|
|
18
|
+
|
|
19
|
+
```bash linenums="1"
|
|
20
|
+
npx projen new --from @jttc/projen-project-types cdk-app
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This command will create a new project with the CDK App template and prompt you for the required configuration options such as:
|
|
24
|
+
|
|
25
|
+
- Project name
|
|
26
|
+
- CDK version
|
|
27
|
+
- Default branch
|
|
28
|
+
|
|
29
|
+
After the project is created, you can customize it further by editing the `.projenrc.ts` file:
|
|
30
|
+
|
|
31
|
+
```typescript linenums="1" title=".projenrc.ts" hl_lines="4 6 10 11"
|
|
32
|
+
import { CdkApp } from '@jttc/projen-project-types';
|
|
33
|
+
|
|
34
|
+
const project = new CdkApp({
|
|
35
|
+
name: 'my-awesome-cdk-app',
|
|
36
|
+
defaultReleaseBranch: 'main',
|
|
37
|
+
cdkVersion: '2.1.0',
|
|
38
|
+
|
|
39
|
+
// Add any additional customizations here
|
|
40
|
+
prettier: true,
|
|
41
|
+
vscode: true,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
project.synth();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Highlighted lines explanation:**
|
|
48
|
+
|
|
49
|
+
- **Line 4**: Choose a descriptive name for your CDK application
|
|
50
|
+
- **Line 6**: Pin to a specific CDK version for consistency
|
|
51
|
+
- **Line 10**: Enable prettier formatting (default: true)
|
|
52
|
+
- **Line 11**: Enable VSCode workspace configuration (default: true)
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
### Common Configurations
|
|
57
|
+
|
|
58
|
+
This project type includes the same common configurations as other project types:
|
|
59
|
+
|
|
60
|
+
!!! info "Default Configurations"
|
|
61
|
+
For complete details about Prettier and VSCode configurations, see [Default Configurations](../default-configurations.md). This includes:
|
|
62
|
+
|
|
63
|
+
- [Prettier Configuration](../default-configurations.md#prettier-configuration) - Code formatting rules and customization
|
|
64
|
+
- [VSCode Configuration](../default-configurations.md#vscode-configuration) - Editor settings and recommended extensions
|
|
65
|
+
|
|
66
|
+
### CDK App Structure
|
|
67
|
+
|
|
68
|
+
The CDK App project creates a complete application structure with:
|
|
69
|
+
|
|
70
|
+
- **Main application entry point** (`src/main.ts`)
|
|
71
|
+
- **CDK configuration** (`cdk.json`)
|
|
72
|
+
- **Sample stack** (optional via `sampleCode` option)
|
|
73
|
+
- **Deployment scripts** and configuration
|
|
74
|
+
- **Proper TypeScript setup** for CDK apps
|
|
75
|
+
|
|
76
|
+
## Configuration Options
|
|
77
|
+
|
|
78
|
+
### Basic Configuration
|
|
79
|
+
|
|
80
|
+
All standard `AwsCdkTypeScriptAppOptions` are supported. Here are the most common options:
|
|
81
|
+
|
|
82
|
+
```typescript linenums="1" title="Basic CDK App Configuration"
|
|
83
|
+
const project = new CdkApp({
|
|
84
|
+
// Required options
|
|
85
|
+
name: 'my-cdk-app',
|
|
86
|
+
cdkVersion: '2.1.0',
|
|
87
|
+
defaultReleaseBranch: 'main',
|
|
88
|
+
|
|
89
|
+
// Optional configurations (see sections below)
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Common Configuration Options
|
|
94
|
+
|
|
95
|
+
For Prettier and VSCode configuration options, refer to [Default Configurations](../default-configurations.md):
|
|
96
|
+
|
|
97
|
+
- **Prettier**: [Customization Guide](../default-configurations.md#customization)
|
|
98
|
+
- **VSCode**: [Configuration Options](../default-configurations.md#customization)
|
|
99
|
+
|
|
100
|
+
### Sample Code Configuration
|
|
101
|
+
|
|
102
|
+
#### Enable/Disable Sample Code
|
|
103
|
+
|
|
104
|
+
=== "Default Behavior (Enabled)"
|
|
105
|
+
|
|
106
|
+
```typescript linenums="1" title="Sample Code Enabled by Default"
|
|
107
|
+
const project = new CdkApp({
|
|
108
|
+
// ... other options
|
|
109
|
+
// sampleCode: undefined (defaults to enabled)
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
=== "Disable Sample Code"
|
|
114
|
+
|
|
115
|
+
```typescript linenums="1" title="Disable Sample Code" hl_lines="3"
|
|
116
|
+
const project = new CdkApp({
|
|
117
|
+
// ... other options
|
|
118
|
+
sampleCode: false,
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Highlighted line explanation:**
|
|
123
|
+
|
|
124
|
+
- **Line 3**: No sample application code will be generated
|
|
125
|
+
|
|
126
|
+
### Behavior Matrix
|
|
127
|
+
|
|
128
|
+
| `prettier` | `vscode` | `sampleCode` | Prettier Files | VSCode Files | Sample App Code |
|
|
129
|
+
|------------|----------|--------------|----------------|--------------|-----------------|
|
|
130
|
+
| `undefined` | `undefined` | `undefined` | ✅ Created | ✅ Created | ✅ Generated |
|
|
131
|
+
| `true` | `true` | `true` | ✅ Created | ✅ Created | ✅ Generated |
|
|
132
|
+
| `false` | `true` | `false` | ❌ Not created | ✅ Created | ❌ No sample |
|
|
133
|
+
| `true` | `false` | `true` | ✅ Created | ❌ Not created | ✅ Generated |
|
|
134
|
+
| `false` | `false` | `false` | ❌ Not created | ❌ Not created | ❌ No sample |
|
|
135
|
+
|
|
136
|
+
## Examples
|
|
137
|
+
|
|
138
|
+
### Minimal Setup
|
|
139
|
+
|
|
140
|
+
Perfect for getting started quickly with all defaults:
|
|
141
|
+
|
|
142
|
+
```typescript linenums="1" title=".projenrc.ts - Minimal Setup"
|
|
143
|
+
import { CdkApp } from '@jttc/projen-project-types';
|
|
144
|
+
|
|
145
|
+
const project = new CdkApp({
|
|
146
|
+
name: 'simple-cdk-app',
|
|
147
|
+
cdkVersion: '2.1.0',
|
|
148
|
+
defaultReleaseBranch: 'main',
|
|
149
|
+
// All other options use sensible defaults
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
project.synth();
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Customized Setup
|
|
156
|
+
|
|
157
|
+
Example with custom prettier settings and disabled sample code:
|
|
158
|
+
|
|
159
|
+
```typescript linenums="1" title=".projenrc.ts - Advanced Configuration" hl_lines="8 9 15 18"
|
|
160
|
+
import { CdkApp } from '@jttc/projen-project-types';
|
|
161
|
+
|
|
162
|
+
const project = new CdkApp({
|
|
163
|
+
name: 'advanced-cdk-app',
|
|
164
|
+
cdkVersion: '2.1.0',
|
|
165
|
+
defaultReleaseBranch: 'main',
|
|
166
|
+
|
|
167
|
+
// Custom prettier settings
|
|
168
|
+
prettierOptions: {
|
|
169
|
+
settings: {
|
|
170
|
+
printWidth: 120,
|
|
171
|
+
tabWidth: 4,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
// Enable VSCode (explicit)
|
|
176
|
+
vscode: true,
|
|
177
|
+
|
|
178
|
+
// Disable sample code for clean start
|
|
179
|
+
sampleCode: false,
|
|
180
|
+
|
|
181
|
+
// Additional CDK app options
|
|
182
|
+
context: {
|
|
183
|
+
'@aws-cdk/aws-lambda:recognizeLayerVersion': true,
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
project.synth();
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Highlighted lines explanation:**
|
|
191
|
+
|
|
192
|
+
- **Lines 8-13**: Custom prettier settings for longer lines and 4-space indentation
|
|
193
|
+
- **Line 16**: Enable VSCode configuration explicitly
|
|
194
|
+
- **Line 19**: Disable sample code generation for a clean starting point
|
|
195
|
+
|
|
196
|
+
### Production Setup
|
|
197
|
+
|
|
198
|
+
Optimized for production deployments:
|
|
199
|
+
|
|
200
|
+
```typescript linenums="1" title=".projenrc.ts - Production Configuration" hl_lines="8 9 10 11 12"
|
|
201
|
+
import { CdkApp } from '@jttc/projen-project-types';
|
|
202
|
+
|
|
203
|
+
const project = new CdkApp({
|
|
204
|
+
name: 'production-cdk-app',
|
|
205
|
+
cdkVersion: '2.1.0',
|
|
206
|
+
defaultReleaseBranch: 'main',
|
|
207
|
+
|
|
208
|
+
// Production-optimized settings
|
|
209
|
+
sampleCode: false,
|
|
210
|
+
prettier: true,
|
|
211
|
+
vscode: true,
|
|
212
|
+
|
|
213
|
+
// CDK context for production features
|
|
214
|
+
context: {
|
|
215
|
+
'@aws-cdk/core:enableStackNameDuplicates': true,
|
|
216
|
+
'@aws-cdk/core:stackRelativeExports': true,
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
// Dependencies for common production patterns
|
|
220
|
+
deps: [
|
|
221
|
+
'@aws-cdk/aws-lambda',
|
|
222
|
+
'@aws-cdk/aws-apigateway',
|
|
223
|
+
'@aws-cdk/aws-dynamodb',
|
|
224
|
+
],
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
project.synth();
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Highlighted lines explanation:**
|
|
231
|
+
|
|
232
|
+
- **Line 9**: No sample code for production applications
|
|
233
|
+
- **Lines 10-11**: Keep development tools enabled
|
|
234
|
+
- **Lines 14-17**: CDK feature flags for production deployments
|
|
235
|
+
|
|
236
|
+
## Project Structure
|
|
237
|
+
|
|
238
|
+
After running `yarn projen` with a CDK App project, you'll get the following structure:
|
|
239
|
+
|
|
240
|
+
```text title="Generated Project Structure"
|
|
241
|
+
my-cdk-app/
|
|
242
|
+
├── .github/
|
|
243
|
+
│ └── workflows/ # CI/CD workflows
|
|
244
|
+
│ ├── build.yml
|
|
245
|
+
│ └── upgrade-main.yml
|
|
246
|
+
├── .vscode/ # VSCode configuration (if enabled)
|
|
247
|
+
│ ├── extensions.json # Recommended extensions
|
|
248
|
+
│ └── settings.json # Editor settings
|
|
249
|
+
├── src/
|
|
250
|
+
│ └── main.ts # Application entry point (if sampleCode enabled)
|
|
251
|
+
├── test/
|
|
252
|
+
│ └── *.test.ts # Test files
|
|
253
|
+
├── .eslintrc.json # ESLint configuration
|
|
254
|
+
├── .gitignore # Git ignore rules
|
|
255
|
+
├── .prettierrc.json # Prettier config (if enabled)
|
|
256
|
+
├── .projenrc.ts # Projen configuration
|
|
257
|
+
├── cdk.json # CDK configuration
|
|
258
|
+
├── package.json # NPM package configuration
|
|
259
|
+
├── tsconfig.json # TypeScript configuration
|
|
260
|
+
└── README.md # Generated README
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
!!! info "Conditional Files"
|
|
264
|
+
Some files are only created based on your configuration:
|
|
265
|
+
|
|
266
|
+
- `.vscode/` folder: Only when `vscode: true` (default)
|
|
267
|
+
- `.prettierrc.json`: Only when `prettier: true` (default)
|
|
268
|
+
- `src/main.ts`: Only when `sampleCode: true` (default)
|
|
269
|
+
|
|
270
|
+
## Deployment
|
|
271
|
+
|
|
272
|
+
### Local Development
|
|
273
|
+
|
|
274
|
+
For local development and testing:
|
|
275
|
+
|
|
276
|
+
```bash linenums="1"
|
|
277
|
+
# Install dependencies
|
|
278
|
+
yarn install
|
|
279
|
+
|
|
280
|
+
# Build the project
|
|
281
|
+
yarn build
|
|
282
|
+
|
|
283
|
+
# Synthesize CloudFormation templates
|
|
284
|
+
npx cdk synth
|
|
285
|
+
|
|
286
|
+
# Deploy to AWS (requires AWS credentials)
|
|
287
|
+
npx cdk deploy
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### CI/CD Pipeline
|
|
291
|
+
|
|
292
|
+
The generated GitHub Actions workflows provide automated:
|
|
293
|
+
|
|
294
|
+
- **Build and test** on pull requests
|
|
295
|
+
- **Dependency updates** with automated PRs
|
|
296
|
+
- **Security scanning** with automated vulnerability detection
|
|
297
|
+
|
|
298
|
+
### CDK Commands
|
|
299
|
+
|
|
300
|
+
Common CDK commands you'll use:
|
|
301
|
+
|
|
302
|
+
```bash linenums="1"
|
|
303
|
+
# List all stacks
|
|
304
|
+
npx cdk list
|
|
305
|
+
|
|
306
|
+
# Show differences before deployment
|
|
307
|
+
npx cdk diff
|
|
308
|
+
|
|
309
|
+
# Deploy specific stack
|
|
310
|
+
npx cdk deploy StackName
|
|
311
|
+
|
|
312
|
+
# Destroy stack
|
|
313
|
+
npx cdk destroy StackName
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Best Practices
|
|
317
|
+
|
|
318
|
+
### 1. Use Consistent Configurations
|
|
319
|
+
|
|
320
|
+
Stick with the default prettier and VSCode configurations unless you have specific requirements. This ensures consistency across your team and projects.
|
|
321
|
+
|
|
322
|
+
### 2. Pin CDK Version
|
|
323
|
+
|
|
324
|
+
Always specify a specific CDK version to ensure consistent builds:
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
cdkVersion: '2.1.0', // Good - specific version
|
|
328
|
+
// cdkVersion: '^2.0.0', // Avoid - could lead to inconsistencies
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### 3. Environment-Specific Configuration
|
|
332
|
+
|
|
333
|
+
Use CDK context for environment-specific settings:
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
context: {
|
|
337
|
+
'myapp:environment': 'production',
|
|
338
|
+
'myapp:region': 'us-east-1',
|
|
339
|
+
},
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### 4. Leverage Sample Code for Learning
|
|
343
|
+
|
|
344
|
+
Keep `sampleCode: true` when learning CDK or starting new projects. Disable it for production applications.
|
|
345
|
+
|
|
346
|
+
### 5. Use Feature Flags
|
|
347
|
+
|
|
348
|
+
Enable CDK feature flags for better functionality:
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
context: {
|
|
352
|
+
'@aws-cdk/core:enableStackNameDuplicates': true,
|
|
353
|
+
'@aws-cdk/core:stackRelativeExports': true,
|
|
354
|
+
},
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Troubleshooting
|
|
358
|
+
|
|
359
|
+
### CDK Commands Not Working
|
|
360
|
+
|
|
361
|
+
If CDK commands fail:
|
|
362
|
+
|
|
363
|
+
1. Ensure AWS credentials are configured (`aws configure`)
|
|
364
|
+
2. Verify CDK is installed globally (`npm install -g aws-cdk`)
|
|
365
|
+
3. Bootstrap your AWS environment (`npx cdk bootstrap`)
|
|
366
|
+
|
|
367
|
+
### Prettier Not Working
|
|
368
|
+
|
|
369
|
+
If prettier isn't formatting your code:
|
|
370
|
+
|
|
371
|
+
1. Ensure the prettier extension is installed in VSCode
|
|
372
|
+
2. Check that `"editor.defaultFormatter": "esbenp.prettier-vscode"` is in your VSCode settings
|
|
373
|
+
3. Verify `.prettierrc.json` exists in your project root
|
|
374
|
+
|
|
375
|
+
### Build Errors
|
|
376
|
+
|
|
377
|
+
If you encounter build errors:
|
|
378
|
+
|
|
379
|
+
1. Run `yarn install` to ensure all dependencies are installed
|
|
380
|
+
2. Run `yarn projen` to regenerate configuration files
|
|
381
|
+
3. Check TypeScript errors with `yarn build`
|
|
382
|
+
|
|
383
|
+
### Deployment Issues
|
|
384
|
+
|
|
385
|
+
Common deployment problems:
|
|
386
|
+
|
|
387
|
+
1. **Missing permissions**: Ensure your AWS credentials have sufficient permissions
|
|
388
|
+
2. **Resource conflicts**: Use unique resource names across environments
|
|
389
|
+
3. **Stack limits**: AWS has limits on resources per stack
|
|
390
|
+
|
|
391
|
+
## Migration Guide
|
|
392
|
+
|
|
393
|
+
### From Standard AwsCdkTypeScriptApp
|
|
394
|
+
|
|
395
|
+
To migrate from a standard `AwsCdkTypeScriptApp` to `CdkApp`:
|
|
396
|
+
|
|
397
|
+
1. Install the package: `npm install @jttc/projen-project-types`
|
|
398
|
+
2. Update your `.projenrc.ts`:
|
|
399
|
+
|
|
400
|
+
```diff
|
|
401
|
+
- import { AwsCdkTypeScriptApp } from 'projen/lib/awscdk';
|
|
402
|
+
+ import { CdkApp } from '@jttc/projen-project-types';
|
|
403
|
+
|
|
404
|
+
- const project = new AwsCdkTypeScriptApp({
|
|
405
|
+
+ const project = new CdkApp({
|
|
406
|
+
// ... same options
|
|
407
|
+
});
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
3. Run `yarn projen` to regenerate files
|
|
411
|
+
4. Commit the changes
|
|
412
|
+
|
|
413
|
+
The migration is backward compatible - all existing options will continue to work.
|
|
414
|
+
|
|
415
|
+
## Advanced Configuration
|
|
416
|
+
|
|
417
|
+
### Custom CDK Context
|
|
418
|
+
|
|
419
|
+
Configure CDK behavior with context values:
|
|
420
|
+
|
|
421
|
+
```typescript linenums="1" title="Advanced CDK Context"
|
|
422
|
+
const project = new CdkApp({
|
|
423
|
+
name: 'advanced-app',
|
|
424
|
+
cdkVersion: '2.1.0',
|
|
425
|
+
context: {
|
|
426
|
+
// Feature flags
|
|
427
|
+
'@aws-cdk/core:enableStackNameDuplicates': true,
|
|
428
|
+
'@aws-cdk/aws-lambda:recognizeLayerVersion': true,
|
|
429
|
+
|
|
430
|
+
// Custom application context
|
|
431
|
+
'myapp:database-name': 'production-db',
|
|
432
|
+
'myapp:api-domain': 'api.example.com',
|
|
433
|
+
},
|
|
434
|
+
});
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Additional Dependencies
|
|
438
|
+
|
|
439
|
+
Add commonly used CDK modules:
|
|
440
|
+
|
|
441
|
+
```typescript linenums="1" title="Common CDK Dependencies"
|
|
442
|
+
const project = new CdkApp({
|
|
443
|
+
name: 'full-stack-app',
|
|
444
|
+
cdkVersion: '2.1.0',
|
|
445
|
+
deps: [
|
|
446
|
+
// Core AWS services
|
|
447
|
+
'@aws-cdk/aws-lambda',
|
|
448
|
+
'@aws-cdk/aws-apigateway',
|
|
449
|
+
'@aws-cdk/aws-dynamodb',
|
|
450
|
+
'@aws-cdk/aws-s3',
|
|
451
|
+
|
|
452
|
+
// Additional tools
|
|
453
|
+
'@aws-cdk/aws-route53',
|
|
454
|
+
'@aws-cdk/aws-certificatemanager',
|
|
455
|
+
'@aws-cdk/aws-cloudfront',
|
|
456
|
+
],
|
|
457
|
+
});
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## Contributing
|
|
461
|
+
|
|
462
|
+
To contribute improvements to the CDK App project type:
|
|
463
|
+
|
|
464
|
+
1. Fork the repository
|
|
465
|
+
2. Make your changes
|
|
466
|
+
3. Add tests for new functionality
|
|
467
|
+
4. Update documentation
|
|
468
|
+
5. Submit a pull request
|
|
469
|
+
|
|
470
|
+
## Support
|
|
471
|
+
|
|
472
|
+
If you encounter issues or have questions:
|
|
473
|
+
|
|
474
|
+
- Check this documentation
|
|
475
|
+
- Review existing GitHub issues
|
|
476
|
+
- Create a new issue with detailed information
|
|
477
|
+
- Tag the maintainers for urgent issues
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
*This project type is maintained by [Jump to the Cloud](https://jumptothecloud.tech) team.*
|